Page 1 of 1

is sdmmc driver reentrant?

Posted: Mon Jul 16, 2018 2:23 pm
by squonk11
I am trying to implement a webserver which serves the webpages stored on an SD card. It also should be able to serve more than one simultaneous connection. For this the esp-idf driver for the SD card needs to be reentrant. Is this the case?

Re: is sdmmc driver reentrant?

Posted: Tue Jul 17, 2018 7:20 am
by ESP_igrr
If you are reading files from FAT filesystem via standard C library functions, then you can do so from multiple concurrent tasks. Keep in mind that FATFS library does not support some concurrent operations on same file (reading/writing from one task and deleting it from the other).

If you aren't using FATFS, and accessing SD card as raw storage via sdmmc protocol layer, you need to add locking around SD card commands yourself.

Re: is sdmmc driver reentrant?

Posted: Tue Jul 17, 2018 4:00 pm
by squonk11
thank you for your fast answer.
yes, I will be using FAT filesystem with the in esp-idf provided C library. The webpages of course will only be read; so, a simultaneous read of the same file from two different tasks needs to be possible. I guess your answer gives green light for this approach, right?

Re: is sdmmc driver reentrant?

Posted: Wed Jul 18, 2018 7:06 am
by ESP_igrr
Yes, simultaneous read from the same file from different tasks is possible.