-->
Page 19 of 22

Re: Everything about Esp8266 and SD cards

PostPosted: Thu Mar 31, 2016 1:59 pm
by msurguy
Very informative thread here.

I wonder if it is possible to have ESP module read an SD card that is also hooked up to another device at the same time. For example a camera can store images on the sd card and ESP module could read the images and stream them over WiFi.

Did anybody do an experiment like that?

Thanks!

Re: Everything about Esp8266 and SD cards

PostPosted: Thu Mar 31, 2016 9:26 pm
by picstart
Multiple devices accessing the SD card.
Assuming the interface is SPI then one and only one can access the card at a time. Each device wishing to access the card would need to check if the SD card has its CS pulled low.
Now the issues arise if a device releases the CS before completing a task in that case the context has to be preserved so that upon regaining access it can resume otherwise all transactions against the card will be blocking until completed.
Initialization of the SD card needs to be done but the pointers into that translate logical addresses to physical blocks will require storing for context. Possibly this will be messy to implement as non blocking and difficult to troubleshoot.

Re: Everything about Esp8266 and SD cards

PostPosted: Fri Apr 01, 2016 7:34 am
by martinayotte
That would be difficult, because even in one transaction to write a single file, the CS is asserted several times, so there are risks that the second MCU is stealing the SD while a transaction still occurs.

Re: Everything about Esp8266 and SD cards

PostPosted: Fri Apr 01, 2016 4:36 pm
by xbary
Or add to the system even further PIN (name: USE_CARD) indicating that the card during the transaction. Then the second MCU wanting something from SD cards most commonly have to wait until the card is free.