cancel
Showing results for 
Search instead for 
Did you mean: 

STM32G031J6 stuck in non programmable mode

Elektrik
Associate II

Hi there,

during the development I have accidently flashed (via ST-LINKv2 SWD) two chips (stm32g031j6) with program which sets PA13 as INPUT, PC14 PWM OUTPUT and initiated hardware SPI (pins PA12, PA11, PA1). After flashing this program, chip does not respond to SWD command (no device found), it is due to internal rewirings of pins. Also to note - prior I have disable RST pin (option 2) and set it as GPIO so only software reset is available. I have tried to enter the BOOTLOADER and communicate on pins 8&1 (UART1) and 8&4(UART2) but was unable (8-th pin, which is also a BOOT0) since it is tied to PWM output which is 0 at the program start. Is there any other possibilities to reprogramm the chip without throwing it to trashbin, i.e. to catch the moment of bootloader in this situation?

Thanks.

3 REPLIES 3

Not sure if there is a path to recovery here, not a part I'm using. Perhaps wiring NRST from the ST-LINK in a way that interrupts the power supply to the chip, reseting it that way.

In the future consider a method in your own firmware to mass erase, or reset the option bytes.

It could perhaps dwell shortly before reconfiguring the pins, providing the opportunity for the debugger to connect.

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

If BOOT0 is disabled completely, probably not recoverable. Otherwise tie BOOT0 to 3V3 and perform software reset. Should go into the bootloader.

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

Thank you for the suggestions.

@TDK, the BOOT0 option is not disabled, only NRST_MODE is changed to "2".

I have connected band new (unprogrammed) STM32G031J6 mcu to UART1 (pin 8=USART1_TX; pin 1=USART1_RX) interface (SWD connects fine tho) to try to enter the UART bootloader with no success as well. I think the issue is that chip does not enter bootloader mode, I think the issue is the 8-th pin that shares BOOT0 function with USART1_TX interface on the same pin, there is no way to synchronize the event

(comapred to other chips where BOOT0 has dedicated pin) when to turn off the pull-up (BOOT0=1 condition) to UART1_TX ACK message. I tried to pull-up 8-th pin to 3.3V via 1k resistor and toggle RST pin to ground, Flash Loader Demonstrator still fails to connect. Wonder if this method works at all, sadly those chips are recent and there is no information regarding this situation at all.

Attaching configuration on brand new chip.

0693W000001tMwpQAE.pngAccording to the datasheet this is the pattern for entering bootloader on STM32G03x devices:

0693W000001tN3lQAE.pngthis is true for my case, all conditions are met, but no result.