I am using a SAM-ICE with J-Flash ARM to program an Atmel AT91FR40162S device.
When I use the GUI (no command line options), the first attempt to program always fails. Subsequent attempts succeed. When I use a .bat file to start J-Flash ARM with command line options to auto program, failures and successes alternate.
Also, if I try to erase the entire flash, it fails after erasing the first half of the flash.
Below, I have pasted in J-Flash ARM log contents for each scenario, as well the command and project file I use to run J-Flash ARM with command line arguments.
== successful attempt to program ===
Application log started
- J-Flash ARM V4.14e (J-Flash compiled Jun 30 2010 14:37:31)
- JLinkARM.dll V4.14e (DLL compiled Jun 30 2010 14:36:44)
Reading flash device list [C:\Program Files\SEGGER\JLinkARM_V414e\ETC\JFlash\Flash.csv] ...
- List of flash devices read successfully (684 Devices)
Reading MCU device list [C:\Program Files\SEGGER\JLinkARM_V414e\ETC\JFlash\MCU.csv] ...
- List of MCU devices read successfully (544 Devices)
Opening project file [eroscanpro.jflash] ...
- Project opened successfully
Opening data file [..\firmware\ARM.hex] ...
- Data file opened successfully (204253 bytes, 2 ranges, CRC = 0x00000000)
Close project
- Project closed
Opening project file [eroscanpro.jflash] ...
- Project opened successfully
Auto programming target (204253 bytes, 2 ranges) ...
- Connecting ...
- Connected successfully
- Erasing affected sectors ...
- Erasing sector 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
- Erase operation completed successfully
- Programming target (204253 bytes, 2 ranges) ...
- Target programmed successfully
- Verifying CRC of affected sectors ...
- CRC of affected sectors verified successfully (CRC = 0x4F8DEB5D)
- Target erased, programmed and verified successfully - Completed after 6.991 sec
=== failed attempt to program ===
Application log started
- J-Flash ARM V4.14e (J-Flash compiled Jun 30 2010 14:37:31)
- JLinkARM.dll V4.14e (DLL compiled Jun 30 2010 14:36:44)
Reading flash device list [C:\Program Files\SEGGER\JLinkARM_V414e\ETC\JFlash\Flash.csv] ...
- List of flash devices read successfully (684 Devices)
Reading MCU device list [C:\Program Files\SEGGER\JLinkARM_V414e\ETC\JFlash\MCU.csv] ...
- List of MCU devices read successfully (544 Devices)
Opening project file [eroscanpro.jflash] ...
- Project opened successfully
Opening data file [..\firmware\ARM.hex] ...
- Data file opened successfully (204253 bytes, 2 ranges, CRC = 0x00000000)
Close project
- Project closed
Opening project file [eroscanpro.jflash] ...
- Project opened successfully
Auto programming target (204253 bytes, 2 ranges) ...
- Connecting ...
- Connected successfully
- Erasing affected sectors ...
- Erasing sector 0
- ERROR: Programming failed @ address 0x00000000 (item verification error)
- ERROR: Failed to erase sectors
- ERROR: Failed to auto program target
Disconnecting ...
- Disconnected
=== attempt to erase all sectors ===
Erasing selected sectors ...
- Connecting ...
- Connected successfully
- 39 of 39 sectors selected, 1 range, 0x0 - 0x1FFFFF
- RAM tested O.K.
- Erasing sector 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 23
- ERROR: Data abort occurred while programming.
---------------------------------------------------------------------- Registers -------------------------------------------------------------------------------------
PC = 00000010
CPSR = 000000D7 (ABORT mode, ARM, FIQ dis., IRQ dis.)
Current: R0 = 003002A4, R1 = 00100000, R2 = 00008000, R3 = 00000000
R4 = 00000000, R5 = 0000A0A0, R6 = 00005554, R7 = 00005555
USR: R8 = 00000000, R9 = 00000000, R10 = 00000000, R11 = 00000000, R12 = 00000000
R13 = 00300280, R14 = 003000E5
FIQ: R8 = 00000000, R9 = 00000000, R10 = 00000000, R11 = 00000000, R12 = 00000000
R13 = 00000000, R14 = 00000000, SPSR = 00000010
SVC: R13 = 00000000, R14 = 00000000, SPSR = 00000010
ABT: R13 = 00000000, R14 = 00300180, SPSR = 000000FF
IRQ: R13 = 00000000, R14 = 00000000, SPSR = 00000010
UND: R13 = 00000000, R14 = 00000000, SPSR = 00000010
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- ERROR: Failed to erase sectors
Disconnecting ...
- Disconnected
=== command to start J-Flash ARM
JFlashARM.exe -openprjeroscanpro.jflash -auto
I close the window manually (no -exit) so that I get to see messages.
=== the project file ===
AppVersion = 41405
[GENERAL]
ConnectMode = 0
CurrentFile = "..\firmware\ARM.hex"
DataFileSAddr = 0x00000000
GUIMode = 0
HostName = ""
TargetIF = 0
USBPort = 0
USBSerialNo = 0x00000000
[JTAG]
IRLen = 0
MultipleTargets = 0
NumDevices = 0
Speed0 = 5
Speed1 = 4000
TAP_Number = 0
UseAdaptive0 = 0
UseAdaptive1 = 0
UseMaxSpeed0 = 0
UseMaxSpeed1 = 1
[CPU]
CheckCoreID = 0
ChipName = "Analog ADuC7020x62"
ClockSpeed = 0x00000000
Core = 0xFFFFFFFF
CoreID = 0x00000000
DeviceFamily = 0x00000000
EndianMode = 0
HasInternalFlash = 0
InitStep0_Action = "Reset"
InitStep0_Comment = "Reset and halt target"
InitStep0_Value0 = 0x00000000
InitStep0_Value1 = 0x00000000
NumInitSteps = 1
RAMAddr = 0x00300000
RAMSize = 0x00018000
UseAutoSpeed = 0x00000001
UseRAM = 1
[FLASH]
aSectorSel[0] =
AutoDetect = 1
BankName = ""
BankSelMode = 1
BaseAddr = 0x00000000
CheckId = 3
CustomRAMCode = ""
DeviceName = "Auto detected flash memory"
EndBank = 8191
NumBanks = 1
OrgNumBits = 16
OrgNumChips = 1
StartBank = 0
UseCustomRAMCode = 0
[PRODUCTION]
AutoPerformsErase = 1
AutoPerformsHardLock = 0
AutoPerformsHardUnlock = 0
AutoPerformsProgram = 1
AutoPerformsSecure = 0
AutoPerformsSoftLock = 0
AutoPerformsSoftUnlock = 1
AutoPerformsStartApp = 0
AutoPerformsUnsecure = 0
AutoPerformsVerify = 1
Delay = 0x000001F4
EraseType = 2
ProgramSN = 0
SNAddr = 0x00000000
SNInc = 0x00000001
Threshold = 0x00000BB8
VerifyType = 1
When I use the GUI (no command line options), the first attempt to program always fails. Subsequent attempts succeed. When I use a .bat file to start J-Flash ARM with command line options to auto program, failures and successes alternate.
Also, if I try to erase the entire flash, it fails after erasing the first half of the flash.
Below, I have pasted in J-Flash ARM log contents for each scenario, as well the command and project file I use to run J-Flash ARM with command line arguments.
== successful attempt to program ===
Application log started
- J-Flash ARM V4.14e (J-Flash compiled Jun 30 2010 14:37:31)
- JLinkARM.dll V4.14e (DLL compiled Jun 30 2010 14:36:44)
Reading flash device list [C:\Program Files\SEGGER\JLinkARM_V414e\ETC\JFlash\Flash.csv] ...
- List of flash devices read successfully (684 Devices)
Reading MCU device list [C:\Program Files\SEGGER\JLinkARM_V414e\ETC\JFlash\MCU.csv] ...
- List of MCU devices read successfully (544 Devices)
Opening project file [eroscanpro.jflash] ...
- Project opened successfully
Opening data file [..\firmware\ARM.hex] ...
- Data file opened successfully (204253 bytes, 2 ranges, CRC = 0x00000000)
Close project
- Project closed
Opening project file [eroscanpro.jflash] ...
- Project opened successfully
Auto programming target (204253 bytes, 2 ranges) ...
- Connecting ...
- Connected successfully
- Erasing affected sectors ...
- Erasing sector 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
- Erase operation completed successfully
- Programming target (204253 bytes, 2 ranges) ...
- Target programmed successfully
- Verifying CRC of affected sectors ...
- CRC of affected sectors verified successfully (CRC = 0x4F8DEB5D)
- Target erased, programmed and verified successfully - Completed after 6.991 sec
=== failed attempt to program ===
Application log started
- J-Flash ARM V4.14e (J-Flash compiled Jun 30 2010 14:37:31)
- JLinkARM.dll V4.14e (DLL compiled Jun 30 2010 14:36:44)
Reading flash device list [C:\Program Files\SEGGER\JLinkARM_V414e\ETC\JFlash\Flash.csv] ...
- List of flash devices read successfully (684 Devices)
Reading MCU device list [C:\Program Files\SEGGER\JLinkARM_V414e\ETC\JFlash\MCU.csv] ...
- List of MCU devices read successfully (544 Devices)
Opening project file [eroscanpro.jflash] ...
- Project opened successfully
Opening data file [..\firmware\ARM.hex] ...
- Data file opened successfully (204253 bytes, 2 ranges, CRC = 0x00000000)
Close project
- Project closed
Opening project file [eroscanpro.jflash] ...
- Project opened successfully
Auto programming target (204253 bytes, 2 ranges) ...
- Connecting ...
- Connected successfully
- Erasing affected sectors ...
- Erasing sector 0
- ERROR: Programming failed @ address 0x00000000 (item verification error)
- ERROR: Failed to erase sectors
- ERROR: Failed to auto program target
Disconnecting ...
- Disconnected
=== attempt to erase all sectors ===
Erasing selected sectors ...
- Connecting ...
- Connected successfully
- 39 of 39 sectors selected, 1 range, 0x0 - 0x1FFFFF
- RAM tested O.K.
- Erasing sector 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 23
- ERROR: Data abort occurred while programming.
---------------------------------------------------------------------- Registers -------------------------------------------------------------------------------------
PC = 00000010
CPSR = 000000D7 (ABORT mode, ARM, FIQ dis., IRQ dis.)
Current: R0 = 003002A4, R1 = 00100000, R2 = 00008000, R3 = 00000000
R4 = 00000000, R5 = 0000A0A0, R6 = 00005554, R7 = 00005555
USR: R8 = 00000000, R9 = 00000000, R10 = 00000000, R11 = 00000000, R12 = 00000000
R13 = 00300280, R14 = 003000E5
FIQ: R8 = 00000000, R9 = 00000000, R10 = 00000000, R11 = 00000000, R12 = 00000000
R13 = 00000000, R14 = 00000000, SPSR = 00000010
SVC: R13 = 00000000, R14 = 00000000, SPSR = 00000010
ABT: R13 = 00000000, R14 = 00300180, SPSR = 000000FF
IRQ: R13 = 00000000, R14 = 00000000, SPSR = 00000010
UND: R13 = 00000000, R14 = 00000000, SPSR = 00000010
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- ERROR: Failed to erase sectors
Disconnecting ...
- Disconnected
=== command to start J-Flash ARM
JFlashARM.exe -openprjeroscanpro.jflash -auto
I close the window manually (no -exit) so that I get to see messages.
=== the project file ===
AppVersion = 41405
[GENERAL]
ConnectMode = 0
CurrentFile = "..\firmware\ARM.hex"
DataFileSAddr = 0x00000000
GUIMode = 0
HostName = ""
TargetIF = 0
USBPort = 0
USBSerialNo = 0x00000000
[JTAG]
IRLen = 0
MultipleTargets = 0
NumDevices = 0
Speed0 = 5
Speed1 = 4000
TAP_Number = 0
UseAdaptive0 = 0
UseAdaptive1 = 0
UseMaxSpeed0 = 0
UseMaxSpeed1 = 1
[CPU]
CheckCoreID = 0
ChipName = "Analog ADuC7020x62"
ClockSpeed = 0x00000000
Core = 0xFFFFFFFF
CoreID = 0x00000000
DeviceFamily = 0x00000000
EndianMode = 0
HasInternalFlash = 0
InitStep0_Action = "Reset"
InitStep0_Comment = "Reset and halt target"
InitStep0_Value0 = 0x00000000
InitStep0_Value1 = 0x00000000
NumInitSteps = 1
RAMAddr = 0x00300000
RAMSize = 0x00018000
UseAutoSpeed = 0x00000001
UseRAM = 1
[FLASH]
aSectorSel[0] =
AutoDetect = 1
BankName = ""
BankSelMode = 1
BaseAddr = 0x00000000
CheckId = 3
CustomRAMCode = ""
DeviceName = "Auto detected flash memory"
EndBank = 8191
NumBanks = 1
OrgNumBits = 16
OrgNumChips = 1
StartBank = 0
UseCustomRAMCode = 0
[PRODUCTION]
AutoPerformsErase = 1
AutoPerformsHardLock = 0
AutoPerformsHardUnlock = 0
AutoPerformsProgram = 1
AutoPerformsSecure = 0
AutoPerformsSoftLock = 0
AutoPerformsSoftUnlock = 1
AutoPerformsStartApp = 0
AutoPerformsUnsecure = 0
AutoPerformsVerify = 1
Delay = 0x000001F4
EraseType = 2
ProgramSN = 0
SNAddr = 0x00000000
SNInc = 0x00000001
Threshold = 0x00000BB8
VerifyType = 1