STM32 is a family of 32-bit microcontroller integrated circuits by STMicroelectronics. The STM32 chips are grouped into related series that are based around the same 32-bit ARM processor core, such as the Cortex-M33F, Cortex-M7F, Cortex-M4F, Cortex-M3, Cortex-M0+, or Cortex-M0. Internally, each microcontroller consists of the processor core, static RAM, flash memory, debugging interface, and various peripherals.
STM32 F1
The STM32 F1-series was the first group of STM32 microcontrollers based on the ARM Cortex-M3 core and considered their mainstream ARM microcontrollers. The F1-series has evolved over time by increasing CPU speed, size of internal memory, variety of peripherals. There are five F1 lines: Connectivity (STM32F105/107), Performance (STM32F103), USB Access (STM32F102), Access (STM32F101), Value (STM32F100).
STMicroelectronics introduced a tool called STM32Cube MX,
which generates basic code according to the peripherals and STM32 board. So we don’t need to worry about coding for basic
drivers and peripherals. Further this generated code can be used in Keil
uVision for editing according to requirement. And finally the code can
burned into STM32 using ST-Link V2 programmer as Well as FTDI TTL Convertor.
In this tutorial we will learn How to Program STM32F103C8 using STM32CubeMX and Keil uVision by doing a simple project of Inbuilt LED Blinking with STM32F103C8 Blue Pill board. We will generate the code using STM32CubeMX then edit & upload the code to STM32F103C8 using Keil uVision. Before getting into detail, we will first learn about how to install the Software (both Keil uVision and STM32CubeMX), configure the software as per our requirements.
Let's Get Started,
Software:
STM32CubeMX Code Generation Tool (link), "You have the option here to select the version of software to download, i recommend you to download "STM32CubeMX 4.27.0" as i am using the same for this tutorial."
Keil uVision V5 (link)
Drivers for ST-Link V2 (link)
Circuit Diagram and Connections
Connection between ST-LINK V2 & STM32F103C8
Connection between FTDI TTL Convertor & STM32F103C8
Pin diagram of stm32f103c8
Configure and Generate code using STM32CubeMX
- Click to MCU Selector.
- Search part number of STM32 microcontroller in this tutorial we are using stm32f103c8.
- From drop down of MCUs list >> select the searched microcontroller from drop down list.
- Click on Start Project
- Click on Pinout to configure the stm32
- Expand SYS using "+" >> select Serial Wire in Debug drop down
As we want to do LED Blinking with STM32F103C8, we need to set the GPIO pin as OUTPUT for LED. In this tutorial, we are working on Inbuilt LED blinking. so as per the datasheet, the inbuilt led of stm32F103C8 is internally connected with PC-13 >> Click on PC-13 pin of STM32 and set it as "GPIO_OUTPUT"
- Now generate code by click on generate code icon >> after click the pop-up window will open
- In pop-up window click on Project
- Give the project name
- Provide project folder location
- Select the "MDK-ARM V5" IDE from drop down list. It is nothing but the Keil uVision V5 IDE
- Now click on Code Generator
- Select "Copy only the necessary library files". This will generate the code with only necessary library
- Click on OK, finally code is generated.
- After finish editing the code, click the Options for Target icon
- Options for Target pop-up window will open, in that window click on Debug
- Under the Debug tab select ST-LINK Debugger
- Then click on settings
Too Much Learning...
ReplyDeleteThanks SK.
You are most welcome महेश मोरे पाटील☺️
ReplyDeletevery useful content sir ..
ReplyDeleteThank you
👍
ReplyDeleteWorth Reading👍
ReplyDeleteKeep going!!!
i have recently started learning micro controller and this helped me a lot..!
ReplyDelete