cancel
Showing results for 
Search instead for 
Did you mean: 

STM32_Programmer_CLI not working over USB under Ubuntu

TonyThi
Associate II

Updating the flash software of a STM32F070CB microcontroller did not work:

The STM32 is in BOOTLOADER mode and accessed from a Linux/Ubuntu PC using USB.

STM32_Programmer_CLI (V2.20.0) does not work if the STM32 is connected directly to the USB port of the Linux-PC, but it does work if a simple USB2-hub is inserted between the PC's USB port and the STM32 USB port.

In the non-working case the STM32_Programmer_CLI outputs this:


-------------------------------------------------------------------
STM32CubeProgrammer v2.20.0
-------------------------------------------------------------------

 

USB speed : Full Speed (12MBit/s)
Manuf. ID : STMicroelectronics
Product ID : STM32 BOOTLOADER
SN : FFFFFFFEFFFF
DFU protocol: 1.1
Board : --
Device ID : unknown
Warning: Device is under Read Out Protection or Target is held under reset
Error: a read Operation failed, please check if any memory protection mechanism is active.

 

This is not a udev problem, the problem persists even if STM32_Programmer_CLI is executed with root rights.

Using STM32_Programmer_CLI always works under Windows, even if the STM32 is directly connected to a USB port of the Windows PC.

Is there a way to get the STM32_Programmer_CLI to work under Linux/Ubuntu without the USB-hub?

 

4 REPLIES 4
Amine_Jridi
ST Employee

Hello @TonyThi,

This is a known limitation where some high-speed USB controllers cause timing mismatches with the USB bootloader.

For more details about the root cause and workarounds, you can refer to the AN2606 (Table 31).

 

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.
Hello Amine,

Thank you very much for your response.
I see the following comment for the STM32F070xB controller:

USB bootloader fails on some machines using a high speed controller. The
bootloader is detected. but then data transaction fails.
Root causes:
De-synchronization between USB controller and bootloader SW due to the
controller high speed transactions. Controller high speed
inter-packet delay
seems not sufficient for the bootloader SW (based on interrupt
routines) to
serve all needed transactions (the delay needed by the BL is nearly
25 μs).
Some servicing IT are missed. This results in a communication fail,
causing
Write command to fail.
Workarounds:
Add USB HUB between host and the MCU. This relaxes transactions inter-
packet delay, and allows the BL SW to perform correctly the task.
Use USB
controller/host that increase inter-packet delay.
On new designs, use DFU SW that fix the issue in user flash memory.

How can I "use DFU SW that fix the issue in user flash memory"?
Is this SW for the STM32 controller?
I am writing code for this STM32 controller using the "STM32CubeIDE
1.18.0": Is there an option available to use sw which fixes the USB problem?

Thanks,

Tony

Hi @TonyThi 

This is meant to develop your own custom bootloader.

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.


TonyThi
Associate II

Is such a custom bootloader available from STM?

Or has anyone else written one?

Is there documentation available on how I could write a custom bootloader?

Thanks,

Tony