Re: LVGL and SD Card won't share SPI bus
Posted: Sun May 17, 2020 6:25 am
It is the case that SD cards don't release the bus immediately. The CS signal is clocked into the chip by sck. So when CS goes False, the bus is not released until 8 sck edges have occurred.
The official driver takes this into account and, in this respect, does not require change.
I found another problem where the bus is shared, which can be demonstrated very easily. If you mount and run an SD card, then write 0 to the bus (with CS False) the SD interface fails on next access. This simulates shared access. The solution is to modify the SD card driver so that, prior to access, it writes 0xff to the bus with CS False. In my application this works. Unfortunately despite requests nobody has yet explained why.
It's just a drop-in replacement for the official driver.
However, reading this thread it's clear that there are other problems with this application. I suggest you guys use my version, at least until you've debugged the other issues, because the issue I found could muddy the waters. You might then revert back to the official version to see if the problem I identified affects you.