STM32F4 Discovery as St-Link Programmer [Full Steps]

 Programming Bluepill via Stm32f4-discovery

    If you have that handsome guy : bluepill and do not have stlink programmer, also you have a discovery board, "What a low probability for this article to be read." -but ok, I am the one, faced with this situation maybe some other one also can be. 😁

Step1 : Removing St-Link Jumpers

St-link jumpers on Discovery Board

    There are two jumpers on area labelled CN4, (marked in purple square) if they are jumped like on the picture, this means embedded st-link programmer can program discovery board, if you remove them, st-link programmer connection to discovery MCU is removed and free to use externally.

Step2 : Connecting St-Link Pins to BluePill

stm32 discovery swd pins

There are six pins on the area called CN4, marked in the picture. The pin numbers starting 1 from top and go down to 6. We just use 1 to 4 pins. If you want to reset your bluepill via button on the discovery board you can connect NRST to Reset pin of Bluepill. Anyway, the pins of bluepill :

bluepill SWD pins
  • BluePill GND to Discovery GND (pin3)
  • BluePill SwClk to Discovery SWCLK (pin2)
  • Bluepill SWIO to Discovery SWDIO(pin4)
  • Bluepill 3V3 to Discovery VDD_TARGET(pin1)
  • to power up bluepill, you have two choices; first :you can use microusb port - I don't recommend, there are limited usb ports on the computers and you need to use more usb cables, second one a connection between Discovery 5v to any 5v pin of BluePill.
    Now you can program your bluepill over discovery board by connecting it to your computer via usb cable.


Using St-Link Serial Port

    You can also want to have serial connection between bluepill and your computer,

using serial port embedded stlink on discovery board externally

There are two pins under SWD port Tx, Rx, these are usb-to-ttl converted pins to use with microcontrollers. Connect this Tx pin to Bluepinn Rx pin you set to use as an u(s)art, and Rx pin to Tx pin on BluePill. You should also remove SB11 and SB15 resistors to cut communication of MCU of discovery, then you can communicate with your computer over serial port in this way.

Comments

Popular posts from this blog

How does P10 Led Panel Work? | Working Principle and calculations

How to Drive DHT sensor without Library