AT91SAM7X-EK + Reset button
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
reader = AT91C_BASE_RSTC->RSTC_RSR;
//enables NRST pin interrupt
AT91C_BASE_RSTC->RSTC_RMR = (0xA5000000 | 91C_RSTC_URSTIEN);
//enables system interrupt
AT91C_BASE_AIC->AIC_IECR = (1 << AT91C_ID_SYS);
/////////////////////////////////////////////////////////////////////////////////////////
Then I connect the peripheral clock to the system :
AT91C_BASE_PMC->PMC_PCER = 1 << AT91C_ID_SYS;
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)
{
AT91C_BASE_MC->MC_RCR = AT91C_RSTC_PROCRST;
}
But it seems the interrupt function is never called.
What am I forgetting or doing wrong?
AT91SAM7X-EK + Reset button
Not sure this is really a FreeRTOS question, best ask it on the at91.com forum.
AT91SAM7X-EK + Reset button
I have posted it on at91.com forum, but I still think it is FreeRTOS related since I am trying to add this functionality to FreeRTOS lwip demo.
AT91SAM7X-EK + Reset button
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.
AT91SAM7X-EK + Reset button
Now I only enable user reset with:
AT91C_BASE_RSTC->RSTC_RMR = (0xA5000000 | 91C_RSTC_URSTEN);
at startup. When I compile without starting scheduler, it works. Any idea what could block the NRST pin functionality?
AT91SAM7X-EK + Reset button
It looks like my problem is related to the lwIP task…
AT91SAM7X-EK + Reset button
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…
AT91SAM7X-EK + Reset button
Thanks for taking the time to post the solution.
Regards.