Skip to main content
Associate
July 24, 2025
Solved

STM32CubeProgrammer API - Canceling current operation or disable reconnection attempt

  • July 24, 2025
  • 2 replies
  • 2840 views

Hi,

I am using the STM32CubeProgrammer API (v2.20.0) on Windows 11 using the Visual Studio UART example as a base. Everything works fine, however this issue is slowing down the programming workflow.

After programming the MCU option bytes to RDP1 (or Closed state on some newer devices), there is a long delay (20 to 30 seconds) during the attempts to reconnect to the device. I already expect that the reconnection attempt will fail, so is there a way to reduce the time or number of reconnection attempts? Or a way to cancel the current operation? The time taken for failed reconnection attempts is 2x longer than the actual programming of the MCU.

I noticed that there is a getCancelPointer() function in the API, but I have found no documentation or examples on how to use it. Is it possible to use this or is there some other way?
Edit: Added info - using UART to program the device

/**
 * \brief This routine allows to drop the current read/write operation.
 * \return 0 if there is no call for stop operation, otherwise 1.
 */
volatile int* getCancelPointer();

fma_1-1753345297625.png

 

 

Best answer by Aziz BRIGUI

Hello @fma,

Issue is fixed in the latest STM32CubeProgrammer release available here.

Aziz

2 replies

fmaAuthor
Associate
July 25, 2025

To add more information, this will be used in a production environment with 3000 to 5000 MCUs programmed every month. That's why the 30 second delay matters.

Aziz BRIGUI
Technical Moderator
August 26, 2025

Hello @fma,

You can use the new no reconnect option available in CubeProgrammer v2.20. Example:

sendOptionBytesCmd((char*)"-ob RDP=0xBB noreconnect");

Hope this helps,

Aziz

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.
fmaAuthor
Associate
August 28, 2025

I have tried this on my STM32H5 and there is no error, but it still attempts to reconnect

fma_0-1756373108664.png

 

Aziz BRIGUI
Aziz BRIGUIBest answer
Technical Moderator
February 25, 2026

Hello @fma,

Issue is fixed in the latest STM32CubeProgrammer release available here.

Aziz

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.