cancel
Showing results for 
Search instead for 
Did you mean: 

How to resolve the Debug Error "CM4 Failed to read all registers FAILED to REGISTER Values from the target"?

TSaga.1
Associate

I encountered a very weird behaviour when trying to erase the Flash memory of the STM32H745ZITx on the Nucleo-H745ZI-Q board using the STM32CubeIDE on Linux. While running the code:

  HAL_FLASHEx_Unlock_Bank2();
  for (int i = 0x0; i <= 0x7; i++)
  {
    FLASH_Erase_Sector(i, FLASH_BANK_2, FLASH_VOLTAGE_RANGE_4);
  }
  HAL_FLASHEx_Lock_Bank2();

I get the following debug output:

STMicroelectronics ST-LINK GDB server. Version 5.6.0
Copyright (c) 2020, STMicroelectronics. All rights reserved.
 
Starting server with the following options:
        Persistent Mode            : Disabled
        Logging Level              : 1
        Listen Port Number         : 61234
        Status Refresh Delay       : 15s
        Verbose Mode               : Disabled
        SWD Debug                  : Enabled
        InitWhile                  : Enabled
 
Waiting for debugger connection...
Debugger connected
      -------------------------------------------------------------------
                        STM32CubeProgrammer v2.5.0-RC1                  
      -------------------------------------------------------------------
 
ST-Link Server is running on port : 7184
ST-LINK SN  : 002200293137511239383538
ST-LINK FW  : V3J7M2
Board       : NUCLEO-H745ZI-Q
Voltage     : 3,28V
SWD freq    : 24000 KHz
Connect mode: Under Reset
Reset mode  : Hardware reset
Device ID   : 0x450
Revision ID : --
Device name : STM32H7xx
Flash size  : 2 MBytes
Device type : MCU
Device CPU  : Cortex-M7/M4
Device name : STM32H7xx
Flash size  : 2 MBytes
Device type : MCU
Device CPU  : Cortex-M7/M4
 
 
 
Memory Programming ...
Opening and parsing file: ST-LINK_GDB_server_UhLEQ9.srec
  File          : ST-LINK_GDB_server_UhLEQ9.srec
  Size          : 39060 Bytes
  Address       : 0x08000000 
 
 
Erasing memory corresponding to segment 0:
Erasing internal memory sector 0
Download in Progress:
 
 
File download complete
Time elapsed during download operation: 00:00:01.028
 
 
 
Verifying ...
 
 
 
 
Download verified successfully
 
 
(Read)Failed determine breakpoint type
CM4 Failed to read all registers
FAILED to REGISTER Values from the target

After this I do not get any more debug functionality of any sort (e.g. dynamic printfs, breakpoints etc.).

I generated the project and setup code with the IDE, so everything should be set up correctly, I only wrote code for the CM7 and also the code above is run on the CM7.

The weird part of this is that if I add a dynamic printf in the for loop, the code runs fine (there is still some debug messages, but the debug behaviour after the code is normal). The debug message, that remains (instead of the last three lines above):

(Read)Failed determine breakpoint type
Target is not responding, retrying...

1 ACCEPTED SOLUTION

Accepted Solutions
Amel NASRI
ST Employee

Hi @TSaga.1​ ,

Could you please check the following:

  1. is the issue faced while debugging a generated project only, or even when you try to debug an example from STM32CubeH7 FW package (Ex: STM32Cube_FW_H7\Projects\STM32H745I-DISCO\Examples\GPIO\GPIO_EXTI)?
  2. is the setup described in AN5286 for SW4STM32 applied in your generated project? The setup required for STM32CubeIDE should be similar. Seeing your request, it will be interesting to update AN5286 in order to support STM32CubeIDE.

-Amel

PS: PS: Once your question is answered, please click on "Select as Best" for the comment containing the answer to your initial question.

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.

View solution in original post

2 REPLIES 2
Amel NASRI
ST Employee

Hi @TSaga.1​ ,

Could you please check the following:

  1. is the issue faced while debugging a generated project only, or even when you try to debug an example from STM32CubeH7 FW package (Ex: STM32Cube_FW_H7\Projects\STM32H745I-DISCO\Examples\GPIO\GPIO_EXTI)?
  2. is the setup described in AN5286 for SW4STM32 applied in your generated project? The setup required for STM32CubeIDE should be similar. Seeing your request, it will be interesting to update AN5286 in order to support STM32CubeIDE.

-Amel

PS: PS: Once your question is answered, please click on "Select as Best" for the comment containing the answer to your initial question.

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.

Amel NASRI
ST Employee

Hi @TSaga.1​ ,

Were you able to resolve the issue you initially described here? If yes, it will be interesting to share with us the solution you found.

-Amel

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.