[SOLVED] J-Link + STM32F4 + Atollic: ERROR: Can not read register [...] while CPU is running

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • [SOLVED] J-Link + STM32F4 + Atollic: ERROR: Can not read register [...] while CPU is running

    Hi everyone,

    I am running j-link base with latest firmware (2019 Mar 21) to debug STM32F415RG, using Atollic TrueSTUDIO ver 9.1.0 (Eclipse Neon).

    Sometimes the debug session runs with no problems, but most of a time a get an error when I try to run the session using "Resume". When I use "Step Over" or "Step Into" it always works fine. Here is an Console output of debug session init:

    Source Code

    1. SEGGER J-Link GDB Server V6.44 Command Line Version
    2. JLinkARM.dll V6.44 (DLL compiled Mar 1 2019 17:32:34)
    3. Command line: -port 2331 -s -CPU Cortex-M -device STM32F415RG -endian little -speed 4000 -if swd -vd
    4. -----GDB Server start settings-----
    5. GDBInit file: none
    6. GDB Server Listening port: 2331
    7. SWO raw output listening port: 2332
    8. Terminal I/O port: 2333
    9. Accept remote connection: localhost only
    10. Generate logfile: off
    11. Verify download: on
    12. Init regs on start: off
    13. Silent mode: off
    14. Single run mode: on
    15. Target connection timeout: 0 ms
    16. ------J-Link related settings------
    17. J-Link Host interface: USB
    18. J-Link script: none
    19. J-Link settings file: none
    20. ------Target related settings------
    21. Target device: STM32F415RG
    22. Target interface: SWD
    23. Target interface speed: 4000kHz
    24. Target endian: little
    25. Connecting to J-Link...
    26. J-Link is connected.
    27. Firmware: J-Link V10 compiled Mar 21 2019 15:43:57
    28. Hardware: V10.10
    29. S/N: 50121268
    30. Feature(s): GDB
    31. Checking target voltage...
    32. Target voltage: 3.30 V
    33. Listening on TCP/IP port 2331
    34. Connecting to target...Connected to target
    35. Waiting for GDB connection...Connected to 127.0.0.1
    36. Reading all registers
    37. Read 4 bytes @ address 0x08000DF0 (Data = 0xBF00E7FE)
    38. Connected to 127.0.0.1
    39. Reading all registers
    40. Read 4 bytes @ address 0x08000DF0 (Data = 0xBF00E7FE)
    41. Received monitor command: WriteDP 0x2 0x000000F0
    42. O.K.
    43. Received monitor command: ReadAP 0x2
    44. O.K.:0xE00FF003
    45. Reading 32 bytes @ address 0xE00FFFD0
    46. Read 2 bytes @ address 0x08000DC0 (Data = 0xB508)
    47. Received monitor command: speed 30
    48. Target interface speed set to 30 kHz
    49. Received monitor command: endian little
    50. Target endianess set to "little endian"
    51. Received monitor command: reset
    52. Resetting target
    53. Received monitor command: speed auto
    54. Select auto target interface speed (2000 kHz)
    55. Received monitor command: flash download = 1
    56. Flash download enabled
    57. [...]
    Display All


    As soon as I hit the "Resume" button the console outputs ERRORs and the debug process can not be paused or braked:

    Source Code

    1. [...]
    2. ERROR: Can not read register 64 (FPS31) while CPU is running
    3. WARNING: Failed to read memory @ address 0xDEADBEEE
    4. Starting target CPU...
    5. ERROR: CPU is not halted
    6. ERROR: Can not read register 15 (R15) while CPU is running
    7. Reading all registers
    8. ERROR: Can not read register 0 (R0) while CPU is running
    9. ERROR: Can not read register 1 (R1) while CPU is running
    10. ERROR: Can not read register 2 (R2) while CPU is running
    11. ERROR: Can not read register 3 (R3) while CPU is running
    12. ERROR: Can not read register 4 (R4) while CPU is running
    13. ERROR: Can not read register 5 (R5) while CPU is running
    14. [...]
    Display All

    I tried using Ozone V2.62a for debugging the same code and I get similar results. Step-by-step debug goes fine, bus as I hit resume: "Failed to read target status. Abort Debug Session?"

    Source Code

    1. Debug.Continue();
    2. J-Link: connection to target device lost.
    3. Debug.Halt();
    4. CPU could not be halted
    I have tried to simulate condition when I starts to work fine or the moment it breaks, but with no luck. Resetting hardware, j-link, eclipse, number of breakpoints etc...


    Did anyone experienced similar issue? Can it be a hardware problem? Faulty j-link?

    Regards:
    - Tomasz
  • Hi,

    I have just tried using ST-Link just a moment ago and it works flawlessly.

    Weird thing is that J-Link started working after using ST-Link, but I have been here before...I get to work and at some point I get the same behaviour as above.

    Earlier I also tested deleting the debug configuration in Atollic, or a clean build, but none of it fixed the problem.

    - Tomasz
  • Hello Tomasz,

    Thank you for your inquiry.
    Such an issue is not known to us.
    The reported behaviour sounds like it might be application specific.
    Is the behaviour reproducible with any application?
    Could you provide a J-Link log of the failing session?
    wiki.segger.com/Enable_J-Link_log_file
    Does your application enable any sleep modes or uses WFI/WFE calls?

    Best regards,
    Nino
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.
  • Hi Nino!

    Today it came out that it was application specific and it was my mistake. Certain operation caused system under-voltage and MCU was acting not predictably. At some point it stopped working even with the ST-Link, so it was a lead to investigate further. Additional power filtration fixed the problem.

    In the end it was not a J-Link problem, just my bad design.

    Thank you for everybody help.

    Regards:
    - Tomasz
  • Hello Tomasz,

    Good to hear that you are up and running again.
    We will consider this thread as solved now.

    Best regards,
    Nino
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.