2021-01-29 09:59 PM
Hello
We bought a standard test board for stm32g0 micro , from China and we are testing it.
The vcc and vss are connected properly and .First boot0 pin is in program mode and then is run mode .
The reset button is on the same board and it connects the nrst pin to ground.
I created a simple "blinky" program by cube and downloaded the code by stink.
I set boot0 to 1,the program runs correctly in debug mode But the program does not run ,outside the debug mode.
If you have any ideas in this regard, please guide me.
Thank You
2021-01-29 11:19 PM
If you want the chip to run your prog ("boot from flash"), keep BOOT0 0. Same is true if you want to debug it via SWD/ST-LINK.
If you set BOOT0 to 1, the on-chip bootloader waits for a firmware download via UART etc.. (without attaching SWD/ST-LINK). Your prog is not expected to run in this mode.
Boot pins and behaviour can be overridden, see reference manual. Maybe this is what you see if you say "I set boot0 to 1, the program runs correctly in debug mode".
For more details study AN2606 Application note "STM32 microcontroller system memory boot mode" or ask the board vendor from China.
2021-01-30 09:07 PM
Hi
At the first we designed our board and tested it with the code that we got from https://github.com/fduignan/stm32g030. And we faced this problem.
Then we made the second borad. There were the same problems again. We wrote a new program using registers. We saw the same problems again.
Then we bought a ready board and built a project using a cube. There is the same problem again.
We changed the option byte items according to the attached photos. But again we failed. After reset, the code will not be run.
The program code and photos of the boards are attached.
Please guide us if you have a point.
Thanks
2021-01-30 09:10 PM
2021-01-30 09:11 PM
2021-01-30 09:11 PM
2021-01-30 09:11 PM
2021-01-30 09:11 PM
2021-01-31 12:23 AM
[Edited]
Don't see option bytes in the picture. The confusion may come from the dual role of PA14 as SWCLK and BOOT0.
If you always use a ST-LINK to program/update the firmware: don't use BOOT0 pin function. In order to achieve that, use STM32CubeProgrammer once and set all three BOOT related option bytes: nBOOT_SEL, nBOOT0 and nBOOT1.
After you have done that, your prog should always start after reset, independently of PA14 state. You should also be able to debug+update your prog via ST-LINK.
If you really need BOOT0 function, you must test board functions with the proper pull-up/pull-down and the debug probe *detached* because of the dual use of PA14.
hth
KnarfB