Hello Nordic, I have a problem. I'm running the nRF9160DK with three sensors and an sd card reader. The three sensors and the sd-card reader are connected via SPI. Due to power requirements, I have only one sensor active, taking down values constantly. Once these values cross a certain threshold, a trigger event occurs and data is sampled at 32kB/s for up to 20 seconds. This is more data than the RAM can hold, and as such I need to write it to the sd-card continuously. The problem is the sd-card, if mounted, draws 2,18mA.
The idea is to cut the power to the SD-card when it's not being used, which is 99% of the time, and mount it when a trigger happens. The sensor has a buffer which overflows after around 25ms and the mounting procedure of the sd-card takes between 100-500 ms. Now, I certainly have enough RAM to save a few seconds of data while the sd-card is being mounted, if it can be done in parallel with the data reading.
And that is my question: Can this be done in parallel? Multithreading, to me, requires more than one core and dividing up the workload between the cores. However, in a single core application, maybe there is some sort of timer interrupt or the like that automatically switches between threads. Maybe DMA could be used. I'm a bit lost here and looking for ideas for how to do this, if it is possible. Any other idea would also be appreciated, maybe there is a way in software to reduce the current draw of the sd-card such that it stays mounted and the wake-up-time is greatly reduced.
Thank you for reading!