Open AranaCorp opened 2 years ago
Memory usage change @ b84ead4c035ed439e56356dbdbad9681044e94ab
Board | flash | % | RAM for global variables | % |
---|---|---|---|---|
arduino:avr:leonardo | 0 - 0 | 0.0 - 0.0 | 0 - 0 | 0.0 - 0.0 |
arduino:avr:mega | 0 - 0 | 0.0 - 0.0 | 0 - 0 | 0.0 - 0.0 |
arduino:avr:nano | 0 - 0 | 0.0 - 0.0 | 0 - 0 | 0.0 - 0.0 |
arduino:mbed_nano:nano33ble | 0 - 0 | 0.0 - 0.0 | 0 - 0 | 0.0 - 0.0 |
arduino:mbed_nano:nanorp2040connect | 0 - 0 | 0.0 - 0.0 | 0 - 0 | 0.0 - 0.0 |
arduino:mbed_portenta:envie_m4 | 0 - 0 | 0.0 - 0.0 | 0 - 0 | 0.0 - 0.0 |
arduino:mbed_portenta:envie_m7 | 0 - 0 | 0.0 - 0.0 | 0 - 0 | 0.0 - 0.0 |
arduino:megaavr:nona4809 | 0 - 0 | 0.0 - 0.0 | 0 - 0 | 0.0 - 0.0 |
arduino:sam:arduino_due_x_dbg | 0 - 0 | 0.0 - 0.0 | N/A | N/A |
arduino:samd:mkrzero | 0 - 0 | 0.0 - 0.0 | 0 - 0 | 0.0 - 0.0 |
It answers this issues https://github.com/arduino-libraries/SD/issues/22
The functionality is already present but it is broken. There was already a patch (https://github.com/arduino-libraries/SD/pull/47) , but it is no longer functional on the current version of the code.
I encountered the same issue today, and I confirm this fix works. The modification in SD.cpp can be simplified by moving the compiler directive inside SDClass::begin(uint32_t clock, uint8_t csPin):
boolean SDClass::begin(uint32_t clock, uint8_t csPin) {
if (root.isOpen()) {
root.close();
}
return card.init(SPI_HALF_SPEED, csPin) &&
#ifndef SOFTWARE_SPI //Added compiler directive so that MEGA works with this code
card.setSpiClock(clock) &&
#endif //SOFTWARE_SPI
volume.init(card) &&
root.openRoot(volume);
}
Sd2Card.h line 38: #define USE_SPI_LIB moved to line 56 Sd2Card.cpp line 20: #define USE_SPI_LIB moved to line 25 SD.cpp line 357 in function SDClass::begin(uint32_t clock, uint8_t csPin), remove card.setSpiClock(clock) when SOFTWARE_SPI is defined
Description of the changes here https://www.aranacorp.com/fr/utilisation-du-module-sd-du-shield-tft-avec-arduino-mega/