AT91SAM7X-EK + Reset button

fpb453 wrote on Tuesday, March 24, 2009:

I am trying to activate the reset button on the SAM7X demo board within FreeRTOS.   Here is the code I use, that is called in AT91F_LowLevelInit():

//configure system interrupts at highest priority level
AT91F_AIC_ConfigureIt(AT91C_ID_SYS, AT91C_AIC_PRIOR_HIGHEST, AT91C_AIC_SRCTYPE_EXT_NEGATIVE_EDGE,( void (*)( void ) ) vNRST_pin_interrupt);

//clears NRST pin interrupt
//enables NRST pin interrupt
//enables system interrupt


Then I connect the peripheral clock to the system :

I added this line in static void prvSetupHardware( void ) in main.c.
I also wrote my interrupt function that is supposed to reset the processor:
void vNRST_pin_interrupt(void)

But it seems the interrupt function is never called.
What am I forgetting or doing wrong?

davedoors wrote on Tuesday, March 24, 2009:

Not sure this is really a FreeRTOS question, best ask it on the forum.

fpb453 wrote on Tuesday, March 24, 2009:

I have posted it on forum, but I still think it is FreeRTOS related since I am trying to add this functionality to FreeRTOS lwip demo.

fpb453 wrote on Tuesday, March 24, 2009:

My code works fine when I don’t start FreeRTOS scheduler…
I will check to see that my interrupt is enabled when RTOS is running.

fpb453 wrote on Tuesday, March 24, 2009:

Now I only enable user reset with:
at startup.  When I compile without starting scheduler, it works.  Any idea what could block the NRST pin functionality?

fpb453 wrote on Tuesday, March 24, 2009:

It looks like my problem is related to the lwIP task…

fpb453 wrote on Wednesday, March 25, 2009:

Finally, I found out it was the EMAC_Init function that posed problem.
When changing the NRST output length, the function overwrites the other config bits (allowing user reset by NRST input).  I have simply masked the register and insured that only the reset signal length was modified and it works.
I am posting this in case someone else has the same problem…

rtel wrote on Wednesday, March 25, 2009:

Thanks for taking the time to post the solution.