0
votes

I'm learning about embedded systems and have an idea about one small project and I want to use Cortex M0+ based MCU STM32G081KBT6. I saw a lot of tutorials with this MCU type, but all of them are based on developer board and with them it is very simple to upload code with USB cable. I want to make my custom PCB for this. So my question is what I have to do so I can upload my code to this microcontroller?

From a datasheet I think I have to use SWDIO (PA13) and SWCLK(PA14) ports for Boot, but if someone can help me do I have to use also some resistors, can I make it USB to wire transfer with this, or I have to use some external device to make it possible? Or there is some easier and better solution to upload code from my laptop to microcontroller?

Thanks for the replies.

1
I understand making such a board is a challenge but what you are making is just a programmer like ST-Link or a J-Link. If your goal is to build one, take the advice below. If your goal is to be be able to program your own custom boards instead of the dev boards, buy a programmer. Besides just making the board you also have to write a driver for it. Software running on your computer to take the HEX file and send it to the hardware. If you want to be able to debug you got a lot more work to do.Bart

1 Answers

3
votes

There two main options:

SWD

Implement an SWD programming connector. Basically the pins GND, SWDIO, SWCLK and preferably 3.3V are made available. No resisters are needed. You can fit a 4 pin header, an official 10 pin SWD connector or just 4 pads (for connecting using an adapter with pogo pins).

This option requires an SWD debug adapter like ST-Link or J-Link. In addition to uploading firmware, this option supports debugging.

USART

Make the USART (RX, TX) pins plus GND and 3.3V available on the board. This option requires a USB-to-serial adapter.

It's also possible to use I2C or SPI instead, though there are no standard solutions for connecting to your board that I'm aware of.

USB isn't an option for this particular chip. It is supported on many of the more expensive STM32 chips though.

I strongly recommend the first option. It is far more versatile than the other options. And an ST-Link adapter isn't expensive.

Details regarding the bootloader capabilities and pins:

https://www.st.com/resource/en/application_note/cd00167594-stm32-microcontroller-system-memory-boot-mode-stmicroelectronics.pdf