QSPI Driver example sample code (ncs\v2.1.0\zephyr\samples\drivers\spi_flash) not working as expected.

Hi,

Our team is developing an application based on the nRF5340-DK - we are developing on the DK while our hardware is in transit. Our schematic largely follows the reference design for all necessary peripherals. Notably, we've used the same QSPI NOR flash series MX25R6435FM2IL0, and QSPI pinout connection same as mentioned in nRF5340 DK. our intention is to use this external flash as a firmware image storage to store other controller firmware binary.

I have used SPI Flash Sample(ncs\v2.1.0\zephyr\samples\drivers\spi_flash) code to store other controller fw image into QSPI NOT flash, I have tested this on first nRF5340DK board and in that it was working as expected, after that I had tried same code in our custom board but in that case have some issue in reading, flash_read API return success value but the read data was partially correct as per attached screenshot.

nRF Connect SDK version: 2.1.0

Let me know here for more details.

Thanks & Regards,

Kaushik Parsana

Parents
  • Hi,

     

    You are expecting to read "0x55 0xaa 0x66 0x99" but you are reading "0x11 0xaa 0x22 0x99".

    It looks like the flash erase did not successfully execute, as you can only change from bitwise '1' to bitwise '0' without erasing the current page.

    Could you try to issue a "nrfjprog --qspieraseall -f nrf53" with your custom board and then re-flash the spi_flash sample to see if this helps?

     

    Kind regards,

    Håkon

  • Hi Hakon,

    I have checked the command "nrfjprog --qspieraseall -f nrf53" with nrfjprog utility to erase complete flash before executing the program and after that I had debug same thing, but the result was same as before, please find the attached screen shot,

    It seems erase is not a problem here, even flash_erase API also return success value.

    Thanks& Regards,

    Kaushik Parsana

  • Hi,

     

    Could you try reducing the frequency?

    This can be done by creating my_project/boards/nrf5340dk_nrf5340_cpuapp.overlay containing the following:

    &qspi {
    	status = "okay";
    	mx25r64: mx25r6435f@0 {
    	    sck-frequency = <6000000>;
    	};
    };

    Note that your names wrt. the flash name can differ.

     

    Q1: Could you also share the schematic from nRF to qspi flash? Are the traces between the nRF to flash-IC short (ie. ~3 cm or shorter in length)

    Q2: Are you using the same pinout as the nRF5340-DK for the QSPI pins?

     

    Kind regards,

    Håkon

  • Hello Hakon,

    I have found one issue in my hardware QSPI pin connection, after making it correct, I can be able to see correct output in read_flash API.

    Now I wanted to confirm same by nrfjprog utility command by reading the same memory location of external flash, to confirm that QSPI flash is interfaced correctly.


    Can you guide me how we can confirm same by nrfjprog utility command and if possible, please share the command to read that location bytes?

    Thanks,

    Kaushik Parsana

  • Hi Hakon,

    I had used this command for nRF5340 "nrfjprog --memrd 0x100ff000 --n 16 --w 8 -f nrf53"

    with that I can got the data that is written by sample code.

    #define FLASH_TEST_REGION_OFFSET 0xff000
    I have used this memory address to write data into external flash memory, after adding offset value 0x10000000 it become 0x100ff000, and on that address the sample code written data present.

    Thanks for the help.

Reply Children
No Data
Related