This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Using nrfjprog to program the QSPI flash with XIP address in hex file

I am trying to flash a hex file with the XIP address offset into the QSPI flash(MX25U25645G) by nrifprog, the memrd command is working since I can read the data that the firmware wrote into it. However, when I use command - nrifprog --family nrf52 --program file.hex --qspisectorerase --log, it gave me this:

Parsing hex file.
Reading flash area to program to guarantee it is erased.
Initializing the QSPI peripheral.
Erasing external memory pages.
Erasing external memory pages.
Erasing external memory pages.
Erasing external memory pages.
Erasing external memory pages.
Erasing external memory pages.
Erasing external memory pages.
Erasing external memory pages.
Erasing external memory pages.
Erasing external memory pages.
Erasing external memory pages.
Uninitializing the QSPI peripheral.
Checking that the area to write is not protected.
Programming device.
Initializing the QSPI peripheral.
WARNING: An operation that can take up to several minutes is being executed.
WARNING: Please remain patient.
Uninitializing the QSPI peripheral.

When I read it back, it wrote 0 to first 255 bytes

0x131F0000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00   |................|
0x131F0010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00   |................|
0x131F0020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00   |................|
0x131F0030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00   |................|
0x131F0040: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00   |................|
0x131F0050: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00   |................|
0x131F0060: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00   |................|
0x131F0070: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00   |................|
0x131F0080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00   |................|
0x131F0090: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00   |................|
0x131F00A0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00   |................|
0x131F00B0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00   |................|
0x131F00C0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00   |................|
0x131F00D0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00   |................|
0x131F00E0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00   |................|
0x131F00F0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 FF   |................|
0x131F0100: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF   |................|
0x131F0110: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF   |................|
0x131F0120: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF   |................|
0x131F0130: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF   |................|
0x131F0140: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF   |................|
0x131F0150: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF   |................|
0x131F0160: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF   |................|
0x131F0170: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF   |................|
0x131F0180: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF   |................|
0x131F0190: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF   |................|
0x131F01A0: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF   |................|
0x131F01B0: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF   |................|
0x131F01C0: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF   |................|
0x131F01D0: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF   |................|
0x131F01E0: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF   |................|
0x131F01F0: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF   |................|
0x131F0200: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF   |................|
0x131F0210: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF   |................|
0x131F0220: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF   |................|
0x131F0230: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF   |................|
0x131F0240: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF   |................|
0x131F0250: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF   |................|
0x131F0260: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF   |................|
0x131F0270: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF   |................|
0x131F0280: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF   |................|
0x131F0290: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF   |................|
0x131F02A0: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF   |................|
0x131F02B0: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF   |................|
0x131F02C0: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF   |................|
0x131F02D0: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF   |................|
0x131F02E0: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF   |................|
0x131F02F0: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF   |................|
0x131F0300: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF   |................|
0x131F0310: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF   |................|
0x131F0320: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF   |................|
0x131F0330: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF   |................|
0x131F0340: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF   |................|
0x131F0350: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF   |................|
0x131F0360: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF   |................|
0x131F0370: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF   |................|
0x131F0380: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF   |................|
0x131F0390: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF   |................|
0x131F03A0: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF   |................|
0x131F03B0: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF   |................|
0x131F03C0: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF   |................|
0x131F03D0: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF   |................|
0x131F03E0: FF FF FF FF FF FF FF FF                           |........|

QspiDefault.ini

; nrfjprog.exe configuration file.

[DEFAULT_CONFIGURATION]
; Define the capacity of the flash memory device in bytes. Set to 0 if no external memory device is present in your board.
MemSize = 0x2000000

; Define the desired ReadMode. Valid options are FASTREAD, READ2O, READ2IO, READ4O and READ4IO
ReadMode = READ4IO

; Define the desired WriteMode. Valid options are PP, PP2O, PP4O and PP4IO
WriteMode = PP4IO

; Define the desired AddressMode. Valid options are BIT24 and BIT32
AddressMode = BIT32

; Define the desired Frequency. Valid options are M2, M4, M8, M16 and M32
Frequency = M16

; Define the desired SPI mode. Valid options are MODE0 and MODE3
SpiMode = MODE0

; Define the desired SckDelay. Valid options are in the range 0 to 255
SckDelay = 0x1

; Define the desired IO level for DIO2 and DIO3 during a custom instruction. Valid options are LEVEL_HIGH and LEVEL_LOW
CustomInstructionIO2Level = LEVEL_LOW
CustomInstructionIO3Level = LEVEL_HIGH

; Define the assigned pins for the QSPI peripheral. Valid options are those existing in your device
CSNPin = 17
CSNPort = 0
SCKPin = 19
SCKPort = 0
DIO0Pin = 20
DIO0Port = 0
DIO1Pin = 21
DIO1Port = 0
DIO2Pin = 22
DIO2Port = 0
DIO3Pin = 23
DIO3Port = 0

