Hi all,
I'm building a battery-powered ultrasonic audio recorder (bats / cetaceans) on a Teensy 4.1 and I'm trying to get hibernate current under 10 mA between recordings. A bare Teensy hibernates at about 5 mA. I've run into the following with a microSD card in the built-in socket, and I'd appreciate any ideas.
Setup: Teensy 4.1, Arduino IDE with Teensyduino 1.60+ (core 1.62), SdFat 2.1.2 (the version bundled with Teensyduino), sd.begin(SdioConfig(FIFO_SDIO)), Paul's fork of Snooze (Snooze.hibernate(), timer wake). Current measured on the 5 V supply with a meter while the board is hibernating.
Measurements (same board, same sketch, only one change each time):
- No card in the socket: 5.5 mA
- Card inserted but sd.begin() never called: 5.7 mA
- Card inserted and sd.begin() succeeded, then hibernate: 34.7 mA (Samsung 256 GB). A SanDisk card was worse (about 40 mA).
Things I tried before hibernating, none of which changed the 35 mA:
- Sending the card CMD0 (go idle) directly through the USDHC1 registers, using the same register sequence as SdFat's cardCommand().
- Switching the six SDIO pads (GPIO_SD_B0_00..05) back to plain GPIO inputs with pull-ups off.
- Both together.
So it is not the SD controller or the pad configuration on the Teensy side (no card plus controller initialized is 5.5 mA). It looks like the card is left in an active state once it has been initialized, and the SDIO bus is then left floating while the chip is powered down. I understand the socket 3.3 V rail is not switchable on the Teensy 4.1, so I can't cut power to the card.
Questions:
1. Has anyone gotten the Teensy 4.1 built-in SD socket down to a few mA in hibernate after the card was initialized? If so, what did you do (a particular card, a specific shutdown sequence, something in SdFat)?
2. SdioCard::end() in SdFat is empty. Is there a recommended way to put the card into its lowest-power state before power-off?
3. Is there a known card brand or model that sleeps properly after SDIO init?
For now I'm planning to try different cards, and for a future board revision an external SD socket with a switched supply. Thanks for any pointers!
Side note, unrelated to the SD card: in my sketch, Snooze.hibernate() woke after about 1 s instead of the 60 s I asked for once Wire.begin() had run earlier in the same boot, and Wire.end() did not undo it. Restarting the chip first and hibernating in the fresh boot (before any Wire use) works around it. I haven't yet found the cause.
I'm building a battery-powered ultrasonic audio recorder (bats / cetaceans) on a Teensy 4.1 and I'm trying to get hibernate current under 10 mA between recordings. A bare Teensy hibernates at about 5 mA. I've run into the following with a microSD card in the built-in socket, and I'd appreciate any ideas.
Setup: Teensy 4.1, Arduino IDE with Teensyduino 1.60+ (core 1.62), SdFat 2.1.2 (the version bundled with Teensyduino), sd.begin(SdioConfig(FIFO_SDIO)), Paul's fork of Snooze (Snooze.hibernate(), timer wake). Current measured on the 5 V supply with a meter while the board is hibernating.
Measurements (same board, same sketch, only one change each time):
- No card in the socket: 5.5 mA
- Card inserted but sd.begin() never called: 5.7 mA
- Card inserted and sd.begin() succeeded, then hibernate: 34.7 mA (Samsung 256 GB). A SanDisk card was worse (about 40 mA).
Things I tried before hibernating, none of which changed the 35 mA:
- Sending the card CMD0 (go idle) directly through the USDHC1 registers, using the same register sequence as SdFat's cardCommand().
- Switching the six SDIO pads (GPIO_SD_B0_00..05) back to plain GPIO inputs with pull-ups off.
- Both together.
So it is not the SD controller or the pad configuration on the Teensy side (no card plus controller initialized is 5.5 mA). It looks like the card is left in an active state once it has been initialized, and the SDIO bus is then left floating while the chip is powered down. I understand the socket 3.3 V rail is not switchable on the Teensy 4.1, so I can't cut power to the card.
Questions:
1. Has anyone gotten the Teensy 4.1 built-in SD socket down to a few mA in hibernate after the card was initialized? If so, what did you do (a particular card, a specific shutdown sequence, something in SdFat)?
2. SdioCard::end() in SdFat is empty. Is there a recommended way to put the card into its lowest-power state before power-off?
3. Is there a known card brand or model that sleeps properly after SDIO init?
For now I'm planning to try different cards, and for a future board revision an external SD socket with a switched supply. Thanks for any pointers!
Side note, unrelated to the SD card: in my sketch, Snooze.hibernate() woke after about 1 s instead of the 60 s I asked for once Wire.begin() had run earlier in the same boot, and Wire.end() did not undo it. Restarting the chip first and hibernating in the fresh boot (before any Wire use) works around it. I haven't yet found the cause.