[SOLVED] Loadbin not working on ATSAMR21E19A

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

  • [SOLVED] Loadbin not working on ATSAMR21E19A

    Hello,

    I'm unable to use loadbin on an ATSAMR21E19A. I'm able to manually write and read memory but not using loadbin.
    Logs:

    Source Code

    1. C:\Users\x\Desktop>"C:\Program Files (x86)\SEGGER\JLink_V641a\JLink.exe" -Log log.txt
    2. SEGGER J-Link Commander V6.41a (Compiled Nov 27 2018 14:10:26)
    3. DLL version V6.41a, compiled Nov 27 2018 14:09:51
    4. Connecting to J-Link via USB...O.K.
    5. Firmware: J-Link V10 compiled Nov 23 2018 11:20:54
    6. Hardware version: V10.10
    7. S/N: 260105781
    8. License(s): FlashBP, GDB
    9. OEM: SEGGER-EDU
    10. VTref=3.322V
    11. Type "connect" to establish a target connection, '?' for help
    12. J-Link>connect
    13. Please specify device / core. <Default>: ATSAMR21E19
    14. Type '?' for selection dialog
    15. Device>
    16. Please specify target interface:
    17. J) JTAG (Default)
    18. S) SWD
    19. T) cJTAG
    20. TIF>S
    21. Specify target interface speed [kHz]. <Default>: 4000 kHz
    22. Speed>
    23. Device "ATSAMR21E19" selected.
    24. Connecting to target via SWD
    25. InitTarget()
    26. Found SW-DP with ID 0x0BC11477
    27. Scanning AP map to find all available APs
    28. AP[1]: Stopped AP scan as end of AP map has been reached
    29. AP[0]: AHB-AP (IDR: 0x04770031)
    30. Iterating through AP map to find AHB-AP to use
    31. AP[0]: Core found
    32. AP[0]: AHB-AP ROM base: 0x41003000
    33. CPUID register: 0x410CC601. Implementer code: 0x41 (ARM)
    34. Found Cortex-M0 r0p1, Little endian.
    35. FPUnit: 4 code (BP) slots and 0 literal slots
    36. CoreSight components:
    37. ROMTbl[0] @ 41003000
    38. ROMTbl[0][0]: E00FF000, CID: B105100D, PID: 000BB4C0 ROM Table
    39. ROMTbl[1] @ E00FF000
    40. ROMTbl[1][0]: E000E000, CID: B105E00D, PID: 000BB008 SCS
    41. ROMTbl[1][1]: E0001000, CID: B105E00D, PID: 000BB00A DWT
    42. ROMTbl[1][2]: E0002000, CID: B105E00D, PID: 000BB00B FPB
    43. ROMTbl[0][1]: 41006000, CID: B105900D, PID: 001BB932 MTB-M0+
    44. Cortex-M0 identified.
    45. J-Link>mem 0x0 0x12
    46. 00000000 = FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
    47. 00000010 = FF FF
    48. J-Link>w1 0x0 0x12
    49. Writing 12 -> 00000000
    50. J-Link>mem 0x0 0x12
    51. 00000000 = 12 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
    52. 00000010 = FF FF
    53. J-Link>loadbin C:\Users\x\Desktop\Demo.bin 0x0
    54. Downloading file [C:\Users\x\Desktop\ZLLDemo.bin]...
    55. Error while programming flash: Programming failed.
    Display All




    Brainfuck Source Code

    1. T1BA4 000:000 SEGGER J-Link V6.41a (beta) Log File (0000ms, 0000ms total)
    2. T1BA4 000:000 DLL Compiled: Nov 27 2018 14:09:51 (0000ms, 0000ms total)
    3. T1BA4 000:000 Logging started @ 2019-02-15 12:08 (0000ms, 0000ms total)
    4. T1BA4 000:000 JLINK_SelectUSB(Port = 0) returns 0x00 (0000ms, 0000ms total)
    5. T1BA4 000:000 JLINK_SetWarnOutHandler(...) (0000ms, 0000ms total)
    6. T1BA4 000:000 JLINK_OpenEx(...)
    7. Firmware: J-Link V10 compiled Nov 23 2018 11:20:54
    8. Hardware: V10.10
    9. S/N: 260105781
    10. OEM: SEGGER-EDU
    11. Feature(s): FlashBP, GDB
    12. TELNET listener socket opened on port 19021WEBSRV
    13. Starting webserver (0034ms, 0034ms total)
    14. T1BA4 000:000 WEBSRV Webserver running on local port 19080 (0034ms, 0034ms total)
    15. T1BA4 000:000 returns O.K. (0034ms, 0034ms total)
    16. T1BA4 000:034 JLINK_GetFirmwareString(...) (0000ms, 0034ms total)
    17. T1BA4 000:034 JLINK_GetHardwareVersion() returns 0x18A88 (0000ms, 0034ms total)
    18. T1BA4 000:035 JLINK_EMU_HasCapEx(0x00000026) returns 0x00 (0000ms, 0034ms total)
    19. T1BA4 000:035 JLINK_EMU_GetProductId() (0000ms, 0034ms total)
    20. T1BA4 000:035 JLINK_GetHardwareVersion() returns 0x18A88 (0000ms, 0034ms total)
    21. T1BA4 000:035 JLINK_GetFirmwareString(...) (0000ms, 0034ms total)
    22. T1BA4 000:035 JLINK_GetEmuCaps() returns 0xB9FF7BBF (0000ms, 0034ms total)
    23. T1BA4 000:035 JLINK_GetEmuCaps() returns 0xB9FF7BBF (0000ms, 0034ms total)
    24. T1BA4 000:035 JLINK_GetHWStatus(...) returns 0x00 (0000ms, 0034ms total)
    25. T1BA4 000:035 JLINK_EMU_HasCapEx(0x00000044) returns 0x01 (0000ms, 0034ms total)
    26. T1BA4 000:035 JLINK_ReadEmuConfigMem(..., Off = 0x9A, NumBytes = 0x01) returns 0x00 (0000ms, 0034ms total)
    27. T1BA4 003:411 JLINK_Api_MRU_GetList()JLINK_DEVICE_GetIndex(sDeviceName = ATSAMR21E19)XML file found at: C:\Program Files (x86)\SEGGER\JLink_V641a\JLinkDevices.xml (0001ms, 0038ms total)
    28. T1BA4 004:746 C:\Program Files (x86)\SEGGER\JLink_V641a\JLinkDevices.xml evaluated successfully. returns 527 (0100ms, 0137ms total)
    29. T1BA4 004:846 JLINK_DEVICE_GetInfo(DeviceIndex = 527) returns 0 (0000ms, 0137ms total)
    30. T1BA4 006:943 JLINK_ExecCommand("device=ATSAMR21E19", ...). Device "ATSAMR21E19" selected. returns 0x00 (0003ms, 0140ms total)
    31. T1BA4 006:946 JLINK_EnableLog(...) (0000ms, 0140ms total)
    32. T1BA4 006:947 JLINK_GetEmuCaps() returns 0xB9FF7BBF (0000ms, 0140ms total)
    33. T1BA4 006:947 JLINK_TIF_GetAvailable(...) (0001ms, 0141ms total)
    34. T1BA4 006:948 JLINK_TIF_Select(JLINKARM_TIF_SWD) returns 0x00 (0001ms, 0142ms total)
    35. T1BA4 006:949 JLINK_SetSpeed(4000) (0000ms, 0142ms total)
    36. T1BA4 006:949 JLINK_Connect()InitTarget() >0x10B TIF>Found SW-DP with ID 0x0BC11477 >0x0D TIF> >0x28 TIF> >0x0D TIF> >0x28 TIF> >0x0D TIF> >0x28 TIF> >0x0D TIF> >0x28 TIF> >0x0D TIF> >0x21 TIF> >0x0D TIF> >0x28 TIF>Scanning AP map to find all available APs >0x0D TIF> >0x28 TIF> >0x0D TIF> >0x21 TIF> >0x0D TIF> >0x21 TIF> >0x0D TIF> >0x28 TIF> >0x0D TIF> >0x21 TIF> >0x0D TIF> >0x21 TIF>AP[1]: Stopped AP scan as end of AP map has been reachedAP[0]: AHB-AP (IDR: 0x04770031)
    37. Iterating through AP map to find AHB-AP to use >0x42 TIF> >0x28 TIF> >0x0D TIF> >0x28 TIF> >0x0D TIF> >0x21 TIF> >0x0D TIF> >0x21 TIF> >0x42 TIF> >0x28 TIF> >0x0D TIF> >0x28 TIF> >0x0D TIF> >0x28 TIF> >0x0D TIF> >0x21 TIF> >0x0D TIF> >0x21 TIF>AP[0]: Core foundAP[0]: AHB-AP ROM base: 0x41003000 >0x0D TIF> >0x28 TIF> >0x0D TIF> >0x28 TIF> >0x0D TIF> >0x28 TIF> >0x0D TIF> >0x21 TIF> >0x0D TIF> >0x21 TIF>CPUID register: 0x410CC601. Implementer code: 0x41 (ARM)Found Cortex-M0 r0p1, Little endian.
    38. -- Max. mem block: 0x00003478 -- CPU_ReadMem(4 bytes @ 0xE000EDF0) -- CPU_WriteMem(4 bytes @ 0xE000EDF0) -- CPU_ReadMem(4 bytes @ 0xE0002000)FPUnit: 4 code (BP) slots and 0 literal slots -- CPU_ReadMem(4 bytes @ 0xE000EDFC) -- CPU_WriteMem(4 bytes @ 0xE000EDFC) -- CPU_ReadMem(4 bytes @ 0xE0001000) -- CPU_WriteMem(4 bytes @ 0xE0001000)CoreSight components:ROMTbl[0] @ 41003000 -- CPU_ReadMem(16 bytes @ 0x41003000) -- CPU_ReadMem(16 bytes @ 0xE00FFFF0) -- CPU_ReadMem(16 bytes @ 0xE00FFFE0)
    39. ROMTbl[0][0]: E00FF000, CID: B105100D, PID: 000BB4C0 ROM TableROMTbl[1] @ E00FF000 -- CPU_ReadMem(16 bytes @ 0xE00FF000) -- CPU_ReadMem(16 bytes @ 0xE000EFF0) -- CPU_ReadMem(16 bytes @ 0xE000EFE0)ROMTbl[1][0]: E000E000, CID: B105E00D, PID: 000BB008 SCS -- CPU_ReadMem(16 bytes @ 0xE0001FF0) -- CPU_ReadMem(16 bytes @ 0xE0001FE0)ROMTbl[1][1]: E0001000, CID: B105E00D, PID: 000BB00A DWT -- CPU_ReadMem(16 bytes @ 0xE0002FF0) -- CPU_ReadMem(16 bytes @ 0xE0002FE0)
    40. ROMTbl[1][2]: E0002000, CID: B105E00D, PID: 000BB00B FPB -- CPU_ReadMem(16 bytes @ 0x41006FF0) -- CPU_ReadMem(16 bytes @ 0x41006FE0)ROMTbl[0][1]: 41006000, CID: B105900D, PID: 001BB932 MTB-M0+ returns 0x00 (0138ms, 0280ms total)
    41. T1BA4 007:087 JLINK_GetIdData(...) >0x0D TIF> >0x21 TIF> ScanLen=4 NumDevices=1 aId[0]=0x0BC11477 aIrRead[0]=0 aScanLen[0]=0 aScanRead[0]=0 (0001ms, 0281ms total)
    42. T1BA4 007:088 JLINK_GetMemZones(...) returns 0 (0000ms, 0281ms total)
    43. T1BA4 007:088 JLINK_CORE_GetFound() returns 0x60000FF (0000ms, 0281ms total)
    44. T1BA4 014:037 JLINK_ReadMem (0x00000000, 0x0012 Bytes, ...) -- CPU_ReadMem(18 bytes @ 0x00000000) - Data: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF ... returns 0x00 (0001ms, 0282ms total)
    45. T1BA4 039:012 JLINK_WriteU8(0x00000000, 0x00000012) returns 0 (0000ms, 0282ms total)
    46. T1BA4 046:472 JLINK_ReadMem (0x00000000, 0x0012 Bytes, ...) -- CPU_ReadMem(18 bytes @ 0x00000000) - Data: 12 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF ... returns 0x00 (0001ms, 0283ms total)
    47. T1BA4 078:624 JLINK_IsHalted() returns TRUE (0003ms, 0286ms total)
    48. T1BA4 078:628 JLINK_DownloadFile()JLINK_BeginDownload(Flags = 0x00) (0001ms, 0284ms total)
    49. T1BA4 078:628 JLINK_WriteMem(0x00000000, 0x3B358 Bytes, ...) - Data: 30 72 00 20 C5 09 03 00 00 00 00 00 1D F9 02 00 ... -- Read from flash cache (242520 bytes @ 0x00000000) returns 0x3B358 (0004ms, 0287ms total)
    50. T1BA4 078:628 JLINK_EndDownload() -- CPU_ReadMem(16 bytes @ 0x41006FE0) -- CPU_ReadMem(4 bytes @ 0x41006004) -- CPU_ReadMem(4 bytes @ 0xE000ED90) -- -------------------------------------- -- Start of determining dirty areas in flash cache -- End of determining dirty areas -- Start of preparing flash programming -- Calculating RAM usage -- RAM usage = 5876 Bytes -- Preserving CPU registers -- Preparing memory -- Preparing target -- Downloading RAMCode -- Checking target RAM -- Preparing RAMCode
    51. -- End of preparing flash programming -- CPU speed could not be measured. -- Start of comparing flash -- CRC check was estimated as fastest method -- Comparing range 0x0000 - 0xFFFF (256 Sectors, 64 KB), using multi-block CRC calculation -- CRC does not match for sectors 0-255 -- Comparing range 0x10000 - 0x1FFFF (256 Sectors, 64 KB), using multi-block CRC calculation -- CRC does not match for sectors 0-255 -- Comparing range 0x20000 - 0x2FFFF (256 Sectors, 64 KB), using multi-block CRC calculation
    52. -- CRC does not match for sectors 0-255 -- Comparing range 0x30000 - 0x3B3FF (180 Sectors, 45 KB), using multi-block CRC calculation -- CRC does not match for sectors 0-179 -- End of comparing flash -- Start of erasing sectors -- End of erasing sectors -- Start of flash programming -- Programming range 0x00000000 - 0x00007FFF (128 Sectors, 32 KB)
    53. ***** Error: Programming failed @ address 0x00000000 (block verification error) -- End of flash programming -- Start of restoring -- Restoring RAMCode
    54. -- Restore target -- Restore memory -- Restoring CPU registers -- End of restoringRestarting due to program error (possibly skipped erasure of half-way erased sector). (0611ms, 0894ms total)
    55. T1BA4 078:628 Skip optimizations disabled for second try. (0611ms, 0894ms total)
    56. T1BA4 078:628 -- -------------------------------------- returns -3 (0611ms, 0894ms total)
    57. T1BA4 078:628 returns 0xFFFFFEF6 (0612ms, 0895ms total)
    Display All
    Binary was compiled using Atmel Studio 7 and also flashing directly from Atmel Studio does not work.

    Thanks!