arduino-libraries / SD

SD Library for Arduino
http://arduino.cc/
GNU General Public License v3.0
182 stars 154 forks source link

Clean SPI transactions? #103

Open fkromer opened 3 years ago

fkromer commented 3 years ago

According to the SPI lib reference the usage of SPI.beginTransaction() and SPI.endTransaction() allows to restrict SPI access to a specific device. It seems like the SD lib uses SPI.endTransaction() after init and as part of erase methods only.

Freeing the SPI resource after usage for classes Sd2Card and SdVolume is missing as well. Would it make sense to check if the SD lib frees the SPI resource after usage (e.g. writing, reading, etc.) properly?

bhupiister commented 2 years ago

I can confirm that the SD card on the shared SPI bus creates a problem and failed to access the card after a while. For this reason, I had to port to SDFat library and voila, it was a big relief.