0
votes

I am using STM32L476(with SW4STM32 & STM32CubeMX) for a low power application. I have interfaced SD card through SDMMC interface (with FatFs ) of the micro-controller. This interface is consuming current in the range of 1mA. So i am planning to disable the SDMMC interface, whenever it is not needed. I didn't find any APIs in the HAL documentation to disable it.How to disable the SDMMC interface

1

1 Answers

0
votes

The SDMMC is on the APB2 bus, you can disable the clock to the peripheral by setting bit 10 of the RCC_APB2ENR to 0, this is documented on page 259 of the reference manual for that processor.

The code you need is something along the lines of the following, depending on the library you're using.

RCC->APB2ENR &= ~RCC_APB2ENR_SDMMCEN;

To turn it back on again, you need to do the opposite, set that bit to 1

RCC->APB2ENR |= RCC_APB2ENR_SDMMCEN;

It is quite possible there is a function in the HAL which does this for you, but someone who uses the library and is familiar with it will have to help with that.