cancel
Showing results for 
Search instead for 
Did you mean: 

Failure of AUTOMATIC mode of CubeProgrammer to RE-program parts CURRENTLY IN rdp=0xBB state.

DJens
Associate II

I have many thousand devices which need to be reprogrammed which are already have RDP set to 0xBB.  The Automatic Programming Mode works wonderfully well for devices which are at RDP=0xAA but the programmer fails when reprograming 0xBB parts in an automatic way.

(Please do not confuse my question with setting RDP AFTER programming.  My problem is re-programming parts already in a state of RDP=0xBB.)

The non-automatic mode works as expected by first setting the option bytes (which triggers the internal chip erase) and secondly to reprogram, but this is not a useful solution for the number of parts needing to be reflashed.

In automatic mode the tools expected operation is to set any non-RDP=0xAA value to 0xAA, wait for the internal chip erase to occur and then download the data to the device.  This step appears to be missing from the gui code.

Pasted below are the annotated log files for both failed automatic attempts and successful manual attempts.

I am using STM32CubeProgrammer Version 2.20.0.  My target part is the STM32U0F8P6 and my connection type is jtag through the STLinkV2.

Please suggest workarounds to help me - with about 4000 boards to deal with, saving seconds matters.

Doug

Note:  If you suggest using the CLI as a workaround, please provide a brief example script which would emulate the automatic mode of the gui (automatic retries when not connected, automatic programming when connected, obvious indications of success/failure for each programmed device, etc.)

Automatic programming operation (note 'failure to erase' errors):

Begin state: attach probe, click gui 'Connect' button:
14:03:31 : UR connection mode is defined with the HWrst reset mode
14:03:31 : UR connection mode is defined with the HWrst reset mode
14:03:31 : ST-LINK SN : 52FF75064980515726220487
14:03:31 : ST-LINK FW : V2J46S7
14:03:31 : Board : --
14:03:31 : Voltage : 3.19V
14:03:31 : SWD freq : 4000 KHz
14:03:31 : Connect mode: Normal
14:03:31 : Reset mode : Hardware reset
14:03:31 : Device ID : 0x459
14:03:31 : Revision ID : Rev A
14:03:31 : Debug in Low Power mode is not supported for this device.
14:03:31 : UPLOADING OPTION BYTES DATA ...
14:03:31 : Bank : 0x00
14:03:31 : Address : 0x40022020
14:03:31 : Size : 100 Bytes
14:03:31 : UPLOADING ...
14:03:31 : Size : 1024 Bytes
14:03:31 : Address : 0x8000000
14:03:31 : Read progress:
14:03:31 : Error: Data read failed
(Data read failure is expected as part is in RDP=0xBB state)

Now click gui 'Start automatic mode' button:
14:03:47 : Starting Automatic Mode...
14:03:47 : Waiting for device n:1...
14:03:47 : MASS ERASE ...
14:03:47 : Mass erase operation failed.Please verify flash protection
14:03:47 : Opening and parsing file: TranslatorRev104TargetCPU.hex
14:03:47 : Memory Programming ...
14:03:47 : File : TranslatorRev104TargetCPU.hex
14:03:47 : Size : 33.48 KB
14:03:47 : Address : 0x08000000
14:03:47 : Erasing memory corresponding to segment 0:
14:03:47 : Erasing internal memory sectors [0 16]
14:03:47 : failed to erase memory
14:03:47 : failed to erase memory
14:03:47 : Please disconnect device n:1 and connect the next...
Disconnect jtag probe

Reconnect jtag probe
14:04:10 : Waiting for device n:2...
14:04:12 : MASS ERASE ...
14:04:12 : Mass erase operation failed.Please verify flash protection
14:04:12 : Opening and parsing file: TranslatorRev104TargetCPU.hex
14:04:12 : Memory Programming ...
14:04:12 : File : TranslatorRev104TargetCPU.hex
14:04:12 : Size : 33.48 KB
14:04:12 : Address : 0x08000000
14:04:12 : Erasing memory corresponding to segment 0:
14:04:12 : Erasing internal memory sectors [0 16]
14:04:12 : failed to erase memory
14:04:12 : failed to erase memory
14:04:12 : Please disconnect device n:2 and connect the next...

