OK, my mistake. Its not quite what I thought, but still causing a problem. I have the PDB firing the ADC, which in turn generates a DMA, which finally generates an interrupt.
This is constantly running in the foreground to indicate the activity of the ADC...
while( true ){
_sched_yield();
while( ( ADC0_SC2 & ADC_SC2_ADACT_MASK ) ){
lwgpio_set_value( &LED2, LWGPIO_VALUE_HIGH );
}
lwgpio_set_value( &LED2, LWGPIO_VALUE_LOW );
}
While this interrupt should just show the DMA int status.
void int_dmaX(void *pin)
{
DMA_CINT = DMA_CINT_CINT( X );
lwgpio_toggle_value( &LED1 );
}
What I get though is the LED1 status altering almost randomly. Its something to do with locking up the task and using lwgpio while waiting for the ADC activity to finish. If I use (next bit of code) it works as expected. It also works as expected if I remove the lwgpio call from the while loop.
while( ( ADC0_SC2 & ADC_SC2_ADACT_MASK ) ){
_sched_yield();
lwgpio_set_value( &LED2, LWGPIO_VALUE_HIGH );
}
Cheers for your help so far.