Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

SPI library compile errors when compiling for Arduino Due #2516

Closed
Labels
Board: Arduino DueApplies only to the Due Library: SPIThe SPI Arduino library Type: InvalidOff topic for this repository, or a bug report determined to not actually represent a bug
@dinodev76

Description

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Board: Arduino DueApplies only to the Due Library: SPIThe SPI Arduino library Type: InvalidOff topic for this repository, or a bug report determined to not actually represent a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /