2022-01-02 01:31 PM
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:
I program the microcontroller with an external STLINK.
Thanks a lot for any help.
2022-01-02 05:11 PM
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.
2022-01-03 06:46 AM
Yes, BOOT0 has a jumper to ground.
2022-01-03 06:56 AM
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.
2022-01-03 07:48 AM
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.
2022-01-10 08:03 AM
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?
this is what is shown in the disassembly:
Thanks a lot.
2022-01-10 08:06 AM
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
2022-01-10 08:13 AM
It sounds like you do not have BOOT0 held low and/or have disabled the BOOT0 pin functionality in option bytes.
2022-01-10 08:15 AM
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
2022-01-10 08:20 AM
I am sure the BOOT0 is held low, but, there is a way to check it or check the BOOT0 functionality?