cancel
Showing results for 
Search instead for 
Did you mean: 

My STM32F302C8T6 only runs the program when the code is loaded. If I reset it or power up, it does not run.

JMart.13
Senior

Maybe is a hardware problem since the microcontroller is on a custom board I designed. The problem is the following:

The microcontroller only runs the program the moment I load the code, if I reset it or power up the board after a power-off it does not run the program.

This is the following circuit for the reset and BOOT0 pins:

0693W00000HqLa2QAF.pngI program the microcontroller with an external STLINK. 

Thanks a lot for any help.

11 REPLIES 11
TDK
Guru

And does J1 have any jumper? BOOT0 must be grounded to run user code on reset. On some chips, the option bytes can override the BOOT0 pin.

If you feel a post has answered your question, please click "Accept as Solution".

Yes, BOOT0 has a jumper to ground.

TDK
Guru

Probably it is stuck during startup in your startup code then. Attach a debugger without resetting it to figure out where the CPU is. Could also be some other schematic error not shown in the snippet provided. LSE can take a while to come up and could be timing out. Same for HSE.

If you feel a post has answered your question, please click "Accept as Solution".

Hum ok ok, is strange because I generated the project using the STM32Cube IDE so I guess the startup code is ok, but I will have to check it.

Hi @TDK​ I tried this week to solve the problem but it persists. this maybe can help. Whenever I enter the debug mode and press the reset button when it gets stuck, this message appears. What those it mean? 0693W00000Hr86zQAB.png 

this is what is shown in the disassembly:

0693W00000Hr890QAB.pngThanks a lot.

Means its executing code in the System ROM

Look at the content of SCB->VTOR, and the Vector Table Entries. Both those visible at 0x00000000 and 0x08000000

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

It sounds like you do not have BOOT0 held low and/or have disabled the BOOT0 pin functionality in option bytes.

If you feel a post has answered your question, please click "Accept as Solution".

Ok, when I reset the chip, the value of VTOR (TBLOFF) is 0 in all registers, and according to the ARM Cortex M4 manual, bit 29 determines if the Vector is in code or RAM, it means, that I should put it as 1? if yes, how to do it? hardcode it?

Thanks

I am sure the BOOT0 is held low, but, there is a way to check it or check the BOOT0 functionality?