Grand Central M4. Not able to flash using jlink

Please tell us which board you are using.
For CircuitPython issues, ask in the Adafruit CircuitPython forum.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
maddy0812
 
Posts: 7
Joined: Tue Apr 06, 2021 7:45 pm

Grand Central M4. Not able to flash using jlink

Post by maddy0812 »

Hello,
I recently purchased a grand central with ATSAMD51P20A and a jlink edu mini. I am able to get the device powered on and i also can see the mass storage drives(GCM4BOOT and CIRCUITPY) when i connect with windows 10. I can enver into bootloader mode (see the RED LED flashing when i double click reset) and come out of it(see the neo pixel fading in and out ) I want to use the device thru microchip studio(atmel studio) but i am not able to flash the device using jlink commander. When I try to do a connect. I just get this.

SEGGER J-Link Commander V7. 0 (Compiled Apr 8 2021 14:31:32)
DLL version V7.00, compiled Apr 8 2021 14:30:05

Connecting to J-Link via USB...O.K.
Firmware: J-Link EDU Mini V1 compiled Feb 18 2021 11:25:23
Hardware version: V1.00
S/N: ********
License(s): FlashBP, GDB
VTref=3.288V


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


Connecting to target via SWD
InitTarget() start
InitTarget()
Secured Atmel SAMD device detected.
For debugger connection the device needs to be unsecured.
Note: Unsecuring will trigger a mass erase of the internal flash.
Executing default behavior previously saved in the registry.
Device will be unsecured now.
Mass erase done!
Mass erase done!
Mass erase done!
Mass erase done!
(Repeats for 5 mins ) and errors out saying cannot connect to target.

Checked the forum and verified that my XTAL is not flipped like other cases. Is there some kind of protection that prevents me from doing a flash erase and program a bare metal code using atmel studio or MPLAB?

Bought the device a week aga

User avatar
adafruit_support_carter
 
Posts: 29168
Joined: Tue Nov 29, 2016 2:45 pm

Re: Grand Central M4. Not able to flash using jlink

Post by adafruit_support_carter »

Are you also powering the board externally at the same time? The jlink does not power the board.

Is there anything attached to the Grand Central's pins?

Any special reason you picked 100 for the interface speed? The default should be fine.

Are you connecting directly to the GC's SWD header from the jlink?

User avatar
maddy0812
 
Posts: 7
Joined: Tue Apr 06, 2021 7:45 pm

Re: Grand Central M4. Not able to flash using jlink

Post by maddy0812 »

Yes. I am powering the board thru micro USB. All tests were run with the micro usb connected and powering the board.
Nothing attached to the board except the 10 pin SWD cable and micro usb.
My first tests were on the default 4000. that had the same issue. so i tried a variety of speeds like 1000,500,400, etc. Nothing worked.
Yes. USB port to JLINK miniEDU(microUSB) to GC(SWD)

User avatar
adafruit_support_carter
 
Posts: 29168
Joined: Tue Nov 29, 2016 2:45 pm

Re: Grand Central M4. Not able to flash using jlink

Post by adafruit_support_carter »

Weird. That all seems pretty normal. Can you post a photo of your setup so we can look for anything obvious.

I hooked one up to sanity check and it connects as expected:

Code: Select all

$ jlink
SEGGER J-Link Commander V6.94b (Compiled Jan 26 2021 18:05:49)
DLL version V6.94b, compiled Jan 26 2021 18:05:34

Connecting to J-Link via USB...O.K.
Firmware: J-Link EDU Mini V1 compiled Jan  4 2021 16:18:35
Hardware version: V1.00
S/N: 801001536
License(s): GDB, FlashBP
VTref=3.298V


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


