How to create a project in stm32CubeMX for Keil uvision Ide

This tutorial will show how to open a new project from stm32 CubeMX software for ARM Keil uvision IDE. stm32CubeMX is a graphical tool used to configure the STM32 microcontroller. Keil uvision ide is used to develop software for ARM Cortex-MX based microcontrollers.

Our other STM32 Microcontroller related tutorials are:

Component List for the Project

Component NameQuantityPurchase Link
STM32 Nucleo Dev. Board1Amazon
Breadboard1Amazon
Jumper Wire Pack1Amazon

Affiliate Disclosure: When you click on links to make a purchase, this can result in this website earning a commission. Affiliate programs and affiliations include, but are not limited to Amazon.com

Download Links: 

There are a few steps that need to follow to create a new project in stm32CubeMX for Keil ide:

Step 1: Create a new project on stm32CubeMX

1
Create a new project in stm32CubeMX

Step 2: Search your desired MCU and Select it from CubeMX. In this project, I select a stm32f446re microcontroller for demonstration purposes

2
Select Microcontroller from CubeMX

Step 3: Go to System Core > RCC and select clock source from High-Speed Clock (HSE) option. I am using an 8 MHz external crystal oscillator. So, I have selected the Crystal/Ceramic Resonator option

3
Configure RCC

Step 4: Go to System Core > Sys and select Serial Wire

4
Select Serial Wire from Sys

Step 5: Go to the Clock Configuration tab and select your desired clock source and speed. I have used PLL (Phase-locked loop) with an 8 MHz external oscillator and derived a 180 MHz clock speed

5
Stn32 Clock Configuration Settings

Step 6: Configure your desired peripherals like I2C, SPI, UART, or ADC. I configure the I2C peripheral.

6
Configure I2C

Step 7: Now go to the Project Manager tab and write your project name, then change the toolchain/ide to MDK-ARM and also select the latest version.

7
CubeMX project manager

Step 8: Click to Generate Code tab and open the project in keil uvision ide.

8
Upload project from CubeMX to Keil Ide

Step 9: Try to build the project in Keil ide. You may have seen the project is not made and show some warning in the Build Output tab.

10
Keil uvision ide ARM Compiler error

Step 10: For solving this issue go to Project > Options for target “Project Name” and select the latest ARM Compiler

11
Select latest ARM Compiler

Step 11: After that just build the project again and Run it to your STM32 Microcontroller

12
Build and Run the code

This is all for this tutorial.

Mahamudul Hasan

I hold a B.Sc degree in Electrical & Electronic Engineering from Daffodil International University, Bangladesh. I am a Printed Circuit Board (PCB) designer and Microcontroller programmer with an avid interest in Embedded System Design and IoT. As an Engineer, I love taking challenges and love being part of the solution. My Linkedin Profile Link: https://linkedin.com/in/mheee

Recent Posts