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.

  • Hi

    Thanks. Adding those files I realize that ext_flash.h is also missing ;)Disappointed

    Either way, I will start doing some testing on my own in the mean time, and set up a quick test based on the ble_app_uart example. 

    Getting 3-4 of the core functions running should not be very time consuming.

    Best regards
    Torbjørn

  • Ext_flash.h  you can remove it and instead of it add external_flash.h

  • Hi 

    I set up my own little test based no ble_app_uart, and it seems to work fine. 

    I have tested most of the core commands, including Sector Erase, Chip Erase, Program, Read, Write Enable and RDSR. 

    I set up a small state machine that runs through a read - erase - read - program - read loop every time I reset the code, and the results look OK. 

    DZ233955_ble_app_uart.zip

    When I run this on an nRF52840 DK I get the following UART output:

    UART started.
    Reading REMS. Man id: c2, Dev id: 17
    Status: 0
    Config: 0
    Reading address 00001000: FF-FF-FF-FF-00-01-02-03-04-05-06-07-08-09-0A-0B-
    Running write enable
    Running sector erase at address 0x1000
    Status: 0
    Reading address 00001000: FF-FF-FF-FF-FF-FF-FF-FF-FF-FF-FF-FF-FF-FF-FF-FF-
    Running write enable
    Programming data at address 00001004
    Status: 0
    Reading address 00001000: FF-FF-FF-FF-00-01-02-03-04-05-06-07-08-09-0A-0B-

    I have updated the nRF52832 project also. It compiles and runs nicely, but doesn't show any output since I don't have a flash device connected. 

    Can you take a look at my code and see what might be different?

    I put all the flash functionality in the spi_flash.c/h files, and the test state machine can be found towards the bottom of main.c

    Best regards
    Torbjørn

  • 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  ????

Reply Children
Related