Showing results for 
Search instead for 
Did you mean: 

Wiring STM32C011J6 (SO8) MCU to STLINK-V3

Associate II

I have an STLINK-V3 set, and I'd like to program an STM32C011J6 MCU.

I'm not sure how to wire the programmer to that device, since I only have eight pins available, with VDD, GND, and RST leaves only five pins remaining, but I'm not sure how to wire the rest of the programmer to the MCU.

I'd like to use the device's both USART ports at the same time, so the BOOT0 pin is technically reassigned to USART1_TX, but I'm not sure this is required for programming.

I've left the RST pin intentionally unchanged, so it is available at all times during normal operation.

I'm not sure I'm missing perhaps a document explaining general wiring for MCUs with a very limited number of pins, etc.

Thanks in advance!



Lead II

You need 3 wires (4 if you want to power the chip from a programmer): GND, SWDIO, SWCLK (and maybe Vdd). Reset is not needed.

OK, but how is the programmer gonna trigger the bootloader etc. if SWDIO and SWCLK are both reassigned to other functions?

Doesn't the programmer need Reset in order boot the MCU into bootloader mode?

Pavel A.
Evangelist II

The Reset pin is very useful, it allows to "connect under reset".

But when Reset is not wired, the debugger tries to connect anyway ("normally"). Often this works - unless the MCU reconfigures SWDIO or SWCLK, of course. The internal bootloader does not play any role in this process.


Principal III

If you want to flash and debug the code, you need SWDIO and SWCLK. They are available at reset. This is a feature of the hardware (see footnote about PA13 PA14 in data sheet). Reassignment is done later in software. One common idea for the software is to wait intentionally for few seconds (or some trigger) before reassigning those pins to a user function. Of cause, you cannot have both at the same time. No on-chip bootloader is involved here.

If you only want to flash, you can use comm interfaces using the internal boot loader, see app. note AN2606 "STM32 microcontroller system memory boot mode". You need BOOT0 pin to switch between flashing (update) and run mode. The reference manual RM0490 Rev 3 says: "The boot mode configuration is latched on the 4th rising edge of SYSCLK after a reset". So, the pin is only sampled at the very beginning.

Finally, your code may programmatically jump to the on-chip boot loader at any time without BOOT0 pin, based on some condition that you evaluate in your code.



PS: people regularily lock-out themselves with such low pincount devices, search the forum (if old post survived).

The application I'm making is so easy, I hardly need any debugging, I literally just need it to shift data over both USART interafecs back and forth, technically unchanged, etc.

But I *am* a little worried about locking myself out of the chip, hence me asking about it, too.

I can reset the chip by power-cycling, that isn't a problem. What is more of a problem, is that obviously I'd want to upload a firmware a bunch of times on the same chip. However, when (under normal operation) `BOOT0`, `SWCLK`, `SWDIO`, and `¬RST` are reassigned to other functions, I was worried I won't be able to ever access the chip again, even if I just want to flash a new firmware, etc.

I'd like to use a low-pin count chip like this, both because the package is easy to hand solder, and because I kinda want the lowest possible price for this application.

BOOT0 pin can be spared by programming the nBOOT option bits. Same with NRST if power on reset is permissible. If SWDIO and SWCLK are used, the only remaining conflict is PA13 SWDIO vs. USART2_RX. This could be handled with a jumper/switch/solder bridge and some initial delay.

Alternatively, map PA9 and PA10 for USART1 if you can access those for programming via the internal boot loader. This leaves you PC15 for BOOT0 and you can switch between modes with a jumper...



one more idea: As the SO8N package is a multi-bonded variant of the larger packages, you may start developing and testing with a larger package like with a STM32C0116-DK and do the multi-bonding/unbonding with external wires 🙂