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

NRF52

I'm actually building a project that need to communicate with sdcard.

i read a lot about that and i'm very confusing when i passed on nordic sdk lot of code and ressources lot of files speaking about the same things: NRFx_SPI , NRF DRV SPI ...

Can you give me a NRF52-pca10056 basic example with write and read a block of data from a sdcard no need of any fatfs lib or other complicated code.

Thanks,

Reagards.

  • Hi,

    We only provide the FatFs example for reading/writing SD Cards. Most customers would like a file-system for their cards and then this example makes sense. If you do not want to use this library, I guess you can use the SPI example as a starting point for your application, but you will have to read the SD Card specifications yourself to find the appropriate SPI commands to read and write blocks from/to the SD Card. We do not provide any ready-made examples that do this.

    Best regards,
    Jørgen

  • Hi,

    The example of FatFs that you provide doesn't work in all case and especially when use big files, you can read comments on this forum about that and the answer given by nordicsemi support is that the FatFs is an external third library right. it is why i prefer to not use it and use only libraries developed and supported by Nordicsemi.

    As i can see you provide the app_sdcard.c/h lib? how can i use it?

    Can you give me a clear answer according the difference between SPI Master and NRFX SPI Master?

    and what i shall use?

    Thanks

    Best Regads

  • You may reference the SD card library documentation. It gives a short description of how the library can use used.

    SPI Master example uses the legacy driver API (nrf_drv_spi). This driver API combines support for both SPI and SPIM (EasyDMA support) peripheral. The legacy API uses the NRFX drivers in the bottom, it is just a middle-layer adapting the API to support the old example implementations.

    nrfx SPI Master example uses the nrfx_spim driver API directly. This example was added since instance SPIM3 (High Speed SPI - 32 MHz) available on nRF52840 is not supported in the legacy API driver.

  • Thank you for your feedback.

    1- Can you gives a more complete sample to build the SD card library?

    2- When APP_SDCARD_SPI_INSTANCE is activated in sdk_config.h with one will be used (nrf_SPI of nrfx_SPI?)

       is there other more configuration to set if i want to use DMA with SPI?

    Best regards

  • micheld_ said:
    1- Can you gives a more complete sample to build the SD card library?

    Unfortunately, we only have the FatFs example showing the usage of this library. app_sdcard is used through nrf_block_dev_sdc which interfaces with FatFs through Nordic's port layer (diskio_blkdev).

    micheld_ said:
    2- When APP_SDCARD_SPI_INSTANCE is activated in sdk_config.h with one will be used (nrf_SPI of nrfx_SPI?)

    This will depend on the configuration of the SPI driver (nrf_drv_spi). If EasyDMA for the corresponding instance is enabled, EasyDMA will be used:

    // <q> SPIx_USE_EASY_DMA  - Use EasyDMA
     
    #ifndef SPIx_USE_EASY_DMA
    #define SPIx_USE_EASY_DMA 1
    #endif

Related