cancel
Showing results for 
Search instead for 
Did you mean: 

Getting different results for memory reads over STM Programmer GUI vs CLI

CFern.2
Associate

I am working on a project using the STM32WB55xx series. I'm trying to read the Device Information Table (AN5185 Section 6.6.1, pg 17) using a bash script and the STM32 Programmer CLI.

According to the documentation (AN5185 Section 1.2 page 3) I should be reading the IPCCDBA option byte to get the device info table address at the start of SRAM2a. The IPCCDBA value is 0x0, so the device info table address should be located at address 0x20030000. If I try to use the CLI to read at address 0x20030000, I get all zeroes in response.

If I read the same address using the STM32 Programmer GUI, at first I get the same thing:

0693W000008GUVXQA4.pngHowever, if I switch to the CPU tab in the GUI and hit 'Run' first, I can check address 0x20030000 and I find a value of 20030890:

0693W000008GUVhQAO.png 

Then, I can read address 0x20030890, and I find the device info table, including the 'table valid' bytes 0xA94656B9:

0693W000008GUVrQAO.png 

Success! It seems that hitting the Run button makes all the difference for the GUI.

So now going back to the CLI, it appears that the analogous command for the Run button in the GUI is the '-run' flag in the CLI. Yet, even when I add in the '-run' flag to my command, I still do not get the 0x20030890 address showing up at 0x20030000. Only zeroes.

I suspect that there may be some syntax error or option I'm missing from my CLI command structure. What do I need to do to get the CLI to return the same data as the GUI?

Script body:

application_path="/c/Program Files/STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin/STM32_Programmer_CLI.exe"
 
"$application_path" -c port=SWD -r32 0x20030000 42
# ^^This reads all zeroes...
read -p "Press enter to continue"
 
"$application_path" -c port=SWD -run -r32 0x20030000 42
# ^^This still reads all zeroes...
read -p "Press enter to continue"

Script output:

$ "$application_path" -c port=SWD -run -r32 0x20030000 42
  -------------------------------------------------------------------
                   STM32CubeProgrammer v2.5.0
  -------------------------------------------------------------------
 
ST-LINK SN  : 066FFF36...(redacted)
ST-LINK FW  : V2J37M26
Board       : P-NUCLEO-WB55
Voltage     : 3.24V
SWD freq    : 4000 KHz
Connect mode: Normal
Reset mode  : Software reset
Device ID   : 0x495
Revision ID : Rev Y
Device name : STM32WBxx
Flash size  : 1 MBytes
Device type : MCU
Device CPU  : Cortex-M0+/M4
 
Core run
 
Reading 32-bit memory content
  Size          : 44 Bytes
  Address:      : 0x20030000
 
0x20030000 : 00000000 00000000 00000000 00000000
0x20030010 : 00000000 00000000 00000000 00000000
0x20030020 : 00000000 00000000 00000000

1 ACCEPTED SOLUTION

Accepted Solutions
Houda GHABRI
ST Employee

Hi @CFern.2​ 

I tried what you suggested and It's working as expected :

C:\Program Files\STMicroelectronics\STM32Cube\STM32CubeProgrammer-2-5-0\bin>STM32_Programmer_CLI.exe -c port=swd -r32 0x20030000 44
      -------------------------------------------------------------------
                       STM32CubeProgrammer v2.5.0
      -------------------------------------------------------------------
 
ST-LINK SN  : 0669FF333536414257131541
ST-LINK FW  : V2J28M18
Board       : STM32WB5MG-DK
Voltage     : 3.27V
SWD freq    : 4000 KHz
Connect mode: Normal
Reset mode  : Software reset
Device ID   : 0x495
Revision ID : Rev Y
Device name : STM32WBxx
Flash size  : 1 MBytes
Device type : MCU
Device CPU  : Cortex-M0+/M4
 
 
Reading 32-bit memory content
  Size          : 44 Bytes
  Address:      : 0x20030000
 
0x20030000 : 00000000 00000000 00000000 00000000
0x20030010 : 00000000 00000000 00000000 00000000
0x20030020 : 00000000 00000000 00000000
C:\Program Files\STMicroelectronics\STM32Cube\STM32CubeProgrammer-2-5-0\bin>STM32_Programmer_CLI.exe -c port=swd -run -r32 0x20030000 42
      -------------------------------------------------------------------
                       STM32CubeProgrammer v2.5.0
      -------------------------------------------------------------------
 
