Skip to content
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

SPI library compile errors when compiling for Arduino Due #2516

Closed
dinodev76 opened this issue Dec 28, 2014 · 1 comment
Closed

SPI library compile errors when compiling for Arduino Due #2516

dinodev76 opened this issue Dec 28, 2014 · 1 comment
Labels
Board: Arduino Due Applies only to the Due Library: SPI The SPI Arduino library Type: Invalid Off topic for this repository, or a bug report determined to not actually represent a bug

Comments

@dinodev76
Copy link

Can someone please tell me where to find the SPI library code that will work for an Arduino Due? I'm getting the following compile errors when using the library found at https://github.com/arduino/Arduino/tree/master/libraries/SPI:

Compiling 'SDCardInfo' for 'Arduino Due (Programming Port)'
SDCardInfo.ino:In file included from
SPI.h:In member function 'void SPISettings::init_AlwaysInline(uint32_t, uint8_t, uint8_t)'
SPI.h:146:16: error: 'SPE' was not declared in this scope
:0) |
:^
SPI.h:146:19: error: '_BV' was not declared in this scope
:0) |
:^
SPI.h:146:27: error: 'MSTR' was not declared in this scope
:0) |
:^
SPI.h:146:65: error: 'DORD' was not declared in this scope
:0) |
:^
SPI.h:In static member function 'static void SPIClass::beginTransaction(SPISettings)'
SPI.h:180:22: error: 'SREG' was not declared in this scope
:uint8_t sreg = SREG;
:^
SPI.h:203:5: error: 'SPCR' was not declared in this scope
:SPCR = settings.spcr;
:^
SPI.h:204:5: error: 'SPSR' was not declared in this scope
:SPSR = settings.spsr;
:^
SPI.h:In static member function 'static uint8_t SPIClass::transfer(uint8_t)'
SPI.h:209:5: error: 'SPDR' was not declared in this scope
:SPDR = data;
:^
SPI.h:217:14: error: 'SPSR' was not declared in this scope
:while (!(SPSR & _BV(SPIF))) ; \ wait
:^
SPI.h:217:25: error: 'SPIF' was not declared in this scope
:while (!(SPSR & _BV(SPIF))) ; \ wait
:^
SPI.h:217:29: error: '_BV' was not declared in this scope
:while (!(SPSR & _BV(SPIF))) ; \ wait
:^
SPI.h:In static member function 'static uint16_t SPIClass::transfer16(uint16_t)'
SPI.h:223:11: error: 'SPCR' was not declared in this scope
:if (!(SPCR & _BV(DORD))) {
:^
SPI.h:223:22: error: 'DORD' was not declared in this scope
:if (!(SPCR & _BV(DORD))) {
:^
SPI.h:223:26: error: '_BV' was not declared in this scope
:if (!(SPCR & _BV(DORD))) {
:^
SPI.h:224:7: error: 'SPDR' was not declared in this scope
:SPDR = in.msb;
:^
SPI.h:226:16: error: 'SPSR' was not declared in this scope
:while (!(SPSR & _BV(SPIF))) ;
:^
SPI.h:226:27: error: 'SPIF' was not declared in this scope
:while (!(SPSR & _BV(SPIF))) ;
:^
SPI.h:230:16: error: 'SPSR' was not declared in this scope
:while (!(SPSR & _BV(SPIF))) ;
:^
SPI.h:230:27: error: 'SPIF' was not declared in this scope
:while (!(SPSR & _BV(SPIF))) ;
:^
SPI.h:233:7: error: 'SPDR' was not declared in this scope
:SPDR = in.lsb;
:^
SPI.h:235:16: error: 'SPSR' was not declared in this scope
:while (!(SPSR & _BV(SPIF))) ;
:^
SPI.h:235:27: error: 'SPIF' was not declared in this scope
:while (!(SPSR & _BV(SPIF))) ;
:^
SPI.h:239:16: error: 'SPSR' was not declared in this scope
:while (!(SPSR & BV(SPIF))) ;
:^
SPI.h:239:27: error: 'SPIF' was not declared in this scope
:while (!(SPSR & BV(SPIF))) ;
:^
SPI.h:In static member function 'static void SPIClass::transfer(void
, size_t)'
SPI.h:247:5: error: 'SPDR' was not declared in this scope
:SPDR = p;
:^
SPI.h:250:16: error: 'SPSR' was not declared in this scope
:while (!(SPSR & _BV(SPIF))) ;
:^
SPI.h:250:27: error: 'SPIF' was not declared in this scope
:while (!(SPSR & _BV(SPIF))) ;
:^
SPI.h:250:31: error: '_BV' was not declared in this scope
:while (!(SPSR & _BV(SPIF))) ;
:^
SPI.h:255:14: error: 'SPSR' was not declared in this scope
:while (!(SPSR & _BV(SPIF))) ;
:^
SPI.h:255:25: error: 'SPIF' was not declared in this scope
:while (!(SPSR & _BV(SPIF))) ;
:^
SPI.h:255:29: error: '_BV' was not declared in this scope
:while (!(SPSR & _BV(SPIF))) ;
:^
SPI.h:In static member function 'static void SPIClass::endTransaction()'
SPI.h:281:9: error: 'SREG' was not declared in this scope
:SREG = interruptSave;
:^
SPI.h:In static member function 'static void SPIClass::setBitOrder(uint8_t)'
SPI.h:292:31: error: 'SPCR' was not declared in this scope
:if (bitOrder == LSBFIRST) SPCR |= _BV(DORD);
:^
SPI.h:292:43: error: 'DORD' was not declared in this scope
:if (bitOrder == LSBFIRST) SPCR |= _BV(DORD);
:^
SPI.h:292:47: error: '_BV' was not declared in this scope
:if (bitOrder == LSBFIRST) SPCR |= _BV(DORD);
:^
SPI.h:293:10: error: 'SPCR' was not declared in this scope
:else SPCR &= ~(_BV(DORD));
:^
SPI.h:293:24: error: 'DORD' was not declared in this scope
:else SPCR &= ~(_BV(DORD));
:^
SPI.h:293:28: error: '_BV' was not declared in this scope
:else SPCR &= ~(_BV(DORD));
:^
SPI.h:In static member function 'static void SPIClass::setDataMode(uint8_t)'
SPI.h:298:5: error: 'SPCR' was not declared in this scope
:SPCR = (SPCR & ~SPI_MODE_MASK) | dataMode;
:^
SPI.h:In static member function 'static void SPIClass::setClockDivider(uint8_t)'
SPI.h:303:5: error: 'SPCR' was not declared in this scope
:SPCR = (SPCR & ~SPI_CLOCK_MASK) | (clockDiv & SPI_CLOCK_MASK);
:^
SPI.h:304:5: error: 'SPSR' was not declared in this scope
:SPSR = (SPSR & ~SPI_2XCLOCK_MASK) | ((clockDiv >> 2) & SPI_2XCLOCK_MASK);
:^
SPI.h:In static member function 'static void SPIClass::attachInterrupt()'
SPI.h:309:42: error: 'SPCR' was not declared in this scope
:inline static void attachInterrupt() { SPCR |= _BV(SPIE); }
:^
SPI.h:309:54: error: 'SPIE' was not declared in this scope
:inline static void attachInterrupt() { SPCR |= _BV(SPIE); }
:^
SPI.h:309:58: error: '_BV' was not declared in this scope
:inline static void attachInterrupt() { SPCR |= _BV(SPIE); }
:^
SPI.h:In static member function 'static void SPIClass::detachInterrupt()'
SPI.h:310:42: error: 'SPCR' was not declared in this scope
:inline static void detachInterrupt() { SPCR &= ~_BV(SPIE); }
:^
SPI.h:310:55: error: 'SPIE' was not declared in this scope
:inline static void detachInterrupt() { SPCR &= ~_BV(SPIE); }
:^
SPI.h:310:59: error: '_BV' was not declared in this scope
:inline static void detachInterrupt() { SPCR &= ~_BV(SPIE); }
:^
SPI.cpp:In file included from
SPI.h:In member function 'void SPISettings::init_AlwaysInline(uint32_t, uint8_t, uint8_t)'
SPI.h:146:16: error: 'SPE' was not declared in this scope
:0) |
:^
SPI.h:146:19: error: '_BV' was not declared in this scope
:0) |
:^
SPI.h:146:27: error: 'MSTR' was not declared in this scope
:0) |
:^
SPI.h:146:65: error: 'DORD' was not declared in this scope
:0) |
:^
SPI.h:In static member function 'static void SPIClass::beginTransaction(SPISettings)'
SPI.h:180:22: error: 'SREG' was not declared in this scope
:uint8_t sreg = SREG;
:^
SPI.h:203:5: error: 'SPCR' was not declared in this scope
:SPCR = settings.spcr;
:^
SPI.h:204:5: error: 'SPSR' was not declared in this scope
:SPSR = settings.spsr;
:^
SPI.h:In static member function 'static uint8_t SPIClass::transfer(uint8_t)'
SPI.h:209:5: error: 'SPDR' was not declared in this scope
:SPDR = data;
:^
SPI.h:217:14: error: 'SPSR' was not declared in this scope
:while (!(SPSR & _BV(SPIF))) ; \ wait
:^
SPI.h:217:25: error: 'SPIF' was not declared in this scope
:while (!(SPSR & _BV(SPIF))) ; \ wait
:^
SPI.h:217:29: error: '_BV' was not declared in this scope
:while (!(SPSR & _BV(SPIF))) ; \ wait
:^
SPI.h:In static member function 'static uint16_t SPIClass::transfer16(uint16_t)'
SPI.h:223:11: error: 'SPCR' was not declared in this scope
:if (!(SPCR & _BV(DORD))) {
:^
SPI.h:223:22: error: 'DORD' was not declared in this scope
:if (!(SPCR & _BV(DORD))) {
:^
SPI.h:223:26: error: '_BV' was not declared in this scope
:if (!(SPCR & _BV(DORD))) {
:^
SPI.h:224:7: error: 'SPDR' was not declared in this scope
:SPDR = in.msb;
:^
SPI.h:226:16: error: 'SPSR' was not declared in this scope
:while (!(SPSR & _BV(SPIF))) ;
:^
SPI.h:226:27: error: 'SPIF' was not declared in this scope
:while (!(SPSR & _BV(SPIF))) ;
:^
SPI.h:230:16: error: 'SPSR' was not declared in this scope
:while (!(SPSR & _BV(SPIF))) ;
:^
SPI.h:230:27: error: 'SPIF' was not declared in this scope
:while (!(SPSR & _BV(SPIF))) ;
:^
SPI.h:233:7: error: 'SPDR' was not declared in this scope
:SPDR = in.lsb;
:^
SPI.h:235:16: error: 'SPSR' was not declared in this scope
:while (!(SPSR & _BV(SPIF))) ;
:^
SPI.h:235:27: error: 'SPIF' was not declared in this scope
:while (!(SPSR & _BV(SPIF))) ;
:^
SPI.h:239:16: error: 'SPSR' was not declared in this scope
:while (!(SPSR & _BV(SPIF))) ;
:^
SPI.h:239:27: error: 'SPIF' was not declared in this scope
:while (!(SPSR & BV(SPIF))) ;
:^
SPI.h:In static member function 'static void SPIClass::transfer(void
, size_t)'
SPI.h:247:5: error: 'SPDR' was not declared in this scope
:SPDR = _p;
:^
SPI.h:250:16: error: 'SPSR' was not declared in this scope
:while (!(SPSR & _BV(SPIF))) ;
:^
SPI.h:250:27: error: 'SPIF' was not declared in this scope
:while (!(SPSR & _BV(SPIF))) ;
:^
SPI.h:250:31: error: '_BV' was not declared in this scope
:while (!(SPSR & _BV(SPIF))) ;
:^
SPI.h:255:14: error: 'SPSR' was not declared in this scope
:while (!(SPSR & _BV(SPIF))) ;
:^
SPI.h:255:25: error: 'SPIF' was not declared in this scope
:while (!(SPSR & _BV(SPIF))) ;
:^
SPI.h:255:29: error: '_BV' was not declared in this scope
:while (!(SPSR & _BV(SPIF))) ;
:^
SPI.h:In static member function 'static void SPIClass::endTransaction()'
SPI.h:281:9: error: 'SREG' was not declared in this scope
:SREG = interruptSave;
:^
SPI.h:In static member function 'static void SPIClass::setBitOrder(uint8_t)'
SPI.h:292:31: error: 'SPCR' was not declared in this scope
:if (bitOrder == LSBFIRST) SPCR |= _BV(DORD);
:^
SPI.h:292:43: error: 'DORD' was not declared in this scope
:if (bitOrder == LSBFIRST) SPCR |= _BV(DORD);
:^
SPI.h:292:47: error: '_BV' was not declared in this scope
:if (bitOrder == LSBFIRST) SPCR |= _BV(DORD);
:^
SPI.h:293:10: error: 'SPCR' was not declared in this scope
:else SPCR &= ~(_BV(DORD));
:^
SPI.h:293:24: error: 'DORD' was not declared in this scope
:else SPCR &= ~(_BV(DORD));
:^
SPI.h:293:28: error: '_BV' was not declared in this scope
:else SPCR &= ~(_BV(DORD));
:^
SPI.h:In static member function 'static void SPIClass::setDataMode(uint8_t)'
SPI.h:298:5: error: 'SPCR' was not declared in this scope
:SPCR = (SPCR & ~SPI_MODE_MASK) | dataMode;
:^
SPI.h:In static member function 'static void SPIClass::setClockDivider(uint8_t)'
SPI.h:303:5: error: 'SPCR' was not declared in this scope
:SPCR = (SPCR & ~SPI_CLOCK_MASK) | (clockDiv & SPI_CLOCK_MASK);
:^
SPI.h:304:5: error: 'SPSR' was not declared in this scope
:SPSR = (SPSR & ~SPI_2XCLOCK_MASK) | ((clockDiv >> 2) & SPI_2XCLOCK_MASK);
:^
SPI.h:In static member function 'static void SPIClass::attachInterrupt()'
SPI.h:309:42: error: 'SPCR' was not declared in this scope
:inline static void attachInterrupt() { SPCR |= _BV(SPIE); }
:^
SPI.h:309:54: error: 'SPIE' was not declared in this scope
:inline static void attachInterrupt() { SPCR |= _BV(SPIE); }
:^
SPI.h:309:58: error: '_BV' was not declared in this scope
:inline static void attachInterrupt() { SPCR |= _BV(SPIE); }
:^
SPI.h:In static member function 'static void SPIClass::detachInterrupt()'
SPI.h:310:42: error: 'SPCR' was not declared in this scope
:inline static void detachInterrupt() { SPCR &= ~_BV(SPIE); }
:^
SPI.h:310:55: error: 'SPIE' was not declared in this scope
:inline static void detachInterrupt() { SPCR &= ~_BV(SPIE); }
:^
SPI.h:310:59: error: '_BV' was not declared in this scope
:inline static void detachInterrupt() { SPCR &= ~_BV(SPIE); }
:^
SPI.cpp:In static member function 'static void SPIClass::begin()'
SPI.cpp:28:18: error: 'SREG' was not declared in this scope
:uint8_t sreg = SREG;
:^
SPI.cpp:42:5: error: 'SPCR' was not declared in this scope
:SPCR |= _BV(MSTR);
:^
SPI.cpp:42:17: error: 'MSTR' was not declared in this scope
:SPCR |= _BV(MSTR);
:^
SPI.cpp:42:21: error: '_BV' was not declared in this scope
:SPCR |= _BV(MSTR);
:^
SPI.cpp:43:17: error: 'SPE' was not declared in this scope
:SPCR |= _BV(SPE);
:^
SPI.cpp:In static member function 'static void SPIClass::end()'
SPI.cpp:59:18: error: 'SREG' was not declared in this scope
:uint8_t sreg = SREG;
:^
SPI.cpp:66:5: error: 'SPCR' was not declared in this scope
:SPCR &= ~_BV(SPE);
:^
SPI.cpp:66:18: error: 'SPE' was not declared in this scope
:SPCR &= ~_BV(SPE);
:^
SPI.cpp:66:21: error: '_BV' was not declared in this scope
:SPCR &= ~BV(SPE);
:^
SPI.cpp:In static member function 'static void SPIClass::usingInterrupt(uint8_t)'
SPI.cpp:115:18: error: 'SREG' was not declared in this scope
:uint8_t sreg = SREG;
:^
SPI.cpp:In static member function 'static void SPIClass::notUsingInterrupt(uint8_t)'
SPI.cpp:158:18: error: 'SREG' was not declared in this scope
:uint8_t sreg = SREG;
:^
Sd2Card.cpp:In function 'void spiSend(uint8_t)'
Sd2Card.cpp:33:3: error: 'SPDR' was not declared in this scope
:SPDR = b;
:^
Sd2Card.cpp:34:12: error: 'SPSR' was not declared in this scope
:while (!(SPSR & (1 << SPIF)))
:^
Sd2Card.cpp:34:25: error: 'SPIF' was not declared in this scope
:while (!(SPSR & (1 << SPIF)))
:^
Sd2Card.cpp:In function 'uint8_t spiRec()'
Sd2Card.cpp:44:10: error: 'SPDR' was not declared in this scope
:return SPDR;
:^
Sd2Card.cpp:In member function 'uint8_t Sd2Card::init(uint8_t, uint8_t)'
Sd2Card.cpp:256:3: error: 'SPCR' was not declared in this scope
:SPCR = (1 << SPE) | (1 << MSTR) | (1 << SPR1) | (1 << SPR0);
:^
Sd2Card.cpp:256:16: error: 'SPE' was not declared in this scope
:SPCR = (1 << SPE) | (1 << MSTR) | (1 << SPR1) | (1 << SPR0);
:^
Sd2Card.cpp:256:29: error: 'MSTR' was not declared in this scope
:SPCR = (1 << SPE) | (1 << MSTR) | (1 << SPR1) | (1 << SPR0);
:^
Sd2Card.cpp:256:43: error: 'SPR1' was not declared in this scope
:SPCR = (1 << SPE) | (1 << MSTR) | (1 << SPR1) | (1 << SPR0);
:^
Sd2Card.cpp:256:57: error: 'SPR0' was not declared in this scope
:SPCR = (1 << SPE) | (1 << MSTR) | (1 << SPR1) | (1 << SPR0);
:^
Sd2Card.cpp:258:3: error: 'SPSR' was not declared in this scope
:SPSR &= ~(1 << SPI2X);
:^
Sd2Card.cpp:258:18: error: 'SPI2X' was not declared in this scope
:SPSR &= ~(1 << SPI2X);
:^
Sd2Card.cpp:In member function 'uint8_t Sd2Card::readData(uint32_t, uint16_t, uint16_t, uint8_t
)'
Sd2Card.cpp:393:3: error: 'SPDR' was not declared in this scope
:SPDR = 0XFF;
:^
Sd2Card.cpp:397:14: error: 'SPSR' was not declared in this scope
:while (!(SPSR & (1 << SPIF)))
:^
Sd2Card.cpp:397:27: error: 'SPIF' was not declared in this scope
:while (!(SPSR & (1 << SPIF)))
:^
Sd2Card.cpp:404:14: error: 'SPSR' was not declared in this scope
:while (!(SPSR & (1 << SPIF)))
:^
Sd2Card.cpp:404:27: error: 'SPIF' was not declared in this scope
:while (!(SPSR & (1 << SPIF)))
:^
Sd2Card.cpp:410:12: error: 'SPSR' was not declared in this scope
:while (!(SPSR & (1 << SPIF)))
:^
Sd2Card.cpp:410:25: error: 'SPIF' was not declared in this scope
:while (!(SPSR & (1 << SPIF)))
:^
Sd2Card.cpp:In member function 'void Sd2Card::readEnd()'
Sd2Card.cpp:444:5: error: 'SPDR' was not declared in this scope
:SPDR = 0XFF;
:^
Sd2Card.cpp:446:16: error: 'SPSR' was not declared in this scope
:while (!(SPSR & (1 << SPIF)))
:^
Sd2Card.cpp:446:29: error: 'SPIF' was not declared in this scope
:while (!(SPSR & (1 << SPIF)))
:^
Sd2Card.cpp:451:14: error: 'SPSR' was not declared in this scope
:while (!(SPSR & (1 << SPIF)))
:^
Sd2Card.cpp:451:27: error: 'SPIF' was not declared in this scope
:while (!(SPSR & (1 << SPIF)))
:^
Sd2Card.cpp:In member function 'uint8_t Sd2Card::setSckRate(uint8_t)'
Sd2Card.cpp:501:5: error: 'SPSR' was not declared in this scope
:SPSR &= ~(1 << SPI2X);
:^
Sd2Card.cpp:501:20: error: 'SPI2X' was not declared in this scope
:SPSR &= ~(1 << SPI2X);
:^
Sd2Card.cpp:503:5: error: 'SPSR' was not declared in this scope
:SPSR |= (1 << SPI2X);
:^
Sd2Card.cpp:503:19: error: 'SPI2X' was not declared in this scope
:SPSR |= (1 << SPI2X);
:^
Sd2Card.cpp:505:3: error: 'SPCR' was not declared in this scope
:SPCR &= ~((1 <<SPR1) | (1 << SPR0));
:^
Sd2Card.cpp:505:18: error: 'SPR1' was not declared in this scope
:SPCR &= ~((1 <<SPR1) | (1 << SPR0));
:^
Sd2Card.cpp:505:32: error: 'SPR0' was not declared in this scope
:SPCR &= ~((1 <<SPR1) | (1 << SPR0));
:^
Sd2Card.cpp:In member function 'uint8_t Sd2Card::writeData(uint8_t, const uint8_t
)'
Sd2Card.cpp:611:3: error: 'SPDR' was not declared in this scope
:SPDR = token;
:^
Sd2Card.cpp:615:14: error: 'SPSR' was not declared in this scope
:while (!(SPSR & (1 << SPIF)))
:^
Sd2Card.cpp:615:27: error: 'SPIF' was not declared in this scope
:while (!(SPSR & (1 << SPIF)))
:^
Sd2Card.cpp:618:14: error: 'SPSR' was not declared in this scope
:while (!(SPSR & (1 << SPIF)))
:^
Sd2Card.cpp:618:27: error: 'SPIF' was not declared in this scope
:while (!(SPSR & (1 << SPIF)))
:^
Sd2Card.cpp:624:12: error: 'SPSR' was not declared in this scope
:while (!(SPSR & (1 << SPIF)))
:^
Sd2Card.cpp:624:25: error: 'SPIF' was not declared in this scope
:while (!(SPSR & (1 << SPIF)))
:^
Sd2Card.cpp:In function 'uint8_t spiRec()'
Sd2Card.cpp:48:1: warning: control reaches end of non-void function [-Wreturn-type]
:}
:^
SdFile.cpp:In member function 'uint8_t SdFile::rmRfStar()'
SdFile.cpp:907:40: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
:if (curPosition
!= (32*(index + 1))) {
:^
Error compiling

@matthijskooijman
Copy link
Collaborator

The SPI library is shipped with the Arduino IDE, there is no reason to download it separately.

Only Arduino IDE 1.5.x supports the Due, it ships two versions of the SPI library - one for AVR-based boards and one for the ARM-based Due.

@cmaglie cmaglie added Library: SPI The SPI Arduino library Type: Invalid Off topic for this repository, or a bug report determined to not actually represent a bug Board: Arduino Due Applies only to the Due labels Jan 27, 2015
@cmaglie cmaglie closed this as completed Jan 27, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Board: Arduino Due Applies only to the Due Library: SPI The SPI Arduino library Type: Invalid Off topic for this repository, or a bug report determined to not actually represent a bug
Projects
None yet
Development

No branches or pull requests

3 participants