alternating programming failures; cannot erase second half of flash

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

  • alternating programming failures; cannot erase second half of flash

    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
  • Hi,

    according to the errata, the flash of the AT91FR40162S is not
    fully CFI-compliant (in contrast to what is mentioned in the user manual)
    and will not be supported by J-Flash.
    Atmel has changed this with the SB-version, so they claim the new device
    to be fully CFI-compliant.

    Best regards
    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.
  • I was able to make everything work by expanding the initialization sequence in the J-Flash ARM project to emulate the flash memory set up and memory remap sequence (moving RAM to address 0) used in our start up code.

    I had hoped that it would be enough to just reset the ARM in the J-Flash initialization sequence. This was the default when I created a new "project". But apparently not. This would have minimized the technical understanding needed to use J-Flash effectively.

    The board I have available to me has the older AT91FR40162S device on it. New versions of the board do indeed use the AT91FR40162SB device. Do you think this would be unnecessary with that device? Is it normally necessary to go beyond just a reset in the initialization sequence?

    We are considering Flasher ARM programmers in production. Do you know if the initialization sequence gets downloaded into the Flasher ARM? And the start address for RAM and flash? Is there any significant information in the J-Flash ARM project that is not downloaded?

    Thanks for any answers you can provide.
  • Hi,

    >> I was able to make everything work by expanding the initialization sequence in the J-Flash ARM project to emulate
    >> the flash memory set up and memory remap sequence (moving RAM to address 0) used in our start up code.
    Would it be possible to post your J-Flash project?

    >>The board I have available to me has the older AT91FR40162S device on it. New versions of the board do indeed use the AT91FR40162SB device.
    >>Do you think this would be unnecessary with that device? Is it normally necessary to go beyond just a reset in the initialization sequence?
    For the AT91FR40162SB no init sequence should be necessary since this device is fully-CFI compliant according to Atmel and no EBI has to be setup.
    But in most cases when programming external flash, an init sequence is necessary since the EBI/EMI of the CPU/MCU has to be setup.

    We are considering Flasher ARM programmers in production. Do you know if the initialization sequence gets downloaded into the Flasher ARM? And the start address for RAM and flash? Is there any significant information in the J-Flash ARM project that is not downloaded?
    Of course this information is downloaded to Flasher ARM if you select "File->Download to programmer"
    No, there is not any significant information in the J-Flash project which is not downloaded but needed by Flasher ARM.


    Best regards
    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.
  • >> I was able to make everything work by expanding the initialization sequence in the
    >> J-Flash ARM project to emulate the flash memory set up and memory remap sequence
    >> (moving RAM to address 0) used in our start up code.
    >
    > Would it be possible to post your J-Flash project?

    Here it is:

    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
    InitStep10_Action = "Write 32bit"
    InitStep10_Comment = ""
    InitStep10_Value0 = 0xFFE00024
    InitStep10_Value1 = 0x00000006
    InitStep1_Action = "Write 32bit"
    InitStep1_Comment = ""
    InitStep1_Value0 = 0xFFE00000
    InitStep1_Value1 = 0x01002525
    InitStep2_Action = "Write 32bit"
    InitStep2_Comment = ""
    InitStep2_Value0 = 0xFFE00004
    InitStep2_Value1 = 0x10000000
    InitStep3_Action = "Write 32bit"
    InitStep3_Comment = ""
    InitStep3_Value0 = 0xFFE00008
    InitStep3_Value1 = 0x20000000
    InitStep4_Action = "Write 32bit"
    InitStep4_Comment = ""
    InitStep4_Value0 = 0xFFE0000C
    InitStep4_Value1 = 0x30000000
    InitStep5_Action = "Write 32bit"
    InitStep5_Comment = ""
    InitStep5_Value0 = 0xFFE00010
    InitStep5_Value1 = 0x40000000
    InitStep6_Action = "Write 32bit"
    InitStep6_Comment = ""
    InitStep6_Value0 = 0xFFE00014
    InitStep6_Value1 = 0x50000000
    InitStep7_Action = "Write 32bit"
    InitStep7_Comment = ""
    InitStep7_Value0 = 0xFFE00018
    InitStep7_Value1 = 0x60000000
    InitStep8_Action = "Write 32bit"
    InitStep8_Comment = ""
    InitStep8_Value0 = 0xFFE0001C
    InitStep8_Value1 = 0x70000000
    InitStep9_Action = "Write 32bit"
    InitStep9_Comment = ""
    InitStep9_Value0 = 0xFFE00020
    InitStep9_Value1 = 0x00000001
    NumInitSteps = 11
    RAMAddr = 0x00000000
    RAMSize = 0x00018000
    UseAutoSpeed = 0x00000001
    UseRAM = 1
    [FLASH]
    aSectorSel[0] =
    AutoDetect = 1
    BankName = ""
    BankSelMode = 1
    BaseAddr = 0x01000000
    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