Hi there,
My nRF5340 application requires the use of SD card with DMA and BLE transmission. Howerver, as soon as I turn on the device, I get the following errors:
[00:00:00.452,667] <27>[1;31m<err> spi_nrfx_spim: Timeout waiting for transfer complete<27>[0m<\r><\n> [00:00:00.453,125] <27>[1;31m<err> sdhc_spi: Card SCLK init sequence failed<27>[0m<\r><\n> [00:00:00.453,155] <27>[1;31m<err> sd: Could not disable card power via SDHC<27>[0m<\r><\n> disk_access_init failed. Error code: -5 ()<\r><\n> [00:00:00.453,186] <27>[1;31m<err> SDCard: Failed to initialize SD card
A few internet searches and ChatGPT conversations have revealed that the clocking sequence is tied with the BLE operations and cant be used for initializing the SD card operations. A summary here:
Both BLE and SPIM require the 64 MHz HFCLK. The Zephyr Bluetooth Controller enables the HFCLK through the MPSL (Multiprotocol Service Layer). If BLE claims the HFCLK first, it may block or delay other peripherals (like SPIM) from accessing it when needed. As a result, the spi_nrfx_spim driver fails to receive the clock enablement, and SCLK doesn’t toggle, leading to:
Please guide how to best use the SPIM on SD card while using BLE operations.
Best,
Umer