STM32SD icon indicating copy to clipboard operation
STM32SD copied to clipboard

STM32SD end() functionality to support SD card/library reset during operation

Open BrynMorgan1 opened this issue 1 year ago • 1 comments

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 image

Kind regards, Bryn

BrynMorgan1 avatar Apr 23 '24 07:04 BrynMorgan1

For ref: https://github.com/arduino-libraries/SD/pull/37

fpistm avatar Sep 24 '24 09:09 fpistm