---------------------------------------------------

Manual programming operation (manually setting RDP=0xAA, then programming):

Begin state: jtag probe disconnected

Connect jtag probe, click on gui 'Connect' button:
13:47:39 : UR connection mode is defined with the HWrst reset mode
13:47:39 : UR connection mode is defined with the HWrst reset mode
13:47:39 : ST-LINK SN : 52FF75064980515726220487
13:47:39 : ST-LINK FW : V2J46S7
13:47:39 : Board : --
13:47:39 : Voltage : 3.19V
13:47:39 : SWD freq : 4000 KHz
13:47:39 : Connect mode: Normal
13:47:39 : Reset mode : Hardware reset
13:47:39 : Device ID : 0x459
13:47:39 : Revision ID : Rev A
13:47:39 : Debug in Low Power mode is not supported for this device.
13:47:39 : UPLOADING OPTION BYTES DATA ...
13:47:39 : Bank : 0x00
13:47:39 : Address : 0x40022020
13:47:39 : Size : 100 Bytes
13:47:39 : UPLOADING ...
13:47:39 : Size : 1024 Bytes
13:47:39 : Address : 0x8000000
13:47:39 : Read progress:
13:47:39 : Error: Data read failed
(Data read failure is expected as part is in RDP=0xBB state)

Click on gui 'OB' window. Window accurately indicates RDP=0xBB.)
Pull down gui 'RDP Value' to select 'AA'
Click on gui 'Apply':
13:47:48 : Option byte command : -ob RDP=170
13:47:48 : qCmd : -ob RDP=170
13:47:48 : PROGRAMMING OPTION BYTES AREA ...
13:47:48 : Bank : 0x00
13:47:48 : Address : 0x40022020
13:47:48 : Size : 100 Bytes
13:47:49 : Reconnecting...
13:47:50 : Reconnected !
13:47:50 : UPLOADING OPTION BYTES DATA ...
13:47:50 : Bank : 0x00
13:47:50 : Address : 0x40022020
13:47:50 : Size : 100 Bytes
13:47:50 : OPTION BYTE PROGRAMMING VERIFICATION:
13:47:50 : Option Bytes successfully programmed
13:47:50 : Time elapsed during option Bytes configuration: 00:00:02.167

Click on gui 'Start Programming' button:
13:47:58 : Opening and parsing file: TranslatorRev104TargetCPU.hex
13:47:58 : Memory Programming ...
13:47:58 : File : TranslatorRev104TargetCPU.hex
13:47:58 : Size : 33.48 KB
13:47:58 : Address : 0x08000000
13:47:58 : Erasing memory corresponding to segment 0:
13:47:58 : Erasing internal memory sectors [0 16]
13:47:59 : Download in Progress:
13:47:59 : File download complete
13:47:59 : Time elapsed during download operation: 00:00:01.222
13:47:59 : Verifying...
13:47:59 : Read progress:
13:48:00 : Time elapsed during verifying operation: 00:00:00.223
13:48:00 : Download verified successfully
13:48:00 : RUNNING Program ...
13:48:00 : Address: : 0x08000000
13:48:00 : Application is running, Please Hold on...
13:48:00 : Start operation achieved successfully
13:48:01 : Error: Unable to get core ID  (these core ID errors are harmless and I am not worried about these.)
13:48:01 : Error: Unable to get core ID
13:48:01 : Error: Unable to get core ID
13:48:01 : Warning: Connection to device 0x459 is lost
13:48:01 : Disconnected from device.

---------------------------------------------------

0 REPLIES 0