Monday, December 11th 2017, 4:47am UTC+1

You are not logged in.

  • Login
  • Register

paksoft

Beginner

Date of registration: Apr 15th 2011

Posts: 11

1

Thursday, November 23rd 2017, 1:58pm

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

Quoted

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
paksoft has attached the following file:

This post has been edited 2 times, last edit by "paksoft" (Nov 23rd 2017, 2:19pm)


SEGGER - Nino

Super Moderator

Date of registration: Jan 2nd 2017

Posts: 430

2

Thursday, November 23rd 2017, 2:38pm

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

paksoft

Beginner

Date of registration: Apr 15th 2011

Posts: 11

3

Friday, November 24th 2017, 2:53am

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

SEGGER - Nino

Super Moderator

Date of registration: Jan 2nd 2017

Posts: 430

4

Friday, November 24th 2017, 9:21am

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

paksoft

Beginner

Date of registration: Apr 15th 2011

Posts: 11

5

Friday, November 24th 2017, 2:14pm

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
paksoft has attached the following images:
  • Erase_Program_1.jpg
  • Erase_Program_2.jpg
  • Arduino M0 board.jpg

This post has been edited 2 times, last edit by "paksoft" (Nov 24th 2017, 2:21pm)


SEGGER - Nino

Super Moderator

Date of registration: Jan 2nd 2017

Posts: 430

6

Friday, November 24th 2017, 4:14pm

Hi pak,

Quoted

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: https://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
SEGGER - Nino has attached the following image:
  • Capture.PNG

paksoft

Beginner

Date of registration: Apr 15th 2011

Posts: 11

7

Saturday, November 25th 2017, 8:24am

Hello Nino,

I've followed the steps you mentioned

Quoted

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

SEGGER - Nino

Super Moderator

Date of registration: Jan 2nd 2017

Posts: 430

8

Tuesday, November 28th 2017, 9:05am

Hello pak,

Quoted

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

paksoft

Beginner

Date of registration: Apr 15th 2011

Posts: 11

9

Friday, December 1st 2017, 12:29pm

Hello Nino,

Do you think that MCU (ATSAMD21G18) is bricked?
Do you have any suggestions for bricked chip (Cortex M0)?

pak

SEGGER - Nino

Super Moderator

Date of registration: Jan 2nd 2017

Posts: 430

10

Friday, December 1st 2017, 4:10pm

Hello pak,

Quoted

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.

Quoted

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

paksoft

Beginner

Date of registration: Apr 15th 2011

Posts: 11

11

Yesterday, 5:22pm

Hello Nino,

Is it possible to restore the chip to the factory default by J-Link?
For example, Ateml AVR ATmega328p chip, I use ISP(In System Programming) to flash program. In case of ISP dose not work, I usually use "High Voltage Programmer" to restore the chip to factory default.

High Voltage Programmer

pak

This post has been edited 1 times, last edit by "paksoft" (Yesterday, 5:26pm)