Having trouble setting up the clock for the external interrupt controller. Can anybody see what is going wrong with my code. I'm sure there's something missing but this is how I have done for the Sercom3/4 usart.
I get stuck in a loop here, which is called from inside system_gclk_chan_set_config(EIC_GCLK_ID, &eic_gclk);
while (GCLK->CLKCTRL.reg & GCLK_CLKCTRL_CLKEN) { /* Wait for clock to become disabled */ }
Here is my initialization code
void EXT_Int_init(void){ struct system_gclk_chan_config eic_gclk; PM->APBAMASK.reg = PM_APBAMASK_EIC; // Turn on Generic Clock system_gclk_chan_get_config_defaults(&eic_gclk); system_gclk_chan_set_config(EIC_GCLK_ID, &eic_gclk); system_gclk_chan_enable(EIC_GCLK_ID); EIC->EVCTRL.bit.EXTINTEO10 = 1; //Set PA10 as external interrupt pin EIC->CONFIG[1].bit.FILTEN2 = 1; //Turn on filtering EIC->CONFIG[1].bit.SENSE2 = 3; //Trigger on both edges EIC->CTRL.reg = EIC_CTRL_ENABLE; while(EIC->STATUS.bit.SYNCBUSY); }