cancel
Showing results for 
Search instead for 
Did you mean: 

UART Bootloader connection via API

JimNastic
Associate

Hi everyone,

this is my first post, as I have always been able to solve my problems thanks to your help. Unfortunately, I can't find a solution regarding the CubeProgrammer API, which I am currently working on.

 

I am developing an update tool that will use the internal bootloader of a STM32H743. For this, I am developing a C++ programm, using Visual Studio 2026 Version 18.2.0 with .Net Framework Version: 4.8.09221. CubeProgrammer_API.h and all neccessary .dll files are included as described in the documentation. There are no compiler errors or warnings.

 

I used the attached UART example for testing but it is not possible to connect to my device. COM ports are detected by getUsartList function as expected. If I try to connect with function connectUsartBootloader as shown in the example I will get error -5 ( CUBEPROGRAMMER_ERROR_NOT_SUPPORTED ). Nevertheless, it is possible to establish a connection and execute a file upload with STMCubeProgrammer GUI and also with STMCubeProgrammer CLI via a serial port. 

 

I checked already communication with a logic analyzer. Everything looks good, commands and responses are the same (STMCubeProgrammer GUI and custom tool) as shown in picutre below . Commands from custom tool are marked in red and device response is marked in orange. 

 

JimNastic_0-1768555615158.png

After this communication sequence connectUsartBootloader function is aborted and error -5 occurs. No clue why this happens. It looks like the API does not support used MCU. Anyway it works with GUI and CLI so it also should work with the used API. 

 

Does anyone have an idea how to solve this problem?

 

1 REPLY 1
Amine_Jridi
ST Employee

Hello @JimNastic ,

 

I have tested the UART API example and it works correctly on my side.

For further investigation, I suggest setting the verbosity to level two (CUBEPROGRAMMER_VER_LEVEL_TWO) to get more information about the root cause.

If, after doing this, you get a database error, this is because the use of the DB folder is mandatory for the API, and its path cannot be changed from the STM32CubeProgrammer directory.

 

Thanks,

Amine.


In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.