[SOLVED] programming failed ATSAMD21G18 with SEGGER-EDU

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

  • [SOLVED] programming failed ATSAMD21G18 with SEGGER-EDU

    Hello,

    I've been using Arduino M0 (ATSAMD21G18 ) with SEGGER-EDU to test cortex-m0 feature. This time I want to debug the code with Atmel Studio. As soon as debugging process is started, I have an error message "Programming failed".

    Now I try to restore bootloader back but the same error again. I've tried to use SEGGER J-Link Commander as suggested by 2016-08-17 Successful JLinkExe session flashing Adafruit Feather M0.txt of [SOLVED] Loadfile fails using JLink with Adafruit Feather M0, it seems to ok with connection but programming failed. Here is log from J-Link Commander
    SEGGER J-Link Commander V6.18d (Compiled Sep 1 2017 18:30:35)
    DLL version V6.18d, compiled Sep 1 2017 18:29:59

    Connecting to J-Link via USB...O.K.
    Firmware: J-Link ARM V8 compiled Nov 28 2014 13:44:46
    Hardware version: V8.00
    S/N: xxxxxxx
    License(s): FlashBP, GDB
    OEM: SEGGER-EDU
    VTref = 3.170V


    Type "connect" to establish a target connection, '?' for help
    J-Link>connect
    Please specify device / core. <Default>: Unspecified
    Type '?' for selection dialog
    Device>ATSAMD21G18
    Please specify target interface:
    J) JTAG (Default)
    S) SWD
    TIF>s
    Specify target interface speed [kHz]. <Default>: 4000 kHz
    Speed>1000 kHz
    Device "ATSAMD21G18" selected.


    Connecting to target via SWD
    Found SW-DP with ID 0x0BC11477
    Found SW-DP with ID 0x0BC11477
    Scanning AP map to find all available APs
    AP[1]: Stopped AP scan as end of AP map has been reached
    AP[0]: AHB-AP (IDR: 0x04770031)
    Iterating through AP map to find AHB-AP to use
    AP[0]: Core found
    AP[0]: AHB-AP ROM base: 0x41003000
    CPUID register: 0x410CC601. Implementer code: 0x41 (ARM)
    Found Cortex-M0 r0p1, Little endian.
    FPUnit: 4 code (BP) slots and 0 literal slots
    CoreSight components:
    ROMTbl[0] @ 41003000
    ROMTbl[0][0]: E00FF000, CID: B105100D, PID: 000BB4C0 ROM Table
    ROMTbl[1] @ E00FF000
    ROMTbl[1][0]: E000E000, CID: B105E00D, PID: 000BB008 SCS
    ROMTbl[1][1]: E0001000, CID: B105E00D, PID: 000BB00A DWT
    ROMTbl[1][2]: E0002000, CID: B105E00D, PID: 000BB00B FPB
    ROMTbl[0][1]: 41006000, CID: B105900D, PID: 001BB932 MTB-M0+
    Cortex-M0 identified.
    J-Link>loadfile D:\featherm0bootloader_160305.hex
    Downloading file [D:\featherm0bootloader_160305.hex]...
    J-Link: Flash download: Restarting flash programming due to program error (possibly skipped erasure of half-way erased sector).
    J-Link: Flash download: Skip optimizations disabled for second try.
    Error while programming flash: Programming failed.


    Any suggestion is greatly appreciated.

    pak
    Files

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

  • Hello pak,

    Thank you for your inquiry.
    Such a behaviour is now known to us.
    I tried to reproduce the behaviour with your file but i could program it without any issues.
    For that i used the latest J-Link software version. You seem to be using an older one. Could you update and see if that solves your issue?

    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,

    Thanks for fast reply, I did try J-Link v6.20i with Atmel Studio 7 (AS 7).
    I'll explain the whole scenario as follow:
    1. I installed Arduino IDE v1.6.5
    2. From Arduino IDE, install Arduino Zero via Tool menu -> Board Manager -> Arduino Zero.
    3. I installed Atmel Studio 7
    4. From Atmel Studio (AS 7), create Arduino project, please refer to the link.
    5. I stalled J-Link software.
    6. During installation of J-Link software, I was asked to update the jlink driver, I selected 'Yes'.
    7. I proceeded to debug with AS 7, during flashing programming process, I saw that AS 7 used J-Link v6.18, maybe it messed with J-Link software v6.20i that I recently installed


    I hope I describe the story of the problem. Please let me know if you need more info.

    pak
  • Hi pak,

    Thank you for providing the setup.
    Generally programming should work without any issues.
    Could you retry programming the hex file with J-Link Commander V6.20i and see if it works.
    If not try to erase the target beforehand, power on reset and then try to program.
    To update the DLL in Atmel Studio you can use the J-LinkDLLUpdater in the J-Link software install folder.
    Make sure Atmel Studio is closed when you try to update the DLL. Then Atmel Studio should be using the latest version as well.

    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.
  • Hello Nino,

    Thank for the advice, I try the following steps:
    1) Program with J-Link Commander V6.20i --> the same problem.
    2) Erase first then power on reset then program --> the same problem, please refer to attached pictures.

    Note: power on reset -->
    1) Disconnect programming cable from Arduino M0 board, please refer to Arduino M0 board
    2) Disconnect power cable of Arduino M0 board (USB cable in my case),
    3) Connect power cable back
    4) Connect programming cable back.

    The picture, "Erase_Program_1.jpg" shows "J-Link V6.20i Internal Error" error message pop-up during programming hex file after power on reset.
    The picture, "Erase_Program_2.jpg" shows "Programming failed" error after clicking "OK" button of the error message.

    Any idea? Thank you for your support.

    pak
    Images
    • Erase_Program_1.jpg

      166.1 kB, 810×1,053, viewed 721 times
    • Erase_Program_2.jpg

      41.61 kB, 792×206, viewed 484 times
    • Arduino M0 board.jpg

      52.43 kB, 520×330, viewed 588 times

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

  • Hi pak,

    Erase first then power on reset then program --> the same problem, please refer to attached pictures.

    After the power on reset you need to reconnect first to your target device again because the connection is lost.
    Sorry if i was a bit unclear here.
    So the correct steps would be
    1. connect to target
    2. erase
    3. power on reset
    4. connect to target again (either start J-Link Commander again or execute "connect" again in the running session)
    5. loadfile

    does that work?

    Unfortunatly we do not have this particular Arduino Board in house but a Genuino Zero instead with the same MCU: store.arduino.cc/genuino-zero

    This is where I tried to reproduce the behaviour.
    Attached is the output i get when trying to program the file you provided.

    So everything seems to be working as expected.

    Best regards,
    Nino
    Images
    • Capture.PNG

      42.01 kB, 689×710, viewed 640 times
    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.
  • Hello Nino,

    I've followed the steps you mentioned
    1. connect to target
    2. erase
    3. power on reset
    4. connect to target again (either start J-Link Commander again or execute "connect" again in the running session)
    5. loadfile


    Unfortunately, I've the same result, "Programming failed" :( :(

    It looks like the problem is either the board faulty or MCU corrupted. I don't believe that the board is faulty because of debugging with Atmel Studio 7.
    What do you think about the problem?

    By the way, my computer system is Windwos 10 (64-bit).

    Thanks for your support.

    pak
  • Hello pak,

    It looks like the problem is either the board faulty or MCU corrupted.

    This is quite possible.
    Do you have another eval board to test against?
    Could you try your setup on another PC?
    Does that change the behaviour?

    Unfortunately the issue is not reproducible for us so we can't offer any fixes or improvements in our software in this case.

    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.
  • Hello pak,

    Do you think that MCU (ATSAMD21G18) is bricked?

    Hard to tell. As you can connect to the board and use it through Atmel Studio it seems to be fine.

    Do you have any suggestions for bricked chip (Cortex M0)?

    Only to try the J-Link with another board and see if the problem persists.
    For additional questions about "brick" detection please contact Atmel as we are not aware of such an option.

    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.
  • Hello pak,

    Is it possible to restore the chip to the factory default by J-Link?

    We have no information about such a feature. Please contact Atmel for such information.
    So far we never needed to restore a chip because simply triggering the reset pin was enough.

    In case of ISP dose not work, I usually use "High Voltage Programmer" to restore the chip to factory default.

    According to the link a 12 V line is needed for this to work. J-Link can output maximum 5 V so this technique will most likely not succeed.

    As this issue is not J-Link related or to our software please understand that we can not put more time into this case.
    We were not able to reproduce the behaviour here with the same chip on an eval board.
    As suggested try to get your hands on another similar eval board and see if it is a generic problem with that chip.
    Try to run your setup on another computer and see if the issue still persists.

    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.