2008-11-26 10:28 PM
Software reset on STM32
2011-05-17 03:23 AM
Hi all,
I am trying to perform a software reset of a program runing in flash, but it ends up in the HardFaultExecption handler. I did copy a code snippet from an IAP application note: typedef void (*pFunction)(void); pFunction Jump_To_Application; #define ApplicationAddress 0x8000000 /** * @brief Executes a jump to code memory start adr. Soft reset. * @param None * @return Nothing */ void ResetAppl(void) { u32 JumpAddress; JumpAddress = *(vu32*) (ApplicationAddress + 4); /* Jump to user application */ Jump_To_Application = (pFunction) JumpAddress; /* Initialize user application's Stack Pointer */ __MSR_MSP(*(vu32*) ApplicationAddress); Jump_To_Application(); } When debugging I can see that the function pointer points to 0x080046E1 ?? Why ? shouldent it point to 0x08000004 ? however modifying the address to 0x08000004 doesent help either ! btw. I use the IAR ARM 5.11 compiler. Best regards Brian2011-05-17 03:23 AM
Hi Brian,
If you only want to reset the Cortex-M3, you can use a register in the NVIC called Application Interrupt and Reset Control register (Address 0xE000ED0C), bit 0 (VECTRESET). It might be easier to see what went wrong if you can tell us the value of fault status registers and if possibly, dis-assembled code generated by the compiler.2011-05-17 03:23 AM
2011-05-17 03:23 AM
See NVIC_GenerateSystemReset function in the ST firmware library. If your using the firmware library just call this function.
2011-05-17 03:23 AM
Not using the firmware. I like a good challenge :)
But it worked perfectly. In my case: Scb.AIRCR.all = 0x05FA0000 | (u32)0x04; Thanks!