cancel
Showing results for 
Search instead for 
Did you mean: 

Software reset on STM32

brj
Associate II
Posted on November 27, 2008 at 07:28

Software reset on STM32

5 REPLIES 5
brj
Associate II
Posted on May 17, 2011 at 12:23

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

Brian

joseph239955
Associate II
Posted on May 17, 2011 at 12:23

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.

niek_ebbers
Associate II
Posted on May 17, 2011 at 12:23

[ This message was edited by: niek_ebbers on 27-11-2008 11:12 ]

trevor1
Associate II
Posted on May 17, 2011 at 12:23

See NVIC_GenerateSystemReset function in the ST firmware library. If your using the firmware library just call this function.

niek_ebbers
Associate II
Posted on May 17, 2011 at 12:23

Not using the firmware. I like a good challenge :)

But it worked perfectly. In my case:

Scb.AIRCR.all = 0x05FA0000 | (u32)0x04;

Thanks!