nr52832 + nRF Connect 1.8.0 + External Flash

Hello Team,

We are interfacing nRF52832 with an external flash for data storage. Could you please point to the right document/link/code reference on how to interface external flash (on SPI) with nRF52832 on nRF Connect SDK 1.8.0?

Thanks!

  • Hi,

     

    It should map this to the underlying driver that is used.

    Did you delete the build folder and regenerate the project? It might not be that the build system was able to catch the change in the .overlay file.

     

    Kind regards,

    Håkon

  • Hi Hakon,

    Thanks for the guidance. However, deleting the build folder didn't help. 

    Changing compatible to nrf-spim still gives the linking error:

    ncs\v1.8.0\zephyr\drivers\flash\spi_nor.c:1230: undefined reference to `__device_dts_ord_68'

    Current data of prj.conf for SPI:

    #for SPI

    CONFIG_SPI=y
    CONFIG_FLASH=y
    CONFIG_SPI_NOR=y
    CONFIG_SPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096
    Anything else that I can try?
    Thanks!
  • Hi,

     

    My apologies, you are right.

    The issue stems from this erratum on the nRF52832:

    https://infocenter.nordicsemi.com/topic/errata_nRF52832_Rev3/ERR/nRF52832/Rev3/latest/anomaly_832_58.html#anomaly_832_58

     

    Which can be overridden by setting:

    CONFIG_SOC_NRF52832_ALLOW_SPIM_DESPITE_PAN_58=y

     

    However; this can be problematic if you run into the scenario as described in the erratum. You can use NRF_SPIM for testing purposes, to see if the same issue occurs, but I would not recommend using it in cases where you do not know if you can potentially receive only 1 byte over SPI.

     

    Kind regards,

    Håkon

  • Hi Hakon,

    Thanks for the info.

    Using SPIM with "CONFIG_SOC_NRF52832_ALLOW_SPIM_DESPITE_PAN_58=y" did compile the code and I don't see earlier error during boot. However, it definitely fails write transactions with warning:

    W: Transaction aborted since it would trigger nRF52832 PAN 58

    So, as you suggest, we shouldn't be using SPIM but we will have to stick with the SPI driver. 

    Do you have any other suggestions to get rid off below error during boot:

    E: Device id 00 00 00 does not match config ef 40 14

    I am still able to communicate with the Flash using SPI APIs, but I do see this error every time I reboot the board now. Please note, we want this to work since we are planning to use External flash for OTA in our next stage of development.

    Thanks!

  • Hi,

     

    embeddedER said:
    E: Device id 00 00 00 does not match config ef 40 14

    This is an actual read out over the SPI bus, where as a part of the initialization of the SPI NOR flash device, the nRF reads out its ID and compares it to the one you've set in the .overlay file.

    If this is all zero's, it means that the nRF is having issues reading your flash device. It can be many reasons why, for instance that the SPI speed is too high, creating issues for the GPIOs themselves to comply with the electrical specifications (ie. too much capacitance on the lines). This is easily testable by reducing the SPI speed.

    Please use a oscilloscope to verify if the toggling of the SPI signal is reaching GND and VDD levels and providing a nice and clean signal.

    As previously mentioned, your current speed is 8 MHz, which is too high if your routing is long. Reducing this to 1 MHz should help that scenario.

    Have you for instance double checked the timing parameters that you provided in the .overlay files with the electrical specifications of the flash itself? Parameters " t-enter-dpd = <3000>;" and "t-exit-dpd = <30000>;" ?

     

    Kind regards,

    Håkon

Related