Author Topic: Errors compiling projects which depend on SD.h or SPI.h  (Read 3525 times)

diginerd

  • Newbie
  • *
  • Posts: 2
Errors compiling projects which depend on SD.h or SPI.h
« on: October 13, 2015, 09:12:19 am »
I'm having issues with the bundled SPI library when compiling even a basic application just based on the following includes:
Code: [Select]
#include <SPI.h>
#include <SD.h>

I get the following errors:
Code: [Select]
pplications/Arduino.app/Contents/Java/libraries/SD/src/utility/Sd2Card.cpp:27:8: error: 'SPISettings' does not name a type
 static SPISettings settings;
        ^
/Applications/Arduino.app/Contents/Java/libraries/SD/src/utility/Sd2Card.cpp: In member function 'void Sd2Card::chipSelectHigh()':
/Applications/Arduino.app/Contents/Java/libraries/SD/src/utility/Sd2Card.cpp:167:9: error: 'class SPIClass' has no member named 'endTransaction'
     SPI.endTransaction();
         ^
/Applications/Arduino.app/Contents/Java/libraries/SD/src/utility/Sd2Card.cpp: In member function 'void Sd2Card::chipSelectLow()':
/Applications/Arduino.app/Contents/Java/libraries/SD/src/utility/Sd2Card.cpp:176:9: error: 'class SPIClass' has no member named 'beginTransaction'
     SPI.beginTransaction(settings);
         ^
/Applications/Arduino.app/Contents/Java/libraries/SD/src/utility/Sd2Card.cpp:176:26: error: 'settings' was not declared in this scope
     SPI.beginTransaction(settings);
                          ^
/Applications/Arduino.app/Contents/Java/libraries/SD/src/utility/Sd2Card.cpp: In member function 'uint8_t Sd2Card::init(uint8_t, uint8_t)':
/Applications/Arduino.app/Contents/Java/libraries/SD/src/utility/Sd2Card.cpp:269:3: error: 'settings' was not declared in this scope
   settings = SPISettings(250000, MSBFIRST, SPI_MODE0);
   ^
/Applications/Arduino.app/Contents/Java/libraries/SD/src/utility/Sd2Card.cpp:269:53: error: 'SPISettings' was not declared in this scope
   settings = SPISettings(250000, MSBFIRST, SPI_MODE0);
                                                     ^
/Applications/Arduino.app/Contents/Java/libraries/SD/src/utility/Sd2Card.cpp:275:7: error: 'class SPIClass' has no member named 'beginTransaction'
   SPI.beginTransaction(settings);
       ^
/Applications/Arduino.app/Contents/Java/libraries/SD/src/utility/Sd2Card.cpp:279:7: error: 'class SPIClass' has no member named 'endTransaction'
   SPI.endTransaction();
       ^
/Applications/Arduino.app/Contents/Java/libraries/SD/src/utility/Sd2Card.cpp: In member function 'uint8_t Sd2Card::setSckRate(uint8_t)':
/Applications/Arduino.app/Contents/Java/libraries/SD/src/utility/Sd2Card.cpp:518:14: error: 'settings' was not declared in this scope
     case 0:  settings = SPISettings(25000000, MSBFIRST, SPI_MODE0); break;
              ^
/Applications/Arduino.app/Contents/Java/libraries/SD/src/utility/Sd2Card.cpp:518:66: error: 'SPISettings' was not declared in this scope
     case 0:  settings = SPISettings(25000000, MSBFIRST, SPI_MODE0); break;
                                                                  ^
Error compiling.
Does anyone know how to resolve this?

diginerd

  • Newbie
  • *
  • Posts: 2
Re: Errors compiling projects which depend on SD.h or SPI.h
« Reply #1 on: October 18, 2015, 07:58:29 am »
If others encounter the same issues, they may be resolved by copying the SD library from the Arduino 1.5 github branch. Newer and older versions of the SD card library are not compatible with the SPI library which comes with the DigiX.

Are there any plans to update the SPI library?