ATSAM4LC8C failing to program flash memory

Discussion around product based on ARM Cortex M4 core.

Moderators: nferre, ncollot

ajmilford
Posts: 4
Joined: Tue Aug 19, 2014 5:31 pm

ATSAM4LC8C failing to program flash memory

Tue Aug 19, 2014 5:39 pm

We have our own target board with ATSAM4LC8C processor

We can connect to board via Segger JLINK JTAG but we are unable to program the flash from Atmel Studio.
I have tried using the Device Programmer of Atmel Studio and also doing a build and debug, and in both cases it fails to program the flash, yet it finds the CPU correctly. Part of the JLINK.LOG file is below.

We have checked the obvious, voltage on VDDIN, VCORE, crystal oscillating on X0IN of 12 MHz. No crystal on X32IN.

Any suggestions?


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)
ajmilford
Posts: 4
Joined: Tue Aug 19, 2014 5:31 pm

Re: ATSAM4LC8C failing to program flash memory

Tue Aug 19, 2014 5:57 pm

I am also unable to change/program any of the Fuses to anything different to the default (Lock0 locked, Lock1 to Lock15 unlocked)
ajmilford
Posts: 4
Joined: Tue Aug 19, 2014 5:31 pm

Re: ATSAM4LC8C failing to program flash memory

Tue Aug 19, 2014 5:58 pm

Just noticed, the above jlink.log was attempting to program at flash address 0x0000. The log is similar when attempting to program at 0x4000, outside of the SAM-BA region
ajmilford
Posts: 4
Joined: Tue Aug 19, 2014 5:31 pm

Re: ATSAM4LC8C failing to program flash memory

Tue Sep 09, 2014 3:34 pm

Fixed issue:

Had to connect Vdd to the VLCDIN pin on the device

Return to “SAM4 Cortex-M4 MCU”

Who is online

Users browsing this forum: No registered users and 1 guest