SD card standby power in feather adalogger M0

Fellows,

I'm working on a project using the feather adalogger M0. I'm running code that reads sensors, write data into the SD card and then goes to (deep) sleep. For this i'm using sdfat lib and sleeping based on the rtc alarm scheme. Everything goes well except the power consumption which is a topic I've seen in forums many times before related to the sd card.

Let me explain. I manage to have the SAMD21 processor sleeping in standby drawing uAs. Normal operation shows the current peaks when data is being actually written to the sd card (tenths of mAs) but when the everything is suppose to be sleeping using the rtc.standbyMode() the whole sytem (Feather with the SD card) takes 20mA. I'm using a class 10 sd card. when I remove (physically) the sd card from the slot the power drops to the uA dunring this sleep time (which is consistent with the SAMD21 sleeping current).

From other posts, there is a number of suggestions like using FETs to switch off the power of sd card (which isn't accessible in the feather), pullups into the SPI bus (and exchanging from OUTPUT to INPUT pin in sclk), the developer of sdfat library (fat16lib) also has upgrade the lib with a sd.begin() corrected but no possibility to have an end fuction (which I understand the reasons) but still I was wondering if there is a software turnaround that could reduce the power taken by the card during sleep. It drives me crazy that sd card takes power when sleeping and there's seem to be no way to avoid it except cutting the power with a MOSFET (it seems brute force). What is really the effect of SPI bus in the sd card when everything is sleeping?

I'm also trying older cards class 4 or class 6 to see if it behaves the same way.

Any help it would be extremely appreciated.
Regards,

From what I saw in this forum the Sdcard when deselected should take something like 100-200uA.
Try to deselect the sdcard (after you close the file double-check the sdcard's CS is High) and make a dummy spi transfer (while sdcard's CS is High).

You didn't provide information about which SdFat class you are using.

If you are using the SdFatEX class you need to sync()/flush() any open files before sleeping.

SdFatEX keeps the SD active in a multi-write or multi-read transfer if possible.

file.sync() or file.flush() should allow the SD to sleep with low current.

Check SD chip select. It should be high after the flush call. SD chip select should have a pull-up to keep it high during sleep.