Connecting to target via SWD
InitTarget() start
InitTarget()
InitTarget() end
InitTarget() end
Found SW-DP with ID 0x2BA01477
DPIDR: 0x2BA01477
Scanning AP map to find all available APs
AP[2]: Stopped AP scan as end of AP map seems to be reached
AP[0]: AHB-AP (IDR: 0x24770011)
AP[1]: AHB-AP (IDR: 0x74770001)
Iterating through AP map to find AHB-AP to use
AP[0]: Core found
AP[0]: AHB-AP ROM base: 0x41003000
CPUID register: 0x410FC241. Implementer code: 0x41 (ARM)
Found Cortex-M4 r0p1, Little endian.
FPUnit: 6 code (BP) slots and 2 literal slots
CoreSight components:
ROMTbl[0] @ 41003000
ROMTbl[0][0]: E00FF000, CID: B105100D, PID: 000BB4C4 ROM Table
ROMTbl[1] @ E00FF000
ROMTbl[1][0]: E000E000, CID: B105E00D, PID: 000BB00C SCS-M7
ROMTbl[1][1]: E0001000, CID: B105E00D, PID: 003BB002 DWT
ROMTbl[1][2]: E0002000, CID: B105E00D, PID: 002BB003 FPB
ROMTbl[1][3]: E0000000, CID: B105E00D, PID: 003BB001 ITM
ROMTbl[1][4]: E0040000, CID: B105900D, PID: 000BB9A1 TPIU
ROMTbl[1][5]: E0041000, CID: B105900D, PID: 000BB925 ETM
ROMTbl[1][6]: E0042000, CID: B105900D, PID: 003BB907 ETB
Cortex-M4 identified.
J-Link>

User avatar
maddy0812
 
Posts: 7
Joined: Tue Apr 06, 2021 7:45 pm

Re: Grand Central M4. Not able to flash using jlink

Post by maddy0812 »

pic1.jpg
pic1.jpg (540.45 KiB) Viewed 421 times
Here you go!. I am suspecting that the board might be defective?

User avatar
adafruit_support_carter
 
Posts: 29168
Joined: Tue Nov 29, 2016 2:45 pm

Re: Grand Central M4. Not able to flash using jlink

Post by adafruit_support_carter »

That also looks OK. Try just disconnecting everything and then reconnecting again and see if that helps. It could be as simple as a cable issue.

The board is working OK otherwise, right? For running CircuitPython, etc?

Is that another Metro board in the photo? Or - do you have another board you could connect to with the jlink to help verify that part of the hardware setup?

User avatar
maddy0812
 
Posts: 7
Joined: Tue Apr 06, 2021 7:45 pm

Re: Grand Central M4. Not able to flash using jlink

Post by maddy0812 »

I tested the jlink on a robotdyne samd21 board that my friend has, it that worked seamlessly. Have been connecting/reconnecting, trying different microusb wires/usb ports, for the past 2 days. circuit pythong works when i tried a basic blink example. but i am unable to flash to board and program my custom code.

User avatar
adafruit2
 
Posts: 22148
Joined: Fri Mar 11, 2005 7:36 pm

Re: Grand Central M4. Not able to flash using jlink

Post by adafruit2 »

does atmel studio work? if you can connect to the chip at all, the chip is fine.

User avatar
maddy0812
 
Posts: 7
Joined: Tue Apr 06, 2021 7:45 pm

Re: Grand Central M4. Not able to flash using jlink

Post by maddy0812 »

as soon as i click try to read the device signature in atmel studio. it just hangs. the jlink logs show that its repeating the thea same 'Mass erase done!' commands when i click read. So the chip is unresponsive even with atmel studio. my suspicion is that the debug ports are busted.
"

User avatar
adafruit2
 
Posts: 22148
Joined: Fri Mar 11, 2005 7:36 pm

Re: Grand Central M4. Not able to flash using jlink

Post by adafruit2 »

take a screenshot and post of atmel studio after detecting the voltage

User avatar
maddy0812
 
Posts: 7
Joined: Tue Apr 06, 2021 7:45 pm

Re: Grand Central M4. Not able to flash using jlink

Post by maddy0812 »

