Arm Mbed OS support forum

Force SPI pins to become logic low to power down peripheral


In my application I’m using a MOSFET to cut an SD card’s 3.3v supply when it’s not in use. However, I found out that the SD card is still getting powered through the SPI lines (I measure about 2.8v on the SD card’s VCC pin, perhaps because the SPI lines can’t supply much current). Is there a way to force the SPI pins low or high impedance in Mbed?

I am using the nRF52832 chip as my MCU, and I’m using the SDBlockDevice and FATFileSystem classes to talk to the SD card. I guess I can just destroy the SDBlockDevice instance and create some DigitalOut pins on the original SPI pins to force them low, but I’m wondering if there’s a better way to do this.

Thank you for the help.

Hello Richard,

Since we are allowed to call/use the target MCU’s HAL API in Mbed I think this advice might help.

Ok, thank you. I’ll try the method outlined there.