; Define the Index of the Write In Progress (WIP) bit in the status register. Valid options are in the range of 0 to 7.
WIPIndex = 0

; Define page size for commands. Valid sizes are PAGE256 and PAGE512.
PPSize = PAGE256

; Custom instructions to send to the external memory after initialization. Only used if --qspicustominit option is given in the call to nrfjprog. Format is
; instruction code plus data to send in between optional brakets. Numbers can be given in decimal, hex (starting with either 0x or 0X) and binary (starting
; with either 0b or 0B) formats. The custom instructions will be executed in the order found.
; This example includes two commands, first a WREN (WRite ENable) and then a WRSR (WRite Satus Register) enabling the Quad Operation and the High Performance
; mode for the MX25R6435F memory present in the nRF52840 DK.
InitializationCustomInstruction =  0x06
InitializationCustomInstruction =  0x01, [0x40, 0x2]

my start and end of hex file: addresses are all with offset 0x131F0000

:02000004131FC8
:10000000909A002001030000090300000B03000088
:100010000D0300000F0300001103000000000000AA
:1000200000000000000000000000000013030000BA
:100030001503000000000000170300001903000072
:100040001B0300001B030000BD1C00001B0300007D
:100050001B0300001B0300001B0300001B03000028
:100060001B0300001B0300001B0300001B03000018
:100070001B0300001B0300001B0300001B03000008
:10008000111D00001B0300001B0300001B030000E8

.

.

.

:10AE200054AC000000000404A03C00209C3C002026
:10AE30009F3C0020804D002084000000203D002029
:10AE4000183D0020203D00208858002018000000F8
:10AE50001102220113403C1B205004012009124B17
:10AE6000091B5F1220BA4008C1034EE00F09116CA4
:10AE7000DAFF0801182310AB23B0AA1A08081AB881
:10AE8000081AC8041AC0041AD0041AD8041AE00414
:10AE90001AE8041AF0041AF804111928118490D041
:08AEA000032B212B45394A1157
:00000001FF

my log is uploaded

log.log

Thanks!

Parents Reply Children
  • bootloader_dk_spi_address.hex7080.log.log

    QspiDefault.ini

    I just have the DK tested and I got the same result, the files are attached.

    nrfjprog -s 17935099 --program bootloader_dk_spi_address.hex --qspisectorerase --log

    Parsing hex file.
    Reading flash area to program to guarantee it is erased.
    Initializing the QSPI peripheral.
    Erasing external memory pages.
    Erasing external memory pages.
    Erasing external memory pages.
    Erasing external memory pages.
    Erasing external memory pages.
    Erasing external memory pages.
    Erasing external memory pages.
    Erasing external memory pages.
    Erasing external memory pages.
    Erasing external memory pages.
    Erasing external memory pages.
    Uninitializing the QSPI peripheral.
    Checking that the area to write is not protected.
    Programming device.
    Initializing the QSPI peripheral.
    WARNING: An operation that can take up to several minutes is being executed.
    WARNING: Please remain patient.
    Uninitializing the QSPI peripheral.


    nrfjprog -s 17935099 --memrd 0x12100000 --w 32 --n 2000

    0x12100000: 00000000 00000000 00000000 00000000   |................|
    0x12100010: 00000000 00000000 00000000 00000000   |................|
    0x12100020: 00000000 00000000 00000000 00000000   |................|
    0x12100030: 00000000 00000000 00000000 00000000   |................|
    0x12100040: 00000000 00000000 00000000 00000000   |................|
    0x12100050: 00000000 00000000 00000000 00000000   |................|
    0x12100060: 00000000 00000000 00000000 00000000   |................|
    0x12100070: 00000000 00000000 00000000 00000000   |................|
    0x12100080: 00000000 00000000 00000000 00000000   |................|
    0x12100090: 00000000 00000000 00000000 00000000   |................|
    0x121000A0: 00000000 00000000 00000000 00000000   |................|
    0x121000B0: 00000000 00000000 00000000 00000000   |................|
    0x121000C0: 00000000 00000000 00000000 00000000   |................|
    0x121000D0: 00000000 00000000 00000000 00000000   |................|
    0x121000E0: 00000000 00000000 00000000 00000000   |................|
    0x121000F0: 00000000 00000000 00000000 FF000000   |................|
    0x12100100: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF   |................|
    0x12100110: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF   |................|
    0x12100120: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF   |................|
    0x12100130: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF   |................|
    0x12100140: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF   |................|
    0x12100150: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF   |................|

  • Do you see the same flash content if you read QSPI to file using 'nrfjprog --readqspi <file>' command?

Related