SD Card Issues after updating to SDK 2.1

We have updated our firmware runnung on an nRF9160 from SDK 1.9 to SDK 2.1 using the now deprecated SPM (We will upgrade to TFM soon). 

When booting our firmware, we initialize and mount our SD Card using FAT filesystem. 

The function disk_access_get_di couldnt find any disk  (returned null) so after some research in this forum and on github we updated our devicetree as following:

NOTE: we had to define sck-pin, mosi-pin and miso-pin in order to make it work. 

And activated to following additional kConfig:

Now, disk_access_get_di found our sd card, but it crashed (immediate reset) at the following line:

SD Card initilization happens during initialization level 'POST_KERNEL'. We had to change this to 'APPLICATION' to make it work...

SYS_INIT(initSdCard, APPLICATION, CONFIG_SDHC_INIT_PRIORITY);

We try to understand if this is to be expected or a bug? What is the problem of running this on initialization level 'POST_KERNEL'? Also, could you update the samples? We think its outdated.. https://github.com/nrfconnect/sdk-zephyr/tree/v3.1.99-ncs1-branch/samples/subsys/fs/fat_fs 

Parents Reply Children
Related