libraries/SD: there is conflict when sharing the same SPI bus in multi tasks. The OLED will show messy when check the SD status.
Solution:
libraries/SD: in ff_sd_status() of diskio.c, add ‘AcquireSPI card_locked()’ before to prevent …there is conflict when sharing the same SPI bus in multi tasks
- the Backtrace:
0x4010cbb4: sdTransaction(unsigned char, char, unsigned int, unsigned int*) at */build/../components/arduino/libraries/SD/src/sd_diskio.cpp:245
0x4010cbe6: ff_sd_status(unsigned char) at */build/../components/arduino/libraries/SD/src/sd_diskio.cpp:619
0x40112ff6: ff_disk_status at ~/SDK/esp-idf/components/fatfs/diskio/diskio.c:66
0x4011348e: find_volume at ~/SDK/esp-idf/components/fatfs/src/ff.c:3244
0x40114249: f_open at ~/SDK/esp-idf/components/fatfs/src/ff.c:3567
...
0x40203ead: fs::FS::exists(char const*) at */build/../components/arduino/libraries/FS/src/FS.cpp:242
### Other Steps to Reproduce
_No response_
### I have checked existing issues, online documentation and the Troubleshooting Guide
- [X] I confirm I have checked existing issues, online documentation and Troubleshooting guide.
@LeoYan Thank you from finding this out and providing a fix. I have opened a PR linked to this issue.
This issue will be closed after merging the fix automatically.
Board
ESP32 Dev Module
Device Description
on the SPI bus connected the follows:
Hardware Configuration
use the standard SPI pins connect to OLED and SD
Version
v2.0.9
IDE Name
Arduino IDE
Operating System
macOS big sur
Flash frequency
40MHz
PSRAM enabled
no
Upload speed
115200
Description
Issue:
Solution:
libraries/SD: in ff_sd_status() of diskio.c, add ‘AcquireSPI card_locked()’ before to prevent …there is conflict when sharing the same SPI bus in multi tasks
Sketch
Debug Message