0
\$\begingroup\$

I am attempting to design my own microcontroller board with various sensors and peripherals. I plan on using the board found here (https://www.digikey.com/product-detail/en/stmicroelectronics/STM32F030C8T6TR/497-17331-1-ND/7650387) as the MCU, or another board if it is better/easier to use. Reading the datasheet, it seems that I can boot from user flash, system memory, or embedded SRAM, and the bootloader will program the flash using USART, and and ARM SW-DP interface exists to connect to the MCU. I'm not entirely sure how interface so I can program it.

In Essence: What pins should I be looking at to connect to to program the chip? What external circuitry (if any) do I need?

\$\endgroup\$
  • \$\begingroup\$ the link that you provided is just an MCU chip .... which board were you thinking of using? \$\endgroup\$ – jsotola Jan 20 at 3:39
2
\$\begingroup\$

From STM32F030x4,6,8,C Datasheet (page 12)

Boot modes
At startup, the boot pin and boot selector option bit are used to select one of the three boot options:
  • Boot from User Flash
  • Boot from System Memory
  • Boot from embedded SRAM
The boot loader is located in System Memory. It is used to reprogram the Flash memory by using USART on pins PA14/PA15 or PA9/PA10.

From STM32F0zzz Programming Manual (page 44)

Embedded boot loader
The embedded boot loader is located in the System memory, programmed by ST during production. It is used to reprogram the Flash memory using one of the following serial interfaces:
  • USART on pins PA14/PA15 or PA9/PA10
  • I2C on pins PB6/PB7 ( STM32F070xx and STM32F030xC devices only)
  • USB DFU interface (STM32F070xx devices only)
For further details, please refer to AN2606.

And then document AN2606 gives all the details you’ll need (and more).

\$\endgroup\$
  • \$\begingroup\$ Just to verify my understanding, the boot loader is already on the chip; I can modify the boot loader with USART or I2C. How would I upload a program to the chip then? \$\endgroup\$ – Charsmud Jan 20 at 19:10
1
\$\begingroup\$

By far the best of the interfaces available for that chip is the SWD interface. It's fast, needs only 3(4) pins, and not only allows you to program the chip, but also debug your code (supporting single stepping and reading and writing registers and memory).

You can find (clones of) the ST-LINKv2 programmer practically everywhere for about $3 these will allow you to program your board over the SWD interface using 3 or 4 wires, from any PC with a usb port.

All you need to do on your PCB is bring out on a connector (usually a 4 pin header), a ground, your vcc, swdio (pin 34 on the LQFP 48 you've chosen) and swclk (pin 37). (Make sure you don't use PA14 or PA13 for anything else in your design.)

Once you've assembled your board and connected it to the programmer, either the IDE you're using will support the STLink programmer, or you can use openocd, which is a free tool for driving on chip debuggers, to program your hex or binary file into your mcu.

\$\endgroup\$
  • 2
    \$\begingroup\$ Beware that the clone STLINKs generally cannot assert the hardware reset signal. They have a pin labeled on the header, but they won't drive it. \$\endgroup\$ – Chris Stratton Jan 20 at 4:50
  • \$\begingroup\$ Thank you for the information! Another answer mentions the bootloader, but from what I read it seems like there's a bootloader already on the chip? I'm a little confused by what this means \$\endgroup\$ – Charsmud Jan 20 at 19:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.