JLINK and Atmel ATSAM4LC8C

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

  • JLINK and Atmel ATSAM4LC8C

    We have our in-house hardware design using the ATSAM4LC8C processor

    JLINK is failing to detect the processor via JTAG


    In Jlink commander at the 'i' command I get the response:


    J-Link>i
    Info: TotalIRLen = 0, IRPrint = 0x00
    Info: TotalIRLen = 0, IRPrint = 0x00
    Info: TotalIRLen = 0, IRPrint = 0x00

    ****** Error: AT91SAM4L (connect): Failed. Could not identify device.
    JTAG Id: 0x00000000: INVALID
    J-Link>


    We have checked the physical connections of TCK, TDI, TMS, TDO, RESET and we can see activity on these lines on an oscilloscope.
    We have not connected TRST.
    Also using the JTAG-Hardware commands in JLINK we have toggled these lines to verify connection of TCK, TMS, TDI, RESET

    Any suggestions why Jlink is failing to detect the processor?

    Thanks
  • Hi,

    Good to hear that it is working now.
    Seems the SAM4L series is tricky regarding hardware. We have seen multiple support requests for this CPU and almost all of them were hardware related.


    - Alex
    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.
  • We have hit another problem on this

    We are using Atmel Studio

    When I set breakpoints in Atmel Studio the processor fails to stop when the breakpoint is reached.
    I tried setting a breakpoint right at the start of main() and it does not stop at that point.

    I noted earlier we have connected TCK, TDI, TMS, TDO, RESET
    But somewhere I read about connecting nTRST, but the Atmel documents all show this as not being connected. Is it needed for debug/breakpoint operation?
  • Hi,

    But somewhere I read about connecting nTRST, but the Atmel documents all show this as not being connected. Is it needed for debug/breakpoint operation?

    No, it is not necessary.

    Do you have optimizations for GCC enabled in Atmel Studio?
    We have seen problems with placing breakpoints on certain code lines when having optimizations enabled.
    It seems that sometimes Atmel Studio no longer places breakpoints correctly, in case code optimization is on.


    - Alex
    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.
  • Finally back on to this project again!

    Started with a fresh project in Atmel Studio. Based on one of the ASF projects. All compiles OK.

    JLINK connects to target board OK.

    But when I try to debug and run it fails to program the flash on the target processor.

    Here is part content of jlink.log file if it helps....(had to truncate due to posting limit of 10000 characters!)

    Any ideas why we can connect OK but not program the flash?



    T0598 4003:169 SEGGER J-Link V4.84c Log File (0000ms, 9334ms total)
    T0598 4003:169 DLL Compiled: Apr 16 2014 18:53:07 (0000ms, 9334ms total)
    T0598 4003:169 Logging started @ 2014-08-19 14:24 (0000ms, 9334ms total)
    T0598 4003:192 JLINK_ExecCommand("Device = ATSAM4LC8C", ...)Device "ATSAM4LC8C" selected (512 KB flash, 64 KB RAM). returns 0x00 (0000ms, 9334ms total)
    T0598 4003:192 JLINK_GetFirmwareString(...) (0000ms, 9334ms total)
    T0598 4003:192 JLINK_GetHardwareVersion() returns 0x13880 (0000ms, 9334ms total)
    T0598 4003:192 JLINK_GetDLLVersion() returns 48403 (0000ms, 9334ms total)
    T0598 4003:194 JLINK_GetFirmwareString(...) (0000ms, 9334ms total)
    T0598 4003:194 JLINK_GetHardwareVersion() returns 0x13880 (0000ms, 9334ms total)
    T0598 4003:194 JLINK_GetDLLVersion() returns 48403 (0000ms, 9334ms total)
    T0598 4003:252 JLINK_ExecCommand("ProjectFile = C:\Users\andrew.milford\Documents\Atmel Studio\6.2\IOPORT_EXAMPLE11\IOPORT_EXAMPLE11\jlink.config", ...) returns 0x00 (0000ms, 9334ms total)
    T0598 4003:272 JLINK_ExecCommand("Device = ATSAM4LC8C", ...)Device "ATSAM4LC8C" selected (512 KB flash, 64 KB RAM). returns 0x00 (0000ms, 9334ms total)
    T0598 4003:272 JLINK_TIF_Select(JLINKARM_TIF_JTAG) returns 0x00 (0003ms, 9337ms total)
    T0598 4003:275 JLINK_GetIdData(...) >0x2F8 JTAG>TotalIRLen = 4, IRPrint = 0x01 >0x30 JTAG> >0x210 JTAG> >0x40 JTAG> >0x40 JTAG> >0x40 JTAG> >0x30 JTAG> >0x40 JTAG> >0x40 JTAG> >0x40 JTAG> >0x40 JTAG> >0x2F8 JTAG>TotalIRLen = 4, IRPrint = 0x01 >0x30 JTAG> >0x210 JTAG> >0x70 JTAG> >0x40 JTAG> >0x40 JTAG> >0x40 JTAG> >0x48 JTAG> >0x78 JTAG> >0x40 JTAG> >0x30 JTAG> >0x40 JTAG> >0x40 JTAG> >0x30 JTAG> >0x40 JTAG> >0x48 JTAG>Found Cortex-M4 r0p1, Little endian. -- CPU_WriteMem(4 bytes @ 0xE0002000)
    -- CPU_ReadMem(4 bytes @ 0xE000EDF0) -- CPU_ReadMem(4 bytes @ 0xE0002000)FPUnit: 6 code (BP) slots and 2 literal slots -- CPU_ReadMem(4 bytes @ 0xE000EDFC) -- CPU_ReadMem(4 bytes @ 0xE0001000) -- CPU_WriteMem(4 bytes @ 0xE0001000) -- CPU_ReadMem(4 bytes @ 0xE00FF010)TPIU fitted. -- CPU_ReadMem(4 bytes @ 0xE00FF014) -- CPU_ReadMem(4 bytes @ 0xE00FF018) -- CPU is running -- CPU_ReadMem(4 bytes @ 0xE0042000) -- CPU is running -- CPU_ReadMem(4 bytes @ 0x400F0C00) ScanLen=4 NumDevices=1 aId[0]=0x4BA00477
    aIrRead[0]=0 aScanLen[0]=0 aScanRead[0]=0 (0041ms, 9378ms total)
    T0598 4003:316 JLINK_ConfigJTAG(IRPre = 0, DRPre = 0) (0000ms, 9378ms total)
    T0598 4003:316 JLINK_SetSpeed(0) >0x2F8 JTAG>TotalIRLen = 4, IRPrint = 0x01 >0x30 JTAG> >0x210 JTAG> >0x40 JTAG> >0x40 JTAG> >0x40 JTAG> >0x30 JTAG> >0x40 JTAG> >0x40 JTAG> >0x40 JTAG> >0x40 JTAG> >0x2F8 JTAG>TotalIRLen = 4, IRPrint = 0x01 >0x30 JTAG> >0x210 JTAG> >0x70 JTAG> >0x40 JTAG> >0x40 JTAG> >0x40 JTAG> >0x48 JTAG> >0x78 JTAG> >0x40 JTAG> >0x30 JTAG> >0x40 JTAG> >0x40 JTAG> >0x30 JTAG> >0x40 JTAG> >0x48 JTAG>Found Cortex-M4 r0p1, Little endian. -- CPU_WriteMem(4 bytes @ 0xE0002000)
    -- CPU_ReadMem(4 bytes @ 0xE000EDF0) -- CPU_ReadMem(4 bytes @ 0xE0002000)FPUnit: 6 code (BP) slots and 2 literal slots -- CPU_ReadMem(4 bytes @ 0xE000EDFC) -- CPU_ReadMem(4 bytes @ 0xE0001000) -- CPU_WriteMem(4 bytes @ 0xE0001000) -- CPU_ReadMem(4 bytes @ 0xE00FF010)TPIU fitted. -- CPU_ReadMem(4 bytes @ 0xE00FF014) -- CPU_ReadMem(4 bytes @ 0xE00FF018) -- CPU is running -- CPU_ReadMem(4 bytes @ 0xE0042000) -- CPU is running -- CPU_ReadMem(4 bytes @ 0x400F0C00) >0x30 JTAG> (0037ms, 9415ms total)
    T0598 4003:353 JLINK_Connect() >0x2F8 JTAG>TotalIRLen = 4, IRPrint = 0x01 >0x30 JTAG> >0x210 JTAG> >0x40 JTAG> >0x40 JTAG> >0x40 JTAG> >0x30 JTAG> >0x40 JTAG> >0x40 JTAG> >0x40 JTAG> >0x40 JTAG> >0x2F8 JTAG>TotalIRLen = 4, IRPrint = 0x01 >0x30 JTAG> >0x210 JTAG> >0x70 JTAG> >0x40 JTAG> >0x40 JTAG> >0x40 JTAG> >0x48 JTAG> >0x78 JTAG> >0x40 JTAG> >0x30 JTAG> >0x40 JTAG> >0x40 JTAG> >0x30 JTAG> >0x40 JTAG> >0x48 JTAG>Found Cortex-M4 r0p1, Little endian. -- CPU_WriteMem(4 bytes @ 0xE0002000)
    -- CPU_ReadMem(4 bytes @ 0xE000EDF0) -- CPU_ReadMem(4 bytes @ 0xE0002000)FPUnit: 6 code (BP) slots and 2 literal slots -- CPU_ReadMem(4 bytes @ 0xE000EDFC) -- CPU_ReadMem(4 bytes @ 0xE0001000) -- CPU_WriteMem(4 bytes @ 0xE0001000) -- CPU_ReadMem(4 bytes @ 0xE00FF010)TPIU fitted. -- CPU_ReadMem(4 bytes @ 0xE00FF014) -- CPU_ReadMem(4 bytes @ 0xE00FF018) -- CPU is running -- CPU_ReadMem(4 bytes @ 0xE0042000) -- CPU is running -- CPU_ReadMem(4 bytes @ 0x400F0C00) returns 0x00 (0029ms, 9444ms total)
    T0598 4003:382 JLINK_GetDebugInfo(0x100) -- Value=0xE00FF003 returns 0x00 (0001ms, 9445ms total)

    :
    :

    T0598 4003:493 JLINK_Reset() >0x2F8 JTAG>TotalIRLen = 4, IRPrint = 0x01 >0x30 JTAG> >0x210 JTAG> >0x40 JTAG> >0x40 JTAG> >0x30 JTAG> >0x40 JTAG> >0x40 JTAG> >0x40 JTAG> >0x40 JTAG> >0x40 JTAG> >0x40 JTAG> >0x30 JTAG> >0x40 JTAG> >0x30 JTAG> >0x40 JTAG> >0x30 JTAG> >0x40 JTAG> >0x30 JTAG> >0x30 JTAG> >0x40 JTAG> >0x40 JTAG> >0x40 JTAG> >0x40 JTAG> >0x40 JTAG> >0x40 JTAG> -- CPU is running -- CPU_ReadMem(4 bytes @ 0xE0042000) -- CPU is running -- CPU_WriteMem(4 bytes @ 0xE0042000) -- CPU is running
    -- CPU_ReadMem(4 bytes @ 0x400F0C00) -- CPU is running -- CPU_ReadMem(4 bytes @ 0x400F0800) -- CPU_WriteMem(4 bytes @ 0xE0002000) -- CPU_ReadMem(4 bytes @ 0xE000EDFC) -- CPU_ReadMem(4 bytes @ 0xE0001000) -- CPU_WriteMem(4 bytes @ 0xE0001000) (0085ms, 9639ms total)
    T0598 4003:578 JLINK_JTAG_GetDeviceID(DeviceIndex = 0) returns 0x4BA00477 (0000ms, 9639ms total)
    T0598 4003:578 JLINK_ReadMemU32(0x400E0740, 0x0001 Items, ...) -- CPU_ReadMem(4 bytes @ 0x400E0740) -- Data: E0 0A 0B AB returns 0x01 (0002ms, 9641ms total)
    T0598 4003:583 JLINK_ReadMemHW(0x00001000, 0x0200 Bytes, ...) -- CPU_ReadMem(512 bytes @ 0x00001000) -- Data: 03 28 50 D0 04 28 18 D0 05 28 32 D0 06 28 22 D0 ... returns 0x00 (0022ms, 9663ms total)
    T0598 4003:605 JLINK_ReadMemHW(0x00001400, 0x0200 Bytes, ...) -- CPU_ReadMem(512 bytes @ 0x00001400) -- Data: E0 76 20 77 A0 76 20 62 20 85 00 F0 BE F8 00 20 ... returns 0x00 (0022ms, 9685ms total)
    T0598 4003:628 JLINK_BeginDownload(Flags = 0x00) (0000ms, 9685ms total)
    T0598 4003:628 JLINK_WriteMem(0x00000000, 0x0200 Bytes, ...) -- Data: 90 14 00 20 41 0E 00 00 3D 0E 00 00 3D 0E 00 00 ... returns 0x200 (0000ms, 9685ms total)
    T0598 4003:628 JLINK_WriteMem(0x00000200, 0x0200 Bytes, ...) -- Data: 08 49 AF F3 00 80 08 48 03 68 13 B1 07 4B 03 B1 ... returns 0x200 (0000ms, 9685ms total)
    :
    :

    T0598 4003:628 JLINK_WriteMem(0x00001200, 0x0200 Bytes, ...) -- Data: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ... returns 0x200 (0000ms, 9685ms total)
    T0598 4003:628 JLINK_WriteMem(0x00001400, 0x0200 Bytes, ...) -- Data: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ... returns 0x200 (0000ms, 9685ms total)
    T0598 4003:657 JLINK_EndDownload() -- -------------------------------------- -- Start of determining dirty areas -- End of determining dirty areas -- Start of preparing flash programming -- Calculating RAM usage -- RAM usage = 2780 Bytes -- Preserving registers -- Preparing memory -- Determining CPU clock frequency -- CPU clock frequency: 119 kHz -- CPU frequency = 119 kHz -- Preparing target -- Downloading RAMCode -- Using alternate TurboMode RAMCode -- Checking target RAM -- Preparing RAMCode
    -- End of preparing flash programming -- CPU is running at 10000 kHz. -- Start of comparing flash -- CRC check was estimated as fastest method -- Comparing range 0x0000 - 0x15FF (11 Sectors, 5 KB), using multi-block CRC calculation -- CRC does not match for sectors 0-10 -- End of comparing flash -- Start of erasing sectors -- Erasing range 0x00000000 - 0x000015FF ( 11 Sectors, 5 KB) -- End of erasing sectors -- Start of flash programming -- Programming range 0x00000000 - 0x000015FF ( 11 Sectors, 5 KB)

    ***** Error: Programming failed @ address 0x00000000 (block verification error) -- End of flash programming -- Start of restoring -- Restore RAMCode -- Restore content of target memory -- Restore target -- Restore memory -- Restore content of registers -- End of restoring -- Total time needed: 0.214s (Prepare: 0.159s, Compare: 0.003s, Erase: 0.008s, Program: 0.007s, Verify: 0.000s, Restore: 0.034s) returns 0xFFFFFFFD (0217ms, 9902ms total)
    T0598 4003:877 JLINK_WriteVectorCatch(0x00000001) -- CPU_ReadMem(4 bytes @ 0xE000EDFC) -- CPU_WriteMem(4 bytes @ 0xE000EDFC) returns 0x00 (0002ms, 9904ms total)
    T0598 4003:879 JLINK_Reset() >0x2F8 JTAG>TotalIRLen = 4, IRPrint = 0x01 >0x30 JTAG> >0x210 JTAG> >0x40 JTAG> >0x40 JTAG> >0x30 JTAG> >0x40 JTAG> >0x40 JTAG> >0x40 JTAG> >0x40 JTAG> >0x40 JTAG> >0x40 JTAG> >0x30 JTAG> >0x40 JTAG> >0x30 JTAG> >0x40 JTAG> >0x30 JTAG> >0x40 JTAG> >0x30 JTAG> >0x30 JTAG> >0x40 JTAG> >0x40 JTAG> >0x40 JTAG> >0x40 JTAG> >0x40 JTAG> >0x40 JTAG> -- CPU_ReadMem(4 bytes @ 0xE0042000) -- CPU_WriteMem(4 bytes @ 0xE0042000) -- CPU_ReadMem(4 bytes @ 0x400F0C00)
    -- CPU_ReadMem(4 bytes @ 0x400F0800) -- CPU_WriteMem(4 bytes @ 0xE0002000) -- CPU_ReadMem(4 bytes @ 0xE000EDFC) -- CPU_ReadMem(4 bytes @ 0xE0001000) -- CPU_WriteMem(4 bytes @ 0xE0001000) (0086ms, 9990ms total)
    T0598 4003:965 JLINK_WriteVectorCatch(0x00000000) -- CPU_ReadMem(4 bytes @ 0xE000EDFC) returns 0x00 (0001ms, 9991ms total)
    T0598 4003:966 JLINK_Go() -- CPU_WriteMem(4 bytes @ 0xE0001004) (0003ms, 9994ms total)
    T0598 4003:972 JLINK_GetHWStatus(...) returns 0x00 (0001ms, 9995ms total)
    T0598 4006:754 JLINK_Close() >0x78 JTAG> >0x08 JTAG> (0004ms, 9999ms total)
    T0598 4006:754 (0004ms, 9999ms total)
    T0598 4006:754 Closed (0004ms, 9999ms total)
  • Bit more on this... read in document about SAM-BA (atmel.com/Images/Atmel-42051-S…lication-Note_AT03454.pdf) that the SAM-BA resides at flash address 0 and this area is locked so program should start at 0x4000. So modified linker script to compile at 0x4000 - but no joy:


    T0598 7512:448 JLINK_BeginDownload(Flags = 0x00) (0000ms, 12184ms total)
    T0598 7512:448 JLINK_WriteMem(0x00004000, 0x0200 Bytes, ...) -- Data: 90 14 00 20 41 4E 00 00 3D 4E 00 00 3D 4E 00 00 ... returns 0x200 (0000ms, 12184ms total)
    T0598 7512:448 JLINK_WriteMem(0x00004200, 0x0200 Bytes, ...) -- Data: 08 49 AF F3 00 80 08 48 03 68 13 B1 07 4B 03 B1 ... returns 0x200 (0000ms, 12184ms total)
    T0598 7512:448 JLINK_WriteMem(0x00004400, 0x0200 Bytes, ...) -- Data: 13 81 2F D8 A3 F5 80 33 98 42 00 F0 F2 80 14 D8 ... returns 0x200 (0000ms, 12184ms total)
    T0598 7512:448 JLINK_WriteMem(0x00004600, 0x0200 Bytes, ...) -- Data: 08 BD 06 20 3E 4B 98 47 08 BD 07 20 3C 4B 98 47 ... returns 0x200 (0000ms, 12184ms total)
    T0598 7512:448 JLINK_WriteMem(0x00004800, 0x0200 Bytes, ...) -- Data: FE 80 2F D8 A3 F5 80 33 98 42 00 F0 E4 80 14 D8 ... returns 0x200 (0000ms, 12184ms total)
    T0598 7512:448 JLINK_WriteMem(0x00004A00, 0x0200 Bytes, ...) -- Data: 40 4B 98 47 BC E0 0A 20 3E 4B 98 47 B8 E0 0B 20 ... returns 0x200 (0000ms, 12184ms total)
    T0598 7512:448 JLINK_WriteMem(0x00004C00, 0x0200 Bytes, ...) -- Data: ED 43 00 00 00 00 0F 40 80 A9 03 00 B1 4C 00 00 ... returns 0x200 (0000ms, 12184ms total)
    T0598 7512:448 JLINK_WriteMem(0x00004E00, 0x0200 Bytes, ...) -- Data: 01 20 38 BD 00 20 38 BD ED 43 00 00 19 4D 00 00 ... returns 0x200 (0000ms, 12184ms total)
    T0598 7512:448 JLINK_WriteMem(0x00005000, 0x0200 Bytes, ...) -- Data: C5 F8 88 90 D0 F8 88 11 A2 40 11 43 02 2E C0 F8 ... returns 0x200 (0000ms, 12184ms total)
    T0598 7512:448 JLINK_WriteMem(0x00005200, 0x0200 Bytes, ...) -- Data: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ... returns 0x200 (0000ms, 12184ms total)
    T0598 7512:448 JLINK_WriteMem(0x00005400, 0x0200 Bytes, ...) -- Data: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ... returns 0x200 (0000ms, 12184ms total)
    T0598 7512:464 JLINK_EndDownload() -- -------------------------------------- -- Start of determining dirty areas -- End of determining dirty areas -- Start of preparing flash programming -- Calculating RAM usage -- RAM usage = 2780 Bytes -- Preserving registers -- Preparing memory -- Determining CPU clock frequency -- CPU clock frequency: 119 kHz -- CPU frequency = 119 kHz -- Preparing target -- Downloading RAMCode -- Using alternate TurboMode RAMCode -- Checking target RAM -- Preparing RAMCode
    -- End of preparing flash programming -- CPU is running at 10000 kHz. -- Start of comparing flash -- CRC check was estimated as fastest method -- Comparing range 0x4000 - 0x55FF (11 Sectors, 5 KB), using multi-block CRC calculation -- CRC does not match for sectors 0-10 -- End of comparing flash -- Start of erasing sectors -- End of erasing sectors -- Start of flash programming -- Programming range 0x00004000 - 0x000055FF ( 11 Sectors, 5 KB)
    ***** Error:
    Programming failed @ address 0x00004000 (block verification error) -- End of flash programming -- Start of restoring -- Restore RAMCode -- Restore content of target memory -- Restore target -- Restore memory -- Restore content of registers -- End of restoring -- Total time needed: 0.211s (Prepare: 0.156s, Compare: 0.002s, Erase: 0.000s, Program: 0.013s, Verify: 0.000s, Restore: 0.038s) returns 0xFFFFFFFD (0214ms, 12398ms total)
  • Tried to program using JFLASH and it too fails. The log shows:


    Programming target (4096 bytes, 1 range) ...
    - Connecting ...
    - Connecting via USB to J-Link device 0
    - J-Link firmware: V1.20 (J-Link ARM V8 compiled Jul 17 2014 12:31:18)
    - Target interface speed: 5 kHz (Fixed)
    - Initializing CPU core (Init sequence) ...
    - Executing Reset (0, 0 ms)
    - Initialized successfully
    - Target interface speed: 4000 kHz (Auto)
    - J-Link found 1 JTAG device. Core ID: 0x4BA00477 (Cortex-M4)
    - Connected successfully
    - RAM tested O.K.
    - ERROR: Programming failed @ address 0x00004000 (block verification error)
    - ERROR: Failed to program target
    Disconnecting ...
    - Disconnected