Go Down

Topic: SPI error while using WiFly shield on Arduino Due (Read 855 times) previous topic - next topic

elnhege

Hi, I recently started with Arduino and now I want to add a WiFly shield to the Due.
When trying to run one of the demo applications (SpiUartTerminal) I got an error during the verification.
Code: [Select]
_Spi.cpp: In member function 'void SpiDevice::_initSpi()':
_Spi.cpp:62: error: 'SPCR' was not declared in this scope
_Spi.cpp:62: error: 'SPE' was not declared in this scope
_Spi.cpp:62: error: 'MSTR' was not declared in this scope
_Spi.cpp:62: error: 'SPR1' was not declared in this scope
_Spi.cpp:62: error: 'SPR0' was not declared in this scope
_Spi.cpp:63: error: 'SPSR' was not declared in this scope
_Spi.cpp:63: error: 'SPI2X' was not declared in this scope
_Spi.cpp: In member function 'byte SpiDevice::transfer(byte)':
_Spi.cpp:104: error: 'SPDR' was not declared in this scope
_Spi.cpp:105: error: 'SPSR' was not declared in this scope
_Spi.cpp:105: error: 'SPIF' was not declared in this scope


I assume it has to do with the fact that I am using the Due.

Any idea how to solve this error?

Thanks in advance,
Henk

Nick Gammon

Almost certainly the Due has completely different register names. I'll move this thread to the Due section.
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

Graynomad

Yes, any code written using AVR-specific register names will not work on the Due, I don't know what "SpiUartTerminal" is but it obviously falls into that category.

_____
Rob
Rob Gray aka the GRAYnomad www.robgray.com

steinvb12

#3
Oct 02, 2015, 08:18 pm Last Edit: Oct 05, 2015, 05:29 pm by steinvb12
This person got it to work...

http://forum.arduino.cc/index.php?topic=155436.0

Is this really all that's needed - just to add one line to the sketch?

steinvb12

I got it to work.

Here is what you need to do...
1. Remove the _SPI.cpp and _SPI.h files from the Wifly library. This will now compile because it will use the Arduino SPI library.

2. Add this line in setup...
pinMode(10, OUTPUT);

That's it. I was able to get into command mode and connect to a network and transmit data.

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy