Method of transferring STM32 program


More and more applications are developed using ST MCUs, and ST continues to innovate for different MCUs within the same category. As a result, problems arise with program portability for MCUs in the same series. If it is a newly created program block, it is relatively easy to move, but how do you operate when porting an entire module with unchanged functionality? Here, we provide one method as a reference for converting within the same category (L412KB to L432KCU6).

Porting on the same series MCU

Due to customer requirements, there is a need to transfer the project directly to a different MCU. Here, we provide 2 methods for porting. Initially, it was found that CubeIDE was locked and cannot be directly modified

Since both are from the L4 series but are different MCU models, the following steps were taken.

Up to this point, the stm32l412xx.h file has been replaced with stm32l432xx.h and built, and the resulting bin file is burned into the STM32L432 for testing. However, the following error information may occur: The read MCU version does not match the expected version, and then the MCU encounters an error while obtaining ACK from the backend via SPI.
WARNING: MCU version mismatch (expected:00.02.06, got:D01.00.00)
ERROR: received wrong ACK type (0xFF)
ERROR: failed to read REQ_MULTIPLE_SPI ack
ERROR: failed to start the gateway

Here, we refer to the open source software ‘Semtech code for STM32L412’ =>

First, test to generate the original STM32L12K8U6 and burn it to see if the MCU_VERSION is D01.00.00 and whether it will return ACK
Is the functional L412K8U6 changed to RELEASE MODE and whether the root@IG502L:/# chip_id -u -d /dev/ttyACM0 LOG is normal and can be used as a reference?


Porting to a different series MCU for use with IoT cloud services.

Here, we refer to the network for porting from F103 to L496 and follow the following steps:

  1. Create the STM32CubeMX project file(這邊先生成要移植的MCU專案)
  2. Import the Gizwits configuration template
  3. Special processing (only for the STM32 L series low-power platforms, skip this step for other platforms)
  4. Generate code
  5. Compile and configure the project
  6. Port code
  7. Modify the code

Here, some steps are specifically highlighted for explanation. For example, in the second step, CubeMX can import the parameters of the original different MCU. The configuration parameters of the STM32F103 platform are imported into the STM32L496ZGT6 platform, and then the internal settings are adjusted for different special functions.

Next, we will use the third-party software Gizwits IoT Cloud to port the generated files to the new project
you need to port the relevant protocol source code (i.e. the three directories in the automatically generated STM32F103 project mentioned above: Gizwits, Hal, Utils).

Next, in step 6, we need to modify some reference files, for example, replace “#include “stm32f1xx_hal.h”” with “#include “stm32l4xx_it.h”” for the L496ZGT platform.

Leave a Comment

Your email address will not be published. Required fields are marked *

Shopping Cart