Please have a look at this AN3990 it may be helpful to what you expect to do, and it's applicable for SD card using.
Imen
In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. Thanks