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

Interface External flash to nrf52832

I want to interface a 16MB external flash (SPI) with nrf52832 on the development board.Suggest me how should I start with and if there is an example for external flash then let me know. 

Parents
  • Hi

    What kind of external flash device do you want to connect?

    Are you planning to use a file system, or will you just access the flash using low level read/write/erase commands?

    The usbd_msc example in the SDK allows you to access SD cards over the SPI interface, if you compile the example with the USE_SD_CARD define set to 1 (located on line 106 of main.c). 

    Unfortunately this example is designed for the nRF52840 only, since it uses the USB interface in the nRF52840 to enumerate the connected SD card as a flash drive when connected to a PC. 

    Best regards
    Torbjørn

  • I want to interface MX25R1635F FLASH memory with nrf52832. And no file system but want to access its read,write and erase commands. I have seen the qspi example but got confused with it as my I have nrf52832 that does not support QSPI.

  • Thank you  soo much Torbjorn. 

    U really made my work easier and also cleared my few doubts.

    I tested your code with my flash device and its working properly. But now when I want to write the full page what which is 256 bytes I am not able to do it. I tested first by sending sector erase and the if I read 256 bytes I get the following results which is wrong. ryt?? for full sector earse and fullpage write for 256 what should i add?

    I need this because I want to write and read full sectors.

    Reading address 00001000: 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-000000000000000000000000000

  • One more thing and if I want to erase :

    sector 0 do i have to give address as 0x000000,

    sector 1 as 0x008000

    sector 2 as 0x010000  ????

  • Hi

    It seems there are a couple of problems here. First off the UART TX buffer should be increased to allow the longer log messages to be buffered properly (I increased it from 256 to 1024 bytes), but more importantly the SPI driver is limited to 255 byte transactions, which makes it fail when you try to send 256 bytes in one go. 

    I made a slight change to the driver to split transactions longer than 255 bytes into multiple transactions:

    DZ233955_ble_app_uart_v2.zip

    Please note that the sensor has it's own limitations. If I remember correctly you can't write more than 256 bytes in one go (but I am sure you can read more). 

    Regarding erase I think it is sufficient to specify any address within the block to erase the whole block, but specifying the start address of the block seems the most logical. 

    Best regards
    Torbjørn

  • Thanks a lot, Torbjorn. I tried whole day to get make the flash write 256 bytes but was not able to do :( Thank you for your support. :). I tested it with my hardware and its working.

  • That's great, hopefully you will have less problems going forward Slight smile

Reply Children
Related