Skip to main content
Associate III
July 21, 2025
Question

Programming and debbuging a STM32G474

  • July 21, 2025
  • 4 replies
  • 503 views

Hello,

 

I am developing a electronic card that is supposed to be used in an automated test bench. I'm using an STM32G474 to control the card. I have already created one iteration of the card but I realised I made a mistake.

I wanted to use the bootloader to program the card but realised far too late that I didn't install it properly and cannot use it. Plus I'm unable to debug with it.

I now want to replace this system but I can't figure out what to use and how to route it.

I think I could use STlink but I can't seem to figure out how it works and how to route it on the STM.

Could anyone help me figure out this ?

Thank you very much.

4 replies

Andrew Neil
Super User
July 21, 2025

Yes, of course you can use an ST-Link.

Or any SWD-capable probe.

 


@EliazLB wrote:

I can't seem to figure out how it works and how to route it on the STM.


I would strongly suggest that you get a Nucleo board, and look at how that does it, and practice using the tools.

See 'Product Evaluation Tools' on the 'Tools & Software' tab of the Product Page:

https://www.st.com/en/microcontrollers-microprocessors/stm32g474re.html#tools-software

See also the STM32 datasheet and ST-Link User manual.

See also Application note AN5093 Getting started with STM32G4 Series hardware development boards.

 

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
EliazLBAuthor
Associate III
July 21, 2025

I do have a Nucleo board with the right STM on it. 

I just don't really see how it could help as I can't seem to find any schematic I could use.

I'll try to use the AN5093.

But thank you still :)

Andrew Neil
Super User
July 21, 2025

@EliazLB wrote:

I do have a Nucleo board with the right STM on it. 


Which one do you have?

 


@EliazLB wrote:

I can't seem to find any schematic I could use.


The schematics will be on the 'CAD Resources' tab of the Product Page; eg,

https://www.st.com/en/evaluation-tools/nucleo-g474re.html#cad-resources

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
waclawek.jan
Super User
July 21, 2025

Read AN5093 ('G4 hardware design guide), the SWD subchapter of Debug management chapter.

You can also get inspired by the 'G4 Nucleo64 board.

JW

waclawek.jan
Super User
July 21, 2025

>I do have a Nucleo board with the right STM on it. 

Well then you already have the STLink on the same board, and it's by default connected to the target STM32, isn't it.

One basic way to test it is to use the CubeProgrammer.

JW

EliazLBAuthor
Associate III
July 23, 2025

Ok thank you guys for the help, I think I figured something out.

I want to use STlinkV2 and the SWD. I plan on using a 1x6, 2.54 header for the debug. the connection would be 

pin1 - SWDIO (PA13)

pin2 - SWCLK (PA14)

pin3 - NRST (PG10 - NRST)

pin4 - VDD

pin5 - GND

pin6 - X

The package for the µc is an LQFP128.

Does that seem good or is there something to change ? I've seen something about SWO but I don't know how useful that is.

Thanks for the help !