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

Reading SD card on nRF9160dk

Hello,

I want to read two files from SD card using nRF9160dk. I tried this code ncs/zephyr/samples/subsys/fs/fat_fs.

The Code:

I am getting the following error:

nrf9160_pca10090ns.overlay:

I checked the voltage levels at SPI_3 pins. Pin 16, 17, 18 shows 3V but 19 which is SCK is at 0V. I am not understanding why it is at 0V.

Why there is error? What else I need to do?

Parents
  • Hello, 

    What version of NCS are you using? 

    Kind regards,
    Øyvind

  • I am working with ncs_tag v1.0.0.

  • Instead of disk_access_spi_sdhc, can I use app_sdcard on nRF9160? I guess app_sdcard uses nrf legacy drivers. My collegue has used app_sdcard on nRF52840DK to interface with SD card. So is it possible to use with nRF9160DK instead of Zephyr drivers?

  • Hello,

    I downloaded the merged.hex file which you provided and I think it is working. LED on SD card is continuously blinking which means it is continuously receiving the clock signal.

    When I download my merged.hex file, LED stops working after 10-15sec indicating that SD card is not mounted and it stops receiving clock signal.

    I compared both merged.hex files and they are different.

    I am using the same ncs tag, overlay file and prj.conf file as yours. Still it is different.

    I think in my program, spi is never initialized. Can you please guide me for this problem?

  • Hello, 

    Jagruti said:
    Instead of disk_access_spi_sdhc, can I use app_sdcard on nRF9160? I guess app_sdcard uses nrf legacy drivers. My collegue has used app_sdcard on nRF52840DK to interface with SD card. So is it possible to use with nRF9160DK instead of Zephyr drivers?

     The app_sdcard is a library from the nRF5 SDK. You can use this but will need to port to nRF9160.

    Can you please provide more information about your setup? Can you take a picture to show how you have connected?

    Have you ensured that the pins are correctly configured in the board controller? P0.13 on the board controller must be set to enable these pins.

    To minimize editing the board controller, can you please route SPI3 to P0.10 - P0.13  instead? These are found on P19 and should be directly available.

    Kind regards,
    Øyvind

  • Hello,

    Attached is a working project using SPI3. The output is shown in the image.

    fat_fs.zip


    Let me know how it works for you!

    Kind regards,
    Øyvind

  • Hi,

    I am using adafruit micro-sd breakout board and kingston micro sd card 8GB which is formatted to FAT32 Filesystem.

    Connections are as follow:

    SCK (Pin 11) -> CLK

    MOSI (Pin 12) -> DI

    MISO (Pin 13) -> DO

    CS (Pin 10) -> CS

    Picture of the setup:

    I tested zephyr/tests/subsys/fs/multi-fs to check fatfs and it is working properly. It can create the directory and files on the RAM of nRF9160.

    The error is coming from disk_access_init() function. 

    I checked the drivers and it looks correct. I checked the SD card commands, they are also correct. In previous version there was issue but it is fixed now for this version. Still that error comes.

    So the problem is either in disk_access_spi_sdhc file or in the sd card. Because SPI is getting initialized. 

Reply
  • Hi,

    I am using adafruit micro-sd breakout board and kingston micro sd card 8GB which is formatted to FAT32 Filesystem.

    Connections are as follow:

    SCK (Pin 11) -> CLK

    MOSI (Pin 12) -> DI

    MISO (Pin 13) -> DO

    CS (Pin 10) -> CS

    Picture of the setup:

    I tested zephyr/tests/subsys/fs/multi-fs to check fatfs and it is working properly. It can create the directory and files on the RAM of nRF9160.

    The error is coming from disk_access_init() function. 

    I checked the drivers and it looks correct. I checked the SD card commands, they are also correct. In previous version there was issue but it is fixed now for this version. Still that error comes.

    So the problem is either in disk_access_spi_sdhc file or in the sd card. Because SPI is getting initialized. 

Children
No Data