This is a continuation of my former post NUCLEO-L031K6 and ST-LINK SWD. What on earth did I do? in which I tried to flash a standalone STM32L031 and found some serious obstacles. Now, I have solved all issues that I found and I have been able to flash the darned MCU. The idea was to use the ST-LINK in a discovery kit with STM32L476VG MCU connected to the STM32L031 with only two pins, SWDIO and SWDCLK in the connector CN4 of the kit. The wiring is straightforward when every is tied and connected correctly. And I am stressing this because you have to be sure that you have connected all pins that have to be connected. In concrete, pin 5 in the STM32L031 labeled as VDDA, the reference for the analogue inputs, is NOT internally tied to VDD in pins (1 and 17) so it HAS to be connected to power the MCU otherwise it would be pretty dead. With this in mind, you only have to follow the next figures to connect the ST-LINK pins to the STM32L031. First, the power supply at 3.3 V and ground which are taken from the Discovery kit.
Then the connections from CN4 to the MCU. Notice that I decided not to use the Vapp nor the SWO pins since they are not strictly necessary to flash a program. However, it is mandatory to connect the ground pin of the ST-Link port even when it is internally connected to the STM32L476 GND pins in the Discovery board.
Finally, the pins I used in the STM32L031 (LQFP32) were:
Continue reading Flashing an off-the-shelf STM32L031 with ST-LINK