SD card support to nRF5340

Hi,

Is there any example available for nRF5340-DK to read and write to external SD card ?

Thanks.

  • Hello Shubham,

    You can find the samples here.

    For getting more idea on SD Host controller you can keep this page as a reference.

    Kind Regards,

    Abhijith

  • Thanks Menon for the quick response. I'll try the sample codes.

  • Hi Menon,

    I tried the fat_fs example but could not get the expected results.

    As the fat_fs example shared by you is for nrf52840, I had created the nrf5340dk_nrf5340_cpuapp_ns.overlay and nrf5340dk_nrf5340_cpuapp_ns.conf files inside boards directory. 

    * Copyright (c) 2019 Tavish Naruka <tavishnaruka@gmail.com>
    *
    * SPDX-License-Identifier: Apache-2.0
    */

    &spi3 {
            compatible = "nordic,nrf-spim";
            status = "okay";
            sck-pin = <17>;
            mosi-pin = <13>;
            miso-pin = <14>;

            cs-gpios = <&gpio0 18 0>;

            sdhc0: sdhc@0 {
                    compatible = "zephyr,mmc-spi-slot";
                    reg = <0>;
                    status = "okay";
                    label = "SDHC0";
                    spi-max-frequency = <24000000>;
            };
    };

    CONFIG_DISK_DRIVER_SDMMC=y
    CONFIG_SPI=y

    Pin configuration:

    SD card -- DK pin configuration.

    VCC - 5V

    GND - GND

    CS - P0.18

    DI - P0.14

    DO - P0.13

    CLK - P0.17

    Flashed the application to the board but getting below error.

    Moreover, I am getting the message " nrf5340dk_nrf5340_cpuapp_ns.overla is untracked".

    Please let me know how to resolve this issue.

    Thanks.

  • Hello Shubham,

    I can try and get back to you. But I can see that the error you shared looks like an I/O error. Can you recheck the pins you are trying with (make sure it is not already used). Or it can be due to the frequency you are trying. SD Card may not support the frequency or it can be the card reader. Please check this in the mean time.

    Kind Regards,

    Abhijith

  • Hello Abhishek,

    I haven't connected anything to the dev-kit apart from the SD card. Also the SD card and the reader is also working fine.

    Regards,

    Shubham

Related