Is it possible to program the image .bin files into the external flash(W25Q128) connected to the nRF54L15 using a J-Link debugger?

Hello Team,

I have added the LittleFS file system for the external flash and am able to program the .bin files through code by keeping the bitmap array within the application.

Now, I am trying to load the image .bin files directly into the W25Q128 flash IC, which is connected to the nRF54L15, using a J-Link.
Is there any way to achieve this?

working way in code :

const uint8_t Logo_Bitmap[]={0xFF,0xFF.....................................................0xFF};

fsWrite("Logo.bin", Logo_Bitmap,sizeof(Logo_Bitmap));

Regards,
Karthik B.

Parents Reply Children
  • Yes. However, converting a bin file to a intel hex file is normally not a problem, and can be done for instance using Python with the intelhex package (see bin2hex).

  • Hi Einar,

    I tried to program the external Flash it seems programmed but actually it programmed internal Flash .


    [00:00:35] ###### 100% [2/3 261007391] Failed, Device error: Address range 0x0017d000..0x00180c00 is outside the memory ranges defined for programmPS E:\GCE\Documents\ZL_LCD_Display\nrf\poc_refresh> nrfutil device --x-ext-mem-config-file spi_ext_mem_config.json program --firmware Logo.hex --opPS E:\GCE\Documents\ZL_LCD_Display\nrf\poc_refresh> nrfutil device --x-ext-mem-config-file spi_ext_mem_config.json program --firmware Logo.hex --options ext_mem_erase_mode=ERASE_ALL --serial-number 261007391


     We’re trying to program and read the external flash using the nrfutil device --x-ext-mem-config-file command. However, it appears that the tool is still accessing the internal flash instead of the external SPI flash. After executing the external flash programming command, our main application stops running, and memory reads from both internal and external commands return identical data.




    Below is the detailed description

     //json content 
    
    {
      "firmware_config": {
        "peripheral": "SPIM00"
      },
      "pins": {
        "sck": 65,
        "csn": 69,
        "io0": 66,
        "io1": 68,
        "io2": 4294967295,
        "io3": 4294967295
      },
      "flash_size": 16777216,
      "page_size": 4096,
      "sck_frequency": 8000000,
      "address_mode": "MODE24BIT"
    }
     
    //W25Q128 ovelay
    
    
    &spi00 {
        status = "okay";
        compatible = "nordic,nrf-spim";
        pinctrl-0 = <&spi00_default>;
        pinctrl-1 = <&spi00_sleep>;
        pinctrl-names = "default", "sleep";
        cs-gpios = <&gpio2 5 GPIO_ACTIVE_LOW>; // controller CS = P2.5
    
        w25q128: w25q128@0 {
            status = "okay";
            compatible = "jedec,spi-nor";
            reg = <0>;                /* CS 0 (matches controller cs-gpios) */
            label = "W25Q128";
            spi-max-frequency = <DT_FREQ_M(32)>; /* 8 MHz */
            jedec-id = [ef 40 18];/* explicit JEDEC for Winbond W25Q128 */
            size = <0x8000000>;    
            has-dpd;
            t-enter-dpd = <10000>;
            t-exit-dpd  = <30000>;
        };
    };
    
    &pinctrl {
        spi00_default: spi00_default {
            group1 {
                psels = <NRF_PSEL(SPIM_SCK, 2, 1)>,
                        <NRF_PSEL(SPIM_MOSI, 2, 2)>,
                        <NRF_PSEL(SPIM_MISO, 2, 4)>;
            };
        };
    
        spi00_sleep: spi00_sleep {
            group1 {
                psels = <NRF_PSEL(SPIM_SCK, 2, 1)>,
                        <NRF_PSEL(SPIM_MOSI, 2, 2)>,
                        <NRF_PSEL(SPIM_MISO, 2, 4)>;
                low-power-enable;
            };
        };
    };


    Before using the flash write command below:

    nrfutil device --x-ext-mem-config-file spi_ext_mem_config.json program --firmware build/Logo_h.hex --options ext_mem_erase_mode=ERASE_ALL --serial-number 261007391

     

    I noticed that this command actually writes to the internal flash of the nRF54L15 instead of the external SPI flash.
    After running this command, our application no longer runs — it seems the internal flash contents (including the vector table) are overwritten.

    When I run both of the following commands, I get the same data output, which suggests that both are reading from the internal flash instead of differentiating between internal and external memory:

    Command 1 – supposed to read external flash:


    nrfutil device --x-ext-mem-config-file spi_ext_mem_config.json read --address 0x00 --bytes 17000 --serial-number 261007391


    Command 2 – supposed to read internal flash:
    nrfutil device read --address 0x00 --bytes 17000 --serial-number 261007391



    But both commands return identical data.

    It looks like --x-ext-mem-config-file is not directing nrfutil to access the external flash as expected.

     

    Can you point out if I am making any mistake in this ?


    Regards,
    karthik




  • Hi karthik,

    How did you convert the bin file to a hex file? As mentioned under Requierments, the addressin the hex file must correctly reference the address space of the external flash (see also Memory addressing in the HEX file).

    Br,

    Einar

  • Hi Einar,

    Thank you for pointing this .
    I am using the intel bin2hex  as you suggested . sorry I missed Memory addressing in the HEX file and assigned different address .
    Let me assign the 0x10000000 as a start address for nrf54l15  and update you .

Related