How to use JFlash to flash an nRF52840

Hello,

I am developing a solution based on nrf52-DK, using nRF52840.

I have a .hex file produced by the R&D team

So far I can flash successfully the board  with : 

  • drag-and-drop the .hex file to the virtual disk presented by the board on USB
  • JLink (command is "JLink.exe -device nRF52840_xxAA -if SWD -speed 4000 -AutoConnect 1 -CommandFile script_flashing.jlink"
  • nrfjprog.exe  (command is "nrfjprog.exe -f NRF52 --program firmware.hex --chiperase --verify"

but for production reasons, and in order to use later on programmers like Flasher PRO from SEGGER, I would like to use JFlash.exe 

So far it programs only 32K bytes, then falls in timeout error

Here is the command I am using : "JFlash.exe -openprj nRF52840_trial.jflash -open firmware.hex  -jflashlogC:\tmp\jflash.log -auto -exit"

It fails, and the end of the logfile contains this : 

- Start of flash programming
- Programming range 0x00000000 - 0x00007FFF ( 8 Sectors, 32 KB)
- Programming range 0x00008000 - 0x0000FFFF ( 8 Sectors, 32 KB)
- Programming range 0x00010000 - 0x00017FFF ( 8 Sectors, 32 KB)
- Programming range 0x00018000 - 0x0001FFFF ( 8 Sectors, 32 KB)
- ERROR: Timeout while programming sector, RAMCode did not respond in time (PC = 0x00000A64, XPSR = 0x61000003, SP = 0x20000550)!
- End of flash programming
- ERROR: Program failed
- Start of restoring
- End of restoring
- ERROR: Failed to auto program target
J-Flash V8.10a Error: Timeout while programming sector, RAMCode did not respond in time (PC = 0x00000A64, XPSR = 0x61000003, SP = 0x20000550)!
Program failed
Failed to auto program target
Disconnecting ...
- Disconnected

Would you please have any advice to solve this ? or to identify what I am doing wrong ?

In the JFLash  GUI, I selected device "nRF52840_XXAA" 

Thanks for your help.

Parents
  • Hi,

    Could you verify in J-Flash that you "Program the entire chip" ?

    Also, please try lowering the SWD speed. I see that you are using around 4000 for J-link, but maybe try using around 1000-2000 and check.

    You can also first try flashing a smaller hex file and verify if it works.

    Regards,

    Priyanka

  • could you provide me a nrf52840.jflash that allows to flash a nRF52840 ?

    I made one with JFlash / New project, and selecting type nRF52840_xxAA

    Here is the file I got : 
    -----------------------------------------------------------------
      AppVersion = 81001
      FileVersion = 2
    [GENERAL]
      aATEModuleSel[24] = 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
      ConnectMode = 0
      CurrentFile = ""
      DataFileSAddr = 0x00000000
      GUIMode = 0
      HostName = ""
      TargetIF = 1
      USBPort = 0
      USBSerialNo = 0x00000000
      UseATEModuleSelection = 0
    [JTAG]
      IRLen = 0
      MultipleTargets = 0
      NumDevices = 0
      Speed0 = 1000
      Speed1 = 1000
      TAP_Number = 0
      UseAdaptive0 = 0
      UseAdaptive1 = 0
      UseMaxSpeed0 = 0
      UseMaxSpeed1 = 0
    [CPU]
      NumInitSteps = 1
      InitStep0_Action = "Reset"
      InitStep0_Value0 = 0x00000000
      InitStep0_Value1 = 0x00000000
      InitStep0_Comment = "Reset and halt target"
      NumExitSteps = 0
      UseScriptFile = 0
      ScriptFile = ""
      RAMAddr = 0x20000000
      RAMSize = 0x00040000
      CheckCoreID = 1
      CoreID = 0x4BA00477
      CoreIDMask = 0x0F000FFF
      UseAutoSpeed = 0x00000001
      ClockSpeed = 0x00000000
      EndianMode = 0
      ChipName = "Nordic Semi nRF52840_xxAA"
    [FLASH]
      aRangeSel[1] = 0-256
      BankName = "Internal flash"
      BankSelMode = 1
      BaseAddr = 0x00000000
      NumBanks = 1
    [PRODUCTION]
      AutoPerformsDisconnect = 0
      AutoPerformsErase = 1
      AutoPerformsProgram = 1
      AutoPerformsSecure = 0
      AutoPerformsStartApp = 0
      AutoPerformsVerify = 1
      EnableFixedVTref = 0
      EnableTargetPower = 0
      EraseType = 1
      FixedVTref = 0x00000CE4
      MonitorVTref = 0
      MonitorVTrefMax = 0x0000157C
      MonitorVTrefMin = 0x000003E8
      OverrideTimeouts = 0
      ProgramSN = 0
      SerialFile = ""
      SNAddr = 0x00000000
      SNInc = 0x00000001
      SNLen = 0x00000004
      SNListFile = ""
      SNValue = 0x00000001
      StartAppType = 0
      TargetPowerDelay = 0x00000014
      TimeoutErase = 0x00003A98
      TimeoutProgram = 0x00002710
      TimeoutVerify = 0x00002710
      VerifyType = 1
    [PERFORMANCE]
      DisableSkipBlankDataOnProgram = 0x00000000
      PerfromBlankCheckPriorEraseChip = 0x00000001
      PerfromBlankCheckPriorEraseSelectedSectors = 0x00000001
    -----------------------------------------------------------------

Reply
  • could you provide me a nrf52840.jflash that allows to flash a nRF52840 ?

    I made one with JFlash / New project, and selecting type nRF52840_xxAA

    Here is the file I got : 
    -----------------------------------------------------------------
      AppVersion = 81001
      FileVersion = 2
    [GENERAL]
      aATEModuleSel[24] = 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
      ConnectMode = 0
      CurrentFile = ""
      DataFileSAddr = 0x00000000
      GUIMode = 0
      HostName = ""
      TargetIF = 1
      USBPort = 0
      USBSerialNo = 0x00000000
      UseATEModuleSelection = 0
    [JTAG]
      IRLen = 0
      MultipleTargets = 0
      NumDevices = 0
      Speed0 = 1000
      Speed1 = 1000
      TAP_Number = 0
      UseAdaptive0 = 0
      UseAdaptive1 = 0
      UseMaxSpeed0 = 0
      UseMaxSpeed1 = 0
    [CPU]
      NumInitSteps = 1
      InitStep0_Action = "Reset"
      InitStep0_Value0 = 0x00000000
      InitStep0_Value1 = 0x00000000
      InitStep0_Comment = "Reset and halt target"
      NumExitSteps = 0
      UseScriptFile = 0
      ScriptFile = ""
      RAMAddr = 0x20000000
      RAMSize = 0x00040000
      CheckCoreID = 1
      CoreID = 0x4BA00477
      CoreIDMask = 0x0F000FFF
      UseAutoSpeed = 0x00000001
      ClockSpeed = 0x00000000
      EndianMode = 0
      ChipName = "Nordic Semi nRF52840_xxAA"
    [FLASH]
      aRangeSel[1] = 0-256
      BankName = "Internal flash"
      BankSelMode = 1
      BaseAddr = 0x00000000
      NumBanks = 1
    [PRODUCTION]
      AutoPerformsDisconnect = 0
      AutoPerformsErase = 1
      AutoPerformsProgram = 1
      AutoPerformsSecure = 0
      AutoPerformsStartApp = 0
      AutoPerformsVerify = 1
      EnableFixedVTref = 0
      EnableTargetPower = 0
      EraseType = 1
      FixedVTref = 0x00000CE4
      MonitorVTref = 0
      MonitorVTrefMax = 0x0000157C
      MonitorVTrefMin = 0x000003E8
      OverrideTimeouts = 0
      ProgramSN = 0
      SerialFile = ""
      SNAddr = 0x00000000
      SNInc = 0x00000001
      SNLen = 0x00000004
      SNListFile = ""
      SNValue = 0x00000001
      StartAppType = 0
      TargetPowerDelay = 0x00000014
      TimeoutErase = 0x00003A98
      TimeoutProgram = 0x00002710
      TimeoutVerify = 0x00002710
      VerifyType = 1
    [PERFORMANCE]
      DisableSkipBlankDataOnProgram = 0x00000000
      PerfromBlankCheckPriorEraseChip = 0x00000001
      PerfromBlankCheckPriorEraseSelectedSectors = 0x00000001
    -----------------------------------------------------------------

Children
Related