2024-06-22 02:42 AM
Hi,
I recently created a custom board based on STM32G030 IC and programmed it via UART to run my application. Now, I want to make some changes to my firmware, but I can not connect to the CubeProgrammer. I have tried connecting it via UART and ST-LINK. Below are the errors i get when I try to connect the board via different methods
via UART- "Error: Activating device: KO. Please, verify the boot mode configuration and check the serial port configuration. Reset your device then try again... "
via ST-Link- "Error: No STM32 target found! If your product embeds Debug Authentication, please perform a discovery using Debug Authentication". The interesting thing here is that CubeProgrammer reads the board as a Nucleo-F303RE(I am using the ST-LINK from this board and have removed the necessary jumpers i.e on CN2)
I have tried to give 3.3V to pin 19(PA14) of the IC which is the Boot0 pin and restarting the board, but I am still not able to program the board. I can confirm that the IC is running the firmware which I uploaded as I can view it on one of my COM ports. How do I get the board back into programming mode? Even the SWD debugging is not working
Solved! Go to Solution.
2024-06-24 03:46 AM
Ok.
+
> I would like to reprogram the board using UART
Then you have to use the Boot pin , PA14/15 ; + pulldown (10k) ; + 100nF cap on NRST .
+ set nBOOT_SEL bit -> 0 (with swd connection -> option bytes )
Then (after reset, with boot pin PA14 : high ) you get bootloader access on Rx/Tx .
So you need : nrst, swd, swc, boot pin, and Rx, Tx ; 6 pins for this !
-----
If you just use st-link , swd, then : nrst, swd, swc ; 3 pins .
And you can even the swd+swc pins use for other function, if dont need debug any more;
still have access to swd with hard-reset/under reset , to flash/program/set option bytes .
2024-06-22 12:09 PM
Welcome @Bhavil, to the community!
What does your ST-LINK look like? Please upload a photo of it, preferably front and back.
Regards
/Peter
2024-06-22 12:42 PM
Hi,
how you tried to connect ? (try: software reset )
+
show pic, what programmer shows ...
2024-06-22 09:06 PM
Hi Peter,
Unfortunately I do not have the photo right now, I will upload the photo tomorrow. But if it helps, I am using the ST-LINK present on one of my Nucleo-F303RE boards.
2024-06-22 09:11 PM
Hey Ascha,
I have tried to connect with the SWD pins via Normal mode and the hotplug mode but to no avail. I have tried both Hardware Reset and Software reset. I do not have the picture today, but I'll attach the pictures from the programmer tomorrow.
2024-06-23 01:45 AM - edited 2024-06-23 01:51 AM
Hi,
just , for hard reset: is the NRST connected to the G030 ? + check its working , with scope ?
+
What about the Boot pin , PA14/15 ? What you set in option bytes ?
-> Maybe only way to connect with st-link "under reset" , (hardware reset) .
2024-06-23 11:39 PM
@Bhavil I had overlooked the fact that you are using a NUCLEO, so a photo is no longer absolutely necessary.
2024-06-23 11:52 PM
No issue Peter,
Does the SWD work on a brand new chip. If I just unpack and solder a new IC to my breakout board, would I be able to connect to CubeProgrammer via an ST-LINK? While programming via UART, I did enable the the Serial Wire interface as you can see in the image below, but unfotunately did not pay much attention to the boot pin's option bytes while flashing the firmware from the CubeProgrammer. My understanding was that the since PA_14 pin is common for Boot0 and SYS_SWCLK, the serial wire would override the option bytes, and I can use SWD without tinkering with the option bytes.
2024-06-24 12:04 AM
Hi Ascha,
Here is the log I get when I try to connect via UART
and this is the log when I try to connect with SWD with Hardware reset. I have pulled up the NRST pin, as I used to get "Target held under reset" error at random times.
I did not change the option bytes at all, so they must be set at their default where all of them are checked.
2024-06-24 12:18 AM - edited 2024-06-24 12:30 AM
>If I just unpack and solder a new IC to my breakout board, would I be able to connect to CubeProgrammer via an ST-LINK?
From rm , boot option byte set to "always bootloader start" : (0xFF)
and boot mode :
11 -> main Flash
BUT:
-> So it starting always (your) program , except on new chip, when no program loaded .
Thats why you could use the serial - link, to load your program ( first time on new chip).
This is over now...
You should get connection with st-link : ST-LINK , set "under reset" , hardware reset. Try...
+ check: connection to st-link "reset" : NRST to your G030 - this should be in working condition.