cancel
Showing results for 
Search instead for 
Did you mean: 

After calling NVIC_GenerateSystemReset(); the system collapse

chunyu
Associate
Posted on December 23, 2011 at 12:09

Hello,

i am programming the bootloader for the stm32f103c8 mcu.  The SW has bootloader part and application part.  In the application I use the function NVIC_GenerateSystemReset() to reset the mcu to the bootloader mode. In the debug mode( the Jlink ist connected to the board), the bootloader works well, the user code can be downloaded to the mcu over the can bus. but If I dont use the  debugger. the SW collapse after the function NVIC_GenerateSystemReset() is called. The user code can not be downloaded.

The interrupt vector  address I used is following

 

  bootloader :0x0800 0000

 Application: 0x0800  4000

I have  investigated in this problem for a week long and can not solve this problem.

Can somebody help me, it is driving me crazy!

best Regards

Chunyu

1 REPLY 1
Posted on December 23, 2011 at 16:04

It should work in a reasonably predictable way, if you are using the V2 library, I would generally recommend a ''while(1);'' after the call.

The code in the reset path might provide some insight. I'd be tempted to add some assembler code to send some data to a serial port very early to confirm it is getting there. I'd look very carefully at the initial conditions, and how various peripherals are being set up, the JTAG debugger isn't totally transparent in this regard. From a hardware perspective, the system won't reset properly is you have external circuitry driving NRST high, also consider the state of the BOOTx pins. This assembler should also be viable to reset the CPU

SystemReset PROC
EXPORT SystemReset
ldr r1, =0xE000ED0C ; NVIC Application Interrupt and Controller
ldr r0, =0x05FA0004 ; Magic
str r0, [r1, #0] ; Reset
b .
bx lr
ENDP

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..