Running example code used from the ASF4 example implemented for the same SAME70 Xplained board.
The code uses PA11 pin as input for External IRQ which is triggered by a rising edge of the pulse from the on-board BUTTON.
External IRQ driver and related GPIO pin initializations have been generated by Atmel START.
All the related functionality is working except one problem: Always during the initialization the IRQ is triggered and Callback is called although the Button was not pressed and the level on the pin is steady "high". Afterwards everything works as it should.
I traced the initialization process. The moment after POR when Callback has been registered by a call
ext_irq_register(PIO_PA11_IDX, button_on_PA11_pressed);
The related IRQ #10 (IRQ number is correct for a given pin) gets generated , the IRQ turns PENDING and then ACTIVE, calling the registered Callback.
I tried to set the pin level high before Callback registration :
gpio_set_pin_level(BUTTON, true); // still does not work.
Then I tried to intercept any possible IRQ before registering a Callback and enabling the IRQ. I used the code:
if(NVIC_GetPendingIRQ(PIO_PA11_IDX)) { NVIC_DisableIRQ(PIO_PA11_IDX); NVIC_ClearPendingIRQ(PIO_PA11_IDX); NVIC_EnableIRQ(PIO_PA11_IDX); } ext_irq_register(PIO_PA11_IDX, button_on_PA11_pressed);
Didn't work either. There are no PENDING IRQs ! The IRQ gets generated during the setup of the PIOA registers and related NVIC registers, - regardless the state of the pin.
Is there a known a bug in the library (or in the chip ) related to this?
Does anybody know such problem? Any suggestions?