pic2.JPG
pic2.JPG (84.57 KiB) Viewed 394 times
This is what i get when i click on read voltage. After clicking on waiting for 5 mins, the voltage column populates, all the while, the jlink log in the web control panel prints the same "Mass erase done"

WHen i go to the memories tab and click erase chip, i get the following
pic3.JPG
pic3.JPG (90.08 KiB) Viewed 394 times
Here is the log printed in the jlink web control panel

Code: Select all

DLL Compiled: Apr  8 2021 14:30:05
Logging started @ 2021-04-15 19:12
T0744 354:854.092   SEGGER J-Link V7.00 Log File
T0744 354:854.195   DLL Compiled: Apr  8 2021 14:30:05
T0744 354:854.227   Logging started @ 2021-04-15 19:12
T0744 354:854.256 - 47.384ms
T0744 354:854.293 JLINK_ExecCommand("device = ATSAMD51P20A", ...). 
T0744 354:856.036   Device "ATSAMD51P20" selected.
T0744 354:856.697 - 2.395ms returns 0x00
T0744 354:856.742 JLINK_GetHWStatus(...)
T0744 354:857.258 - 0.540ms returns 0
T0744 354:857.301 JLINK_ClrRESET()
T0744 354:858.477 - 1.204ms
T0744 354:864.060 JLINK_SetRESET()
T0744 354:864.476 - 0.443ms
T0744 354:870.062 JLINK_ClrRESET()
T0744 354:870.961 - 0.925ms
T0744 354:875.067 JLINK_ClrTCK()
T0744 354:875.439 - 0.398ms returns 0
T0744 354:883.064 JLINK_SetRESET()
T0744 354:883.531 - 0.481ms
T0744 354:888.065 JLINK_Clock()
T0744 354:888.747 - 0.697ms returns 0
T0744 354:894.081 JLINK_TIF_Select(JLINKARM_TIF_SWD)
T0744 354:895.914 - 1.850ms returns 0x00
T0744 354:895.943 JLINK_SetSpeed(50)
T0744 354:896.349 - 0.422ms
T0744 354:896.376 JLINK_CORESIGHT_Configure()
T0744 355:029.362 - 133.023ms returns 0
T0744 355:029.458 JLINK_CORESIGHT_WriteAPDPReg(DP reg 0x02, 0x00000000)
T0744 355:041.450 - 12.013ms returns -1

and read device signature does not work at all.It says this when i click on read device signature
Timestamp: 2021-04-15 12:19:51.121
Severity: ERROR
ComponentId: 20100
StatusCode: 1
ModuleName: TCF (TCF command: Device:startSession failed.)

Error connecting to device over SWD

User avatar
adafruit2
 
Posts: 22148
Joined: Fri Mar 11, 2005 7:36 pm

Re: Grand Central M4. Not able to flash using jlink

Post by adafruit2 »

thats is quite weird! did you try updating the firmware of the jlink?

User avatar
maddy0812
 
Posts: 7
Joined: Tue Apr 06, 2021 7:45 pm

Re: Grand Central M4. Not able to flash using jlink

Post by maddy0812 »

Thats the first thing that happened as soon as i connected the jlink. checked multiple times that the firmware is uptodate.

User avatar
adafruit2
 
Posts: 22148
Joined: Fri Mar 11, 2005 7:36 pm

Re: Grand Central M4. Not able to flash using jlink

Post by adafruit2 »

welp, not sure what it is but we can try to replace. email support@adafruit with a link to get a new grand central
if it STILL doesnt work, its something with the jlink because we use SWD to program the boards...so its not that

User avatar
westfw
 
Posts: 2008
Joined: Fri Apr 27, 2007 1:01 pm

Re: Grand Central M4. Not able to flash using jlink

Post by westfw »

Executing default behavior previously saved in the registry.
What does that mean? I didn’t see it in the Adafruit log...

Locked
Please be positive and constructive with your questions and comments.

Return to “Metro, Metro Express, and Grand Central Boards”