New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MEGA_SOFT_SPI set as 1 leads to failure in compiling (SD-library, IDE 1.6.x) #3556

Closed
feranick opened this Issue Jul 20, 2015 · 5 comments

Comments

6 participants
@feranick

feranick commented Jul 20, 2015

When:
#define MEGA_SOFT_SPI 1
in libraries/SD/utilities/SD2Card.h (in order to use software pins for SPI with MEGA boards), IDE fails to compile (error message below). This only happens for IDE 1.6.x. When used with 1.0.5, compilation proceeds as intended and the MEGA is using software pins for SPI. This makes the library useless with 1.6.x, and only 1.0.5 can be used.

This happens on any version of IDE (up to 1.6.5_r3) on OS X 10.10.4

/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:5: error: 'SPI' was not declared in this scope
     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:5: error: 'SPI' was not declared in this scope
     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:275:3: error: 'SPI' was not declared in this scope
   SPI.beginTransaction(settings);
   ^
/Applications/Arduino.app/Contents/Java/libraries/SD/src/utility/Sd2Card.cpp:275:24: 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::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:57: error: 'SPI_MODE0' 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.
@facchinm

This comment has been minimized.

Show comment
Hide comment
@facchinm

facchinm Jul 21, 2015

Member

Hi @feranick , you also need to comment out #define USE_SPI_LIB from both Sd2Card.h and Sd2Card.cpp. Probably cpp define is a bug so thank you for the report.
I'll wait for your feedback before closing the issue

Member

facchinm commented Jul 21, 2015

Hi @feranick , you also need to comment out #define USE_SPI_LIB from both Sd2Card.h and Sd2Card.cpp. Probably cpp define is a bug so thank you for the report.
I'll wait for your feedback before closing the issue

@facchinm facchinm self-assigned this Jul 21, 2015

@feranick

This comment has been minimized.

Show comment
Hide comment
@feranick

feranick Jul 21, 2015

Thanks, Martino. Commenting the string fixed it.
Thanks again for the fast reply.
Nicola

feranick commented Jul 21, 2015

Thanks, Martino. Commenting the string fixed it.
Thanks again for the fast reply.
Nicola

@facchinm

This comment has been minimized.

Show comment
Hide comment
@facchinm

facchinm Jul 22, 2015

Member

👍

Member

facchinm commented Jul 22, 2015

👍

@facchinm facchinm closed this Jul 22, 2015

@ffissore ffissore modified the milestone: Release 1.6.6 Aug 3, 2015

@MagisterLudiFRZ

This comment has been minimized.

Show comment
Hide comment
@MagisterLudiFRZ

MagisterLudiFRZ Jul 25, 2017

I was faced with the same problem and I comment out #define USE_SPI_LIB from both Sd2Card.h and Sd2Card.cpp. But IDE fails to compile again.

Arduino: 1.8.3 (Windows 8), Board:"Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)"

C:\Program Files (x86)\Arduino\libraries\SD\src\utility\Sd2Card.cpp: In member function 'uint8_t Sd2Card::setSpiClock(uint32_t)':

C:\Program Files (x86)\Arduino\libraries\SD\src\utility\Sd2Card.cpp:546:3: error: 'settings' was not declared in this scope

   settings = SPISettings(clock, MSBFIRST, SPI_MODE0);

   ^

C:\Program Files (x86)\Arduino\libraries\SD\src\utility\Sd2Card.cpp:546:43: error: 'SPI_MODE0' was not declared in this scope

   settings = SPISettings(clock, MSBFIRST, SPI_MODE0);

                                           ^

C:\Program Files (x86)\Arduino\libraries\SD\src\utility\Sd2Card.cpp:546:52: error: 'SPISettings' was not declared in this scope

   settings = SPISettings(clock, MSBFIRST, SPI_MODE0);

                                                    ^

exit status 1
Error compiling for Arduino/Genuino Mega or Mega 2560.

I'm trying to run example "CardInfo"

MagisterLudiFRZ commented Jul 25, 2017

I was faced with the same problem and I comment out #define USE_SPI_LIB from both Sd2Card.h and Sd2Card.cpp. But IDE fails to compile again.

Arduino: 1.8.3 (Windows 8), Board:"Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)"

C:\Program Files (x86)\Arduino\libraries\SD\src\utility\Sd2Card.cpp: In member function 'uint8_t Sd2Card::setSpiClock(uint32_t)':

C:\Program Files (x86)\Arduino\libraries\SD\src\utility\Sd2Card.cpp:546:3: error: 'settings' was not declared in this scope

   settings = SPISettings(clock, MSBFIRST, SPI_MODE0);

   ^

C:\Program Files (x86)\Arduino\libraries\SD\src\utility\Sd2Card.cpp:546:43: error: 'SPI_MODE0' was not declared in this scope

   settings = SPISettings(clock, MSBFIRST, SPI_MODE0);

                                           ^

C:\Program Files (x86)\Arduino\libraries\SD\src\utility\Sd2Card.cpp:546:52: error: 'SPISettings' was not declared in this scope

   settings = SPISettings(clock, MSBFIRST, SPI_MODE0);

                                                    ^

exit status 1
Error compiling for Arduino/Genuino Mega or Mega 2560.

I'm trying to run example "CardInfo"

@bpoag

This comment has been minimized.

Show comment
Hide comment
@bpoag

bpoag Jan 23, 2018

Same here. Compile fails on setSpiClock.

bpoag commented Jan 23, 2018

Same here. Compile fails on setSpiClock.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment