In this blog, I will be programming the STM32F103C8T6 using STM32F446RE which has an onboard ST-LINK- V2
Components:
Hardware Part:
The STM32F103C8T6 is commonly known as BluePill, doesn't has a debugger or programmer in it.
We need to use a commonly available debugger like ST-LINK V2 or Serial Programmer
But in this case, I used STM32F446RE's onboard ST-LINK V2
Before Starting the process we need to remove the Jumpers from STM32F446RE and ST-LINK V2 from CN2 as shown below
5. Now we will be using CN4 for programming the BluePill via CN4 connector.
6. The PINOUT of the CN4 is given below
7. We don't need PIN 5 and PIN 6 as BluePill lacks those, we can use the first 4 PINs to program the BluePill.
8. We need to change the boot option to BOOT1 from BOOT 0 as
BOOT 0 - Operating Mode
BOOT 1 - Programming Mode
Software Part:
After connecting the ST-LINK part of STM32F446RE with BluePill now, connect to the computer where Keil uVision v5 is installed.
The register level code for blinking the code is here
After creating a project for STM32F103C8T6 and build the code
Select the "Options for Target" option as shown below
5. Select the Debug tab and choose the ST-LINK Debugger from the drop-down box
6. A pop-up box appears as shown below after selecting the "Settings" button near ST-LINK Debugger, select Port as SW and you can see the SW Device section
7. If there is no target then this tab appears as below
8. If the circuit connection is wrong then it appears as below,
9. After successfully loading the code to the board, change the boot option from programming to the operation mode
10. Press the reset button to view the code running in the device.
That's it for now..
Comments