In the simple example below I just software trigger an ADC acquisition and then set the builtin LED's digital out in the interrupt handler. I don't know why the program appears to halt however.
void setup() {
Serial.begin(115200);
pinMode(13,OUTPUT);
digitalWrite(13,LOW);
adc_enable_channel(ADC, ADC_CHANNEL_6);
adc_enable_interrupt(ADC, ADC_IER_EOC6);
pmc_enable_periph_clk(ID_ADC);
NVIC_EnableIRQ(ADC_IRQn);
Serial.println("GO");
}
void loop()
{
Serial.println("RUNNING");
adc_start(ADC);
}
void ADC_Handler(void)
{
digitalWrite(13,HIGH);
adc_get_status(ADC);
}
I know the handler gets called because the LED lights. The main loops appears to stop running after this as it lo longer prints out anything. If I don't trigger an acquision in the main loop it runs forever. Likewise if I don't enable the interrupt or the NVIC.
I can't explain this behavior.
ADC_Handler
in your setup code, so I doubt this is really called.Arduino15\packages\arduino\hardware\sam\1.6.12\cores\arduino\coretex_handlers.c
It is definitely called because the LED lights up only if that digitalWrite is there.