cancel
Showing results for 
Search instead for 
Did you mean: 

How to switch from one STM32 to another using STM32CubeMX

ST AME Support NF
ST Employee

How to switch from one STM32 to another using STM32CubeMX

1. Introduction

It is very common to need to port an existing embedded design from one STM32 microcontroller part number to another when application requirements change (for example, Flash, SRAM, GPIO, or peripherals). This is something that can be done easily using the STM32CubeMX tool. In this article we will see how we can switch from one STM32 to another using STM32CubeMX.
 

2. Prerequisite

  • Software: STM32CubeMX


3. Theory

The STM32CubeMX tool permits opening a project from another STM32 part number in the same family. For example, you can open a project created for an STM32F407 with an STM32F429 part number. This allows for easy migration from one part number to another within the same STM32 family. To do this, we will first create a project (ioc file) for an STM32F407 and then open it with STM32CubeMX to do the conversion. As you will see the steps are easy to follow making the switch an easy task for engineers. Let’s look at how to do the switch using our STM32CubeMX.
 

4. Steps

First, create a Project for a STM32F407VGTx
  1. Open STM32CubeMX

  2. Build the Configuration for the STM32F407:

1873.png
Now let’s create our project by adding some peripherals and associated configuration.
For example, add 2 ADC channels:
1874.png
We will also add a Timer PWM output channel:
1875.png
Let’s also add I2C communication:
1876.png
Add a few GPIOs:
One GPIO output: PD4
1877.png
One GPIO input: PD15
1878.png
One EXTI (external interrupt) on PA7:
1879.png
Let’s save this example configuration and name it STM32F407_Project_V1.
1880.png
Now we will load a project configuration on an STM32 of the same series.
  1. Switch to another STM32

We will create a New Project: File -> New project
1881.png
Now we will select an STM32 belonging to the same Series (STM32F4). As an example, you can select the STM32F429ZITx.
1882.png
Now we will import our previous Project: Project - > Import
1883.png
Browse the project we previously created for the STM32F407:
1884.png
A window like this will be displayed:
1885.png
A message indicates that the MCU (STM32F407VGTx) found in the Project being imported is not the same as the MCU (STM32F429ZITx) currently edited. First, we will click on Try Import button and see the status of the import operation.
1886.png
The tool returns that the importing project is completed.
1887.png
Now click on OK to import the project.
1888.png
You will see some pop-up windows indicating if the Project has been successfully imported and that is the case in our example:
1889.png
We have now completed the import of the configuration for the STM32F407 to the STM32F429:
1890.png
 

5. Links


STM32CubeMX - STM32Cube initialization code generator - STMicroelectronics
Comments
Tajwar.Chandel
Associate III

Hi,

I am also working on the STM32H743ZI2 board. Can you please help to provide the IOC file of ethernet default code for the same.

This will very beneficial to us to move ahead.

Regards,

Tajwar

Version history
Last update:
‎2021-11-30 01:34 AM
Updated by: