STM32SD
STM32SD copied to clipboard
STM32SD end() functionality to support SD card/library reset during operation
The current STM32SD library does not have an end() or similar function to support stopping and deinitialising the library and SDIO peripheral.
Having an end() function would allow for:
- SD card reinsertion without resetting the MCU
- SDIO peripheral reset in rare case of SD card hang/fault
The end() function should perform the following at least:
- Deinitialise the SDIO peripheral of the MCU
- Reset the STM32SD library to an uninitialised state, such that begin() may be called again successfully
- Allow the SDIO GPIO pins to be configured as normal GPIO pins (eg. configured as analog input to save power in low-power state)
The Arduino SD library has recently implemented support for end(), which looks like this:
https://github.com/arduino-libraries/SD/blob/a3866205cf9af4eea3e10dcdc5ac2c713f293337/src/SD.cpp#L369-L372
Kind regards, Bryn
For ref: https://github.com/arduino-libraries/SD/pull/37