cancel
Showing results for 
Search instead for 
Did you mean: 

STM32G0 not works after reset

Samira Foroughi
Associate II

Hello

I work on the stm32g0 micro.

i programmed it with a simple "blinky" code.

it works correctly.but when i reset it doesn't work until i program it again.

can you help me?

14 REPLIES 14

What is your hardware?

How is BOOT0 pin connected? Are all VDD/VSS pins including the analog ones connected properly?

> when i reset 

How? Pulling NRST low? Using power off/on?

> doesn't work

What does it do? Do you have debugger connected?

JW

TDK
Guru

Sure sounds like BOOT0 isn't pulled low.

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

We bought the G series 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.

After resetting, the pins are in floating mode and the LED does not blink. while after programming, the LED blinks and works properly.

Samira Foroughi
Associate II

also we use st link programmer and SW mode for program it.

TDK
Guru

Attach a debugger to a device in a "not working" state and figure out where it is by looking at the PC register. Most likely it's in the bootloader code, in which case you need to figure out why. BOOT0 not being low is one possibility. Option bytes BOOT0, nBOOT1, and nBOOT_SEL can also be set to override the BOOTx pin states and boot directly into the bootloader regardless. Check these with STM32CubeProgrammer and verify against the reference manual.

During programming with STM32CubeIDE, it launches the program directly so it will bypass whatever boot options you have set up.

Another option is if you're not using 0x08000000 as the program address.

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

Hello and thanks for your reply

I created a simple program by cube. I downloaded the code by stink.

I set the debug option to use Simulator and ran the program in debug mode.

When I reset the CPU the program counter is 0x80000D4 and the SystemInit function runs.

Then I set the debug option to STLINK (SW) and run the program,

After resetting the CPU, Program Counter is 0x1fff1994.

If you have any ideas in this regard, please guide me.

Thank You

( the previous code that I was worked on it, I downloaded from this path

https://github.com/fduignan/stm32g030)

KnarfB
Principal III

> After resetting the CPU, Program Counter is 0x1fff1994.

That's in system memory, the internal boot loader.

Check chapter "2.5 Boot configuration" in the RM0444 Reference manual.

You may use the STM32CubeProgrammer tool for checking&setting the user option bytes.

hth

KnarfB

Samira Foroughi
Associate II

I set boot0 to 0 for program micro by com port.(before)

When I set it to 1, in debug mode ,after resetting the CPU, the program counter jumps to 0x8000d4 and the SystemInit function is executed.

This means that when I am in debug mode, the program works properly no matter how many times it is reset.

But the program does not run ,outside the debug mode.

In Table 8 boot mode, there are 2 modes for main flash memory .

I tried each 2 Mode but again it was not successful.

:flushed_face:

TDK
Guru

> When I set it to 1, in debug mode ,after resetting the CPU, the program counter jumps to 0x8000d4 and the SystemInit function is executed.

This means the BOOT0 pin doesn't have an effect on what the chip does. Review your schematic and assumptions, and, as noted above, option bytes.

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