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

NRF9160 SD card access via SPI

Hi,

I am following a client case that they have issue on accessing SD card via SPI port.

I used the sample project fat_fs on nrf9160_pca10090 DK and used SPI_3 to access the SD card.

After some testing and I face the exact same issue from other thread.

https://devzone.nordicsemi.com/f/nordic-q-a/58558/reading-sd-card-on-nrf9160dk

(I opened this new case as suggested by Nordic FAE)

I ran debug mode and found that the CS pin wasn't registered in the device context. Here is some of my findings. (tested on SDK v1.2.0)

  1. Set breakpoint at line 220 of spi_nrfx_spim.c. The dev_data->ctx->config->cs was NULL, causing "CS control inhibited (no GPIO device)" (line 177, spi_context.h)
  2. For the structure spi_3z_config.
    1. the spi_3z_config.config.ss_pin = 0xff. In this structure the ss_pin was set as unused. (line 409, spi_nrfx_spim.c)
    2. I changed the ss_pin value to "DT_NORDIC_NRF_SPIM_SPI_##idx##_CS_GPIOS_PIN", now the spi_3z_config.config.ss_pin = 16 (CS pin was set 16 in the DTS overlay)
    3. But this change did not help to update the dev_data->ctx->config->cs. The value was still NULL.

I believe there is something missing during the initialization of the SPI device in the OS.

Any help is appreciated.

Thanks

Parents Reply Children
Related