[SOLVED] JLink unable to halt and erase SAMD51 and SAME54 micros

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

  • [SOLVED] JLink unable to halt and erase SAMD51 and SAME54 micros

    Hi,

    I have a SAMD51 custom board and the Atmel SAME54 XPLAINED board which is Rev 0 (Engineering Sample).

    Similar issue to this abandoned thread: [ABANDONED] J-Link ATSAME54 can't halt CPU

    However I can confirm it is not just Atmel Studio but JLink Commander is 100% unable to operate on these micros.


    I have tried JLink commander from 6.32c and 6.22c with no difference in error.


    Source Code

    1. SEGGER J-Link Commander V6.32c (Compiled May 11 2018 16:30:45)
    2. DLL version V6.32c, compiled May 11 2018 16:30:26
    3. Connecting to J-Link via USB...O.K.
    4. Firmware: J-Link V9 compiled Apr 20 2018 16:47:26
    5. Hardware version: V9.40
    6. S/N: 29423994
    7. License(s): RDI, GDB
    8. OEM: SAM-ICE
    9. VTref=3.320V
    10. Type "connect" to establish a target connection, '?' for help
    11. J-Link>connect
    12. Please specify device / core. <Default>: ATSAMD51J18
    13. Type '?' for selection dialog
    14. Device>
    15. Please specify target interface:
    16. J) JTAG (Default)
    17. S) SWD
    18. TIF>S
    19. Specify target interface speed [kHz]. <Default>: 4000 kHz
    20. Speed>Auto
    21. Device "ATSAMD51J18" selected.
    22. Connecting to target via SWD
    23. Found SW-DP with ID 0x2BA01477
    24. Scanning AP map to find all available APs
    25. AP[2]: Stopped AP scan as end of AP map has been reached
    26. AP[0]: AHB-AP (IDR: 0x24770011)
    27. AP[1]: AHB-AP (IDR: 0x74770001)
    28. Iterating through AP map to find AHB-AP to use
    29. AP[0]: Core found
    30. AP[0]: AHB-AP ROM base: 0x41003000
    31. CPUID register: 0x410FC241. Implementer code: 0x41 (ARM)
    32. Found Cortex-M4 r0p1, Little endian.
    33. FPUnit: 6 code (BP) slots and 2 literal slots
    34. CoreSight components:
    35. ROMTbl[0] @ 41003000
    36. ROMTbl[0][0]: E00FF000, CID: B105100D, PID: 000BB4C4 ROM Table
    37. ROMTbl[1] @ E00FF000
    38. ROMTbl[1][0]: E000E000, CID: B105E00D, PID: 000BB00C SCS-M7
    39. ROMTbl[1][1]: E0001000, CID: B105E00D, PID: 003BB002 DWT
    40. ROMTbl[1][2]: E0002000, CID: B105E00D, PID: 002BB003 FPB
    41. ROMTbl[1][3]: E0000000, CID: B105E00D, PID: 003BB001 ITM
    42. ROMTbl[1][4]: E0040000, CID: B105900D, PID: 000BB9A1 TPIU
    43. ROMTbl[1][5]: E0041000, CID: B105900D, PID: 000BB925 ETM
    44. ROMTbl[1][6]: E0042000, CID: B105900D, PID: 003BB907 ETB
    45. Cortex-M4 identified.
    46. J-Link>h
    47. **************************
    48. WARNING: CPU could not be halted
    49. **************************
    50. J-Link>erase
    51. **************************
    52. WARNING: CPU could not be halted
    53. **************************
    54. Erasing device (ATSAMD51J18)...
    55. **************************
    56. WARNING: CPU could not be halted
    57. **************************
    58. ****** Error: Can not read register 16 (XPSR) while CPU is running
    59. Can not read register 20 (CFBP) while CPU is running
    60. Can not read register 0 (R0) while CPU is running
    61. Can not read register 1 (R1) while CPU is running
    62. Can not read register 2 (R2) while CPU is running
    63. Can not read register 3 (R3) while CPU is running
    64. Can not read register 4 (R4) while CPU is running
    65. Can not read register 5 (R5) while CPU is running
    66. Can not read register 6 (R6) while CPU is running
    67. Can not read register 7 (R7) while CPU is running
    68. Can not read register 8 (R8) while CPU is running
    69. Can not read register 9 (R9) while CPU is running
    70. Can not read register 10 (R10) while CPU is running
    71. Can not read register 11 (R11) while CPU is running
    72. Can not read register 12 (R12) while CPU is running
    73. Can not read register 14 (R14) while CPU is running
    74. Can not read register 15 (R15) while CPU is running
    75. Can not read register 17 (MSP) while CPU is running
    76. Can not read register 18 (PSP) while CPU is running
    77. ****** Error: Can not read register 20 (CFBP) while CPU is running
    78. ****** Error: CPU is not halted
    79. **************************
    80. WARNING: CPU could not be halted
    81. **************************
    82. ****** Error: Can not read register 15 (R15) while CPU is running
    83. ****** Error: Can not read register 16 (XPSR) while CPU is running
    84. ****** Error: Can not read register 13 (R13) while CPU is running
    85. ****** Error: Timeout while checking target RAM, core does not stop. (PC = 0x00000000, XPSR = 0x00000000, SP = 0x00000000)!
    86. Failed to prepare for programming.
    87. Failed to execute RAMCode for RAM check!
    88. ERROR: Erase returned with error code -1.
    89. J-Link>
    90. Unknown command. '?' for help.
    91. J-Link>
    92. Unknown command. '?' for help.
    93. J-Link>regs
    94. CPU is not halted !
    95. J-Link>
    Display All




    The EDBG from Atmel has no issue with the SAME54, just the JLink. And this is just using Commander so its not Studio ;)

    Both chips are revision A.





    Edit:
    According to this Microchip support response:

    This issue will be fixed in the upcoming releases of Studio with updates from SEGGER.


    Is there a fix somewhere from SEGGER?

    The post was edited 2 times, last by mroszko ().

  • Hello,

    Thank you for your inquiry.

    Is there a fix somewhere from SEGGER?

    No, because this issue has never been reproducible for us.
    What will change within the next 1-2 weeks is that unsecuring locked ATSAM devices will also work on SAME54/SAMD51 as the sequence from Atmel Studio was not correct.
    So we implemented it in our J-Link software directly and it gets handled automatically like for SAMD20 series etc.
    Attached is a successful connect sequence with a SAMD51 XPlained Pro board.
    Everything is working as expected.

    Now both our setups use the same J-Link/SAM-ICE hardware and same eval Board.
    The only things that might be different in our setups are:

    a) On your board some kind of boot mode is activated that disables/interferes with the debug connection.
    b) On your target device an application was running prior to connecting with J-Link which inhibits J-Link communication.

    Regarding a): this is rather unlikely as the XPlained Pro eval boards do not seem to have some external boot jumper settings that might interfere here (correct me if I am wrong).

    So it will most likely be case b).
    For reproduction purposes, could you provide us with the hex/bin of the application that was running on your eval board before connecting, halting and erasing with J-Link did not work?
    Does this application set the security bit?
    Does the application reconfigure the SWD debug pins for other purposes during run time?
    Are any low power modes active or WFI?

    Please understand that we can't put to much time in this matter as SAM-ICE support is not given through SEGGER but through Microchip.
    Also the issue could so far not be recreated on any of the boards that we have available at our company. Neither our contacts at Microchip were able to reproduce these reported issues.

    Best regards,
    Nino
    Images
    • Capture.PNG

      63.34 kB, 677×1,002, viewed 36 times
    Please read the forum rules before posting: Forum Rules

    Keep in mind, this is not a support forum. Its main purpose is user to user interaction.
    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 contact us per e-mail.
    The following contact form can be used for this: Contact Us



  • Please understand that we can't put to much time in this matter as SAM-ICE support is not given through SEGGER but through Microchip.



    Hahahahahah. Bad news for you!

    I have a JFlasher Portable Plus. Serial number 811000224. Even attached a photo.

    Same exact problem, see the attached log.


    Please help. :thumbsup:


    (I really do need the JFlasher to work, we use them in our initial small run production lots before we get chips preprogrammed)







    >a) On your board some kind of boot mode is activated that disables/interferes with the debug connection.


    On my D51 board, there is no alternate boot mode and the Atmel-ICE works fine. On the E54-Xplained board, there doesn't look like theres a boot mode setting enabled

    >b) On your target device an application was running prior to connecting with J-Link which inhibits J-Link communication.

    My SAMD51 custom board has zero firmware and was a fresh chip. There is no way for security bit to be set.





    I have attached the programmed hex file and even the sample project source because its just a bare startup project that keeps the micro on its external 12mhz clock, no PLL, and it has a simple loop.


    I can confirm the Atmel-ICE works just fine after I acquired one today. And I programmed the project on my D51 board.
    The segger still does not work with the D51 after programming this simple firmware file.

    The .hex file is inside the zip file under the /Debug folder, along with .elf and .bin since. hex isn't an allowed attachment type.
    Images
    • IMG_20180518_100652.jpg

      168.08 kB, 738×984, viewed 30 times
    Files

    The post was edited 1 time, last by mroszko ().

  • Hello,

    Thank you for providing the test files.
    With them the issue was reproducible.
    However it seems that this issue is not related to the application running on the target but to some weird power/boot state that the SAMD51 and SAME51-54 series can get into.
    To reproduce the issue on a XPlained Pro eval board simply press the Reset button once. Then if you power the board through "DEBUG USB" you wont be able to halt the target with J-Link or do anything useful with it.
    A way that we found to recover it is to power the board through the "Target USB" connector. Have your J-Link connected to the target device. Now remove the flat jumper next to "TARGET USB".
    Then set the jumper again. Now try to connect to the target device and halt it. You should now be able to access the chip fully again with J-Link.
    Does this workaround work for you?
    If you power it through the "DEBUG USB" connector again it will fail again so we suggest sticking to "TARGET USB" for now until it is clear why the MCU is behaving like that.
    We assume that the press of the RESET button sets the MCU in a reset extension which it can't release from as the EDBG is interfering with J-Link here if powered through that USB interface.
    We will step in contact with Microchip to get to the bottom of this.
    For now we assume that the issue is only related to boards that have an active EDBG interface that can't be disabled. So custom boards should not be affected.
    Sorry for any inconveniences caused.


    I have a JFlasher Portable Plus. Serial number 811000224. Even attached a photo.

    Good, so you have a SEGGER product within valid support period. For future inquiries we suggest contacting us over the official support channels per e-mail then.
    This forum is no support forum without guarantee to get a response. More information can be found in the forum rules or my forum signature.

    Best regards,
    Nino
    Please read the forum rules before posting: Forum Rules

    Keep in mind, this is not a support forum. Its main purpose is user to user interaction.
    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 contact us per e-mail.
    The following contact form can be used for this: Contact Us

  • Hi,

    Quick update. We were able to fix the issue. A native reset extension release will be implemented with the next J-Link software release planned on Friday.

    Best regards,
    Nino
    Please read the forum rules before posting: Forum Rules

    Keep in mind, this is not a support forum. Its main purpose is user to user interaction.
    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 contact us per e-mail.
    The following contact form can be used for this: Contact Us