Configuration to write external flash memory using nrfutil tool

I'm setting up a script we will use at production time to write some data to an external flash module connected via SPI to a nRF54H20.

I used the following as reference document https://docs.nordicsemi.com/r/bundle/nrfutil/page/nrfutil-device/guides/programming_external_memory.html?tocId=VZmfjI%7E3lJLxXfQxc5L%7E7g

I am passing the following JSON to nrfutil 2.19.0 (i used the structure passed in the example for nRF54L15 in the page above)

{
    "firmware_config": {
        "peripheral": "EXMIF"
    },
    "pins": {
        "csn": 195,
        "io0": 199,
        "io1": 197,
        "io2": 202,
        "io3": 201,
        "sck": 192
    },
    "flash_size": 8388608,
    "page_size": 4096,
    "sck_frequency": 6400000,
    "address_mode": "MODE24BIT"
}

and i get the error

Device error: Failed to load the external flash config: Configuration file parsing failed: missing field `reset` at line 12 column 5 (Generic)

Is it possible to have the expected JSON structure or a link where to find it?

Thanks,

Alessio

Parents Reply Children
  • Hi Kenneth, thanks for your reply.

    I tried to add "reset" and i kept getting errors about missing fields. I added all of them and this is the new content of the JSON config file, added most of the missing fields as 0

    {
        "firmware_config": {
            "peripheral": "EXMIF"
        },
        "pins": {
            "csn": 195,
            "io0": 199,
            "io1": 197,
            "io2": 202,
            "io3": 201,
            "sck": 192,
            "reset": 204,
            "read_write_data_strobe": 0,
            "io4": 0,
            "io5": 0,
            "io6": 0,
            "io7": 0
        },
        "flash_size": 33554432,
        "page_size": 4096,
        "sck_frequency": 8000000,
        "address_mode": "MODE32BIT",
        "io_pin_impedance": 0
    }

    I was also reading about the offset the .hex file should have to be flashed in the external flash. From what i could find the base address should be 0x60000000 as that's the base address of the xip_region. Could you confirm if that's correct? I can also share the part of dts that defines the node for the external flash we have in our custom board if that helps.

    After the changes the script actually runs but now it fails with the following error:
    Device error: Erase command failed, firmware source line: 146, status code: 116 (Generic)

    What does the error mean? 

    Thanks,
    Alessio

  • Hi,

    I got help from a colleague, here is his feedback.

    This configuration file should work with the nrf54h20 DK: 

    {
    "firmware_config": {
       "peripheral""EXMIF",
       "compress": true
     },
    "pins": {
       "sck": 192,
       "csn": 195,
       "reset": 204,
       "read_write_data_strobe": 4294967295,
       "io0": 199,
       "io1": 197,
       "io2": 4294967295,
       "io3": 4294967295,
       "io4": 4294967295,
       "io5": 4294967295,
       "io6": 4294967295,
       "io7": 4294967295
     },
    "flash_size": 8388608,
    "sck_frequency": 4000000,
    "address_mode""MODE24BIT",
    "page_size": 4096,
    "io_pin_impedance": 63
    }

    The number 4294967295 = 0xffffffff which means that the pin is not used. The current support EXMIF support in nrfutil uses the EXMIF in normal SPI mode (ie. only one dataline in both directions), which in turn mens that io2 -> io7. The reset pin and read_write_data_strobe is currently implemented in the same way as the reset and write protect pins for SPIM, of defined they will be held high during programming. The "io_pin_impedance" setting is a direct write to the IMPEDANCEnn bits in the PORTCNF.DRIVECTRL register, 63 = 0x3F, means that all 5 lower bits are set.

    Hope that helps,
    Kenneth

  • Hi Kenneth,
    I updated the configuration to match the one you shared and now i can successfully write the external flash.

    Thanks for the help,
    Alessio

Related