ST-LINK SN  : 0669FF333536414257131541
ST-LINK FW  : V2J28M18
Board       : STM32WB5MG-DK
Voltage     : 3.27V
SWD freq    : 4000 KHz
Connect mode: Normal
Reset mode  : Software reset
Device ID   : 0x495
Revision ID : Rev Y
Device name : STM32WBxx
Flash size  : 1 MBytes
Device type : MCU
Device CPU  : Cortex-M0+/M4
 
Core run
 
Reading 32-bit memory content
  Size          : 44 Bytes
  Address:      : 0x20030000
 
0x20030000 : 20030024 00000000 00000000 2003005C
0x20030010 : 2003017C 00000000 00000000 00000000
0x20030020 : 00000000 00000000 01010000

The only difference compared to you is that I'm typing the commands directly in the cmd command line (not a batch script), can you please try that and tell me if it is OK?

The command used : C:\Program Files\STMicroelectronics\STM32Cube\STM32CubeProgrammer-2-5-0\bin>STM32_Programmer_CLI.exe -c port=swd -run -r32 0x20030000 42

Houda

View solution in original post

2 REPLIES 2
Houda GHABRI
ST Employee

Hi @CFern.2​ 

I tried what you suggested and It's working as expected :

C:\Program Files\STMicroelectronics\STM32Cube\STM32CubeProgrammer-2-5-0\bin>STM32_Programmer_CLI.exe -c port=swd -r32 0x20030000 44
      -------------------------------------------------------------------
                       STM32CubeProgrammer v2.5.0
      -------------------------------------------------------------------
 
ST-LINK SN  : 0669FF333536414257131541
ST-LINK FW  : V2J28M18
Board       : STM32WB5MG-DK
Voltage     : 3.27V
SWD freq    : 4000 KHz
Connect mode: Normal
Reset mode  : Software reset
Device ID   : 0x495
Revision ID : Rev Y
Device name : STM32WBxx
Flash size  : 1 MBytes
Device type : MCU
Device CPU  : Cortex-M0+/M4
 
 
Reading 32-bit memory content
  Size          : 44 Bytes
  Address:      : 0x20030000
 
0x20030000 : 00000000 00000000 00000000 00000000
0x20030010 : 00000000 00000000 00000000 00000000
0x20030020 : 00000000 00000000 00000000
C:\Program Files\STMicroelectronics\STM32Cube\STM32CubeProgrammer-2-5-0\bin>STM32_Programmer_CLI.exe -c port=swd -run -r32 0x20030000 42
      -------------------------------------------------------------------
                       STM32CubeProgrammer v2.5.0
      -------------------------------------------------------------------
 
ST-LINK SN  : 0669FF333536414257131541
ST-LINK FW  : V2J28M18
Board       : STM32WB5MG-DK
Voltage     : 3.27V
SWD freq    : 4000 KHz
Connect mode: Normal
Reset mode  : Software reset
Device ID   : 0x495
Revision ID : Rev Y
Device name : STM32WBxx
Flash size  : 1 MBytes
Device type : MCU
Device CPU  : Cortex-M0+/M4
 
Core run
 
Reading 32-bit memory content
  Size          : 44 Bytes
  Address:      : 0x20030000
 
0x20030000 : 20030024 00000000 00000000 2003005C
0x20030010 : 2003017C 00000000 00000000 00000000
0x20030020 : 00000000 00000000 01010000

The only difference compared to you is that I'm typing the commands directly in the cmd command line (not a batch script), can you please try that and tell me if it is OK?

The command used : C:\Program Files\STMicroelectronics\STM32Cube\STM32CubeProgrammer-2-5-0\bin>STM32_Programmer_CLI.exe -c port=swd -run -r32 0x20030000 42

Houda

Houda GHABRI
ST Employee

Hi @CFern.2​ ,

I Hope my answer helps you, did you try the recommended command ?

When your question is answered, please close this topic by choosing Select as Best. This will help other users find that answer faster.

Houda