[SOLVED]STM32L031F6: STM32 (connect): Can not attach to CPU. Trying connect under reset.

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

  • [SOLVED]STM32L031F6: STM32 (connect): Can not attach to CPU. Trying connect under reset.

    Hello,

    It seems Jlink is not supporting STM32L031F6 or can't connect:

    From Jflash:


    Connecting ...
    - Connecting via USB to J-Link device 0
    - Target interface speed: 2000 kHz (Fixed)
    - VTarget = 3.279V
    - ERROR: STM32: Connecting to CPU via connect under reset failed.
    - ERROR: Failed to connect.
    Could not establish a connection to target.


    The same from Atollic:
    Connecting to target...ERROR: STM32: Connecting to CPU via connect under reset failed.

    JFlash is 6.20.

    Even if I erase flash (with ST-Link utility) I can't connect from JLink/Jflash.
  • This is log if I try to debug using 6.12j:

    C Source Code

    1. Target voltage: 3.28 V
    2. Listening on TCP/IP port 2331
    3. Connecting to target...WARNING: Failed to reset CPU. VECTRESET has confused core.
    4. WARNING: CPU did not halt after reset.
    5. WARNING: T-bit of XPSR is 0 but should be 1. Changed to 1.
    6. WARNING: CPU did not halt after reset.
    7. WARNING: T-bit of XPSR is 0 but should be 1. Changed to 1.
    8. WARNING: Failed to reset CPU. VECTRESET has confused core.
    9. WARNING: CPU did not halt after reset.
    10. WARNING: CPU could not be halted
    11. WARNING: T-bit of XPSR is 0 but should be 1. Changed to 1.
    12. WARNING: T-bit of XPSR is 0 but should be 1. Changed to 1.
    13. Connected to target
    14. Waiting for GDB connection...Connected to 127.0.0.1
    15. Reading all registers
    16. ERROR: Can not read register 0 (R0) while CPU is running
    17. ERROR: Can not read register 1 (R1) while CPU is running
    18. ERROR: Can not read register 2 (R2) while CPU is running
    19. ERROR: Can not read register 3 (R3) while CPU is running
    20. ERROR: Can not read register 4 (R4) while CPU is running
    21. ERROR: Can not read register 5 (R5) while CPU is running
    22. ERROR: Can not read register 6 (R6) while CPU is running
    23. ERROR: Can not read register 7 (R7) while CPU is running
    24. ERROR: Can not read register 8 (R8) while CPU is running
    25. ERROR: Can not read register 9 (R9) while CPU is running
    26. ERROR: Can not read register 10 (R10) while CPU is running
    27. ERROR: Can not read register 11 (R11) while CPU is running
    28. ERROR: Can not read register 12 (R12) while CPU is running
    29. ERROR: Can not read register 13 (R13) while CPU is running
    30. ERROR: Can not read register 14 (R14) while CPU is running
    31. ERROR: Can not read register 15 (R15) while CPU is running
    32. ERROR: Can not read register 16 (XPSR) while CPU is running
    33. ERROR: Can not read register 17 (MSP) while CPU is running
    34. ERROR: Can not read register 18 (PSP) while CPU is running
    35. ERROR: Can not read register 24 (PRIMASK) while CPU is running
    36. ERROR: Can not read register 25 (BASEPRI) while CPU is running
    37. ERROR: Can not read register 26 (FAULTMASK) while CPU is running
    38. ERROR: Can not read register 27 (CONTROL) while CPU is running
    39. WARNING: Failed to read memory @ address 0x00000000
    40. Connected to 127.0.0.1
    41. Reading all registers
    42. ERROR: Can not read register 0 (R0) while CPU is running
    43. ERROR: Can not read register 1 (R1) while CPU is running
    44. ERROR: Can not read register 2 (R2) while CPU is running
    45. ERROR: Can not read register 3 (R3) while CPU is running
    46. ERROR: Can not read register 4 (R4) while CPU is running
    47. ERROR: Can not read register 5 (R5) while CPU is running
    48. ERROR: Can not read register 6 (R6) while CPU is running
    49. ERROR: Can not read register 7 (R7) while CPU is running
    50. ERROR: Can not read register 8 (R8) while CPU is running
    51. ERROR: Can not read register 9 (R9) while CPU is running
    52. ERROR: Can not read register 10 (R10) while CPU is running
    53. ERROR: Can not read register 11 (R11) while CPU is running
    54. ERROR: Can not read register 12 (R12) while CPU is running
    55. ERROR: Can not read register 13 (R13) while CPU is running
    56. ERROR: Can not read register 14 (R14) while CPU is running
    57. ERROR: Can not read register 15 (R15) while CPU is running
    58. ERROR: Can not read register 16 (XPSR) while CPU is running
    59. ERROR: Can not read register 17 (MSP) while CPU is running
    60. ERROR: Can not read register 18 (PSP) while CPU is running
    61. ERROR: Can not read register 24 (PRIMASK) while CPU is running
    62. ERROR: Can not read register 25 (BASEPRI) while CPU is running
    63. ERROR: Can not read register 26 (FAULTMASK) while CPU is running
    64. ERROR: Can not read register 27 (CONTROL) while CPU is running
    65. WARNING: Failed to read memory @ address 0x00000000
    66. WARNING: Failed to read memory @ address 0x0800010E
    67. WARNING: Failed to read memory @ address 0x0800010E
    68. Target interface speed set to 30 kHz
    69. Target endianess set to "little endian"
    70. WARNING: T-bit of XPSR is 0 but should be 1. Changed to 1.
    71. Resetting target
    72. Select auto target interface speed (2000 kHz)
    73. Flash download enabled
    74. Downloading 192 bytes @ address 0x08000000 - Verified OK
    75. Downloading 396 bytes @ address 0x080000C0 - Verified OK
    76. Downloading 4 bytes @ address 0x0800024C - Verified OK
    77. Downloading 4 bytes @ address 0x08000250 - Verified OK
    78. ERROR: Failed to download RAMCode.
    79. Failed to prepare for programming.
    80. Failed to download RAMCode!
    81. Writing register (PC = 0x1c010008)
    82. Writing register (XPSR = 0x00000001)
    83. WARNING: Failed to read memory @ address 0x0800011C
    84. WARNING: Failed to reset CPU. VECTRESET has confused core.
    85. WARNING: CPU did not halt after reset.
    86. WARNING: CPU could not be halted
    87. WARNING: CPU did not halt after reset.
    88. WARNING: CPU could not be halted
    89. WARNING: Could not set S_RESET_ST
    90. WARNING: Failed to reset CPU. VECTRESET has confused core.
    91. WARNING: CPU did not halt after reset.
    92. WARNING: CPU could not be halted
    93. WARNING: CPU did not halt after reset.
    94. WARNING: CPU could not be halted
    95. WARNING: Could not set S_RESET_ST
    96. ERROR: DAP error while reading DP-Ctrl-Stat register.
    97. Resetting target
    98. WARNING: Failed to read memory @ address 0x0800010E
    99. Reset target CPU...
    100. WARNING: Failed to reset CPU. VECTRESET has confused core.
    101. WARNING: CPU did not halt after reset.
    102. WARNING: CPU could not be halted
    103. WARNING: CPU did not halt after reset.
    104. WARNING: CPU could not be halted
    105. WARNING: Could not set S_RESET_ST
    106. WARNING: Failed to reset CPU. VECTRESET has confused core.
    107. WARNING: CPU did not halt after reset.
    108. WARNING: CPU could not be halted
    109. WARNING: CPU did not halt after reset.
    110. WARNING: CPU could not be halted
    111. WARNING: Could not set S_RESET_ST
    112. ERROR: DAP error while reading DP-Ctrl-Stat register.
    113. GDB closed TCP/IP connection
    114. GDB closed TCP/IP connection
    115. Restoring target state and closing J-Link connection...
    116. Shutting down...
    Display All


    however flash is still blank and can't debug