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

External Memory SPI connection

Hi, 

I am currently working on programming a bootloader on to my nrf52840 DK. The bootloader will be able to do DFUs via SPI. I am using SDK 15.2.0. I also want to be able to write the update being received to an external EEPROM then transfer it over to internal memory (perform a dual bank update with eeprom). I am using an outside eeprom to use as external memory rather than the on board external memory. It communicates via 3 wire SPI, however, since I am already using an SPI connection, I am assuming that I could will be able to connect the EEPROM to the QSPI and disconnecting the external onboard memory. I currently have the EEPROM connected to my board as shown in the picture below. Vcc on the EEPROM is connected to VDD on the board.

  

I followed the instructions in this link to use the corresponding GPIOs. I then tested my connection using the nrfjprog --readqspi temp.hex . It was able to read the EEPROM and show it in temp.hex, but when I tried writing or erasing the memory, it would say the following:

  

I rerun nrfjprog --readqspi and it gives me the same values meaning that nrfjprog is not correctly erasing the EEPROM. I do not know if it is because I am using QSPI or if I am no connecting the external memory correctly. If it is because I am using QSPI, is there a way I can create another SPI connection on the board? And if so, how can I do that?

Any advice helps!!!

Parents Reply Children
  • Hi,

    Are you usigng 24-bit addressing? Memory access from QSPI peripheral only supports word-aligned to the external memory's address space, so it's only possible to write full 32-bit "words".

    Since you are not using the same external memory chip as the one used in the DK you may need to change the configuration in nrf_serial_flash_params.c/.h

    By default the peripheral is configured to use the same read_id, size, program size and other parameters used by the flash chip used for the nRF52840 DK.

    Best regards,

    Marjeris

  • I updated the size in nrf_serial_flash_params.c and changed the qspi to be in 32bit mode, yet I am still getting the same answer. I did notice that when I compare the data read when I runf nrfjprog --readqspi mem.hex for the onboard external memory with my external memory, I notice that they are both the exact same size. My external memory is smaller(8Mb) so shouldn't there be less addresses?

     Memory read from my external memory after using nrfjprog --readqsi mem.hex:

    3157.mem.hex

    Memory read from onboard external memory after using nrfjprog --readqsi mem.hex:

    4786.mem.hex

  • Hi,

    Can you share with me your nrf_serial_flash_params.c/.h file?

    You should check the .read_id, .capabilities, .size, .erase_size, .program_size parameters you are using. These parameters should be stated in the external flash's datasheet.

    static const nrf_serial_flash_params_t m_sflash_params[] = {
        {    /*MXIC MX25R6435F*/
            .read_id = { 0xC2, 0x28, 0x17 },
            .capabilities = 0x00,
            .size = 8 * 1024 * 1024,
            .erase_size = 4 * 1024,
            .program_size = 256,
        }
    };

Related