Hello I know the atmega4808 is still kind of new to arduino. but I ran into a little compiling error.
It says there is a incompatable with the 4808 for the enc 28j60 library. below I'm attaching the example code and error of which came up. I'm unsure what to do or how to fix this. Can someone please help me?
// Present a "Will be back soon web page", as stand-in webserver.
// 2011-01-30 <jc@wippler.nl>
//
// License: GPLv2
#include <EtherCard.h>
#define STATIC 1 // set to 1 to disable DHCP (adjust myip/gwip values below)
#if STATIC
// ethernet interface ip address
static byte myip[] = {192,168,1,100};
// gateway ip address
static byte gwip[] = { 192,168,1,1 };
#endif
// ethernet mac address - must be unique on your network
static byte mymac[] = { 0x74,0x69,0x69,0x2D,0x30,0x31 };
byte Ethernet::buffer[500]; // tcp/ip send and receive buffer
const char page[] PROGMEM =
"HTTP/1.0 503 Service Unavailable\r\n"
"Content-Type: text/html\r\n"
"Retry-After: 600\r\n"
"\r\n"
"<html>"
"<head><title>"
"Service Temporarily Unavailable"
"</title></head>"
"<body>"
"<h3>This service is currently unavailable</h3>"
"<p><em>"
"The main server is currently off-line.<br />"
"Please try again later."
"</em></p>"
"</body>"
"</html>"
;
void setup(){
Serial.begin(57600);
Serial.println("\n[backSoon]");
// Change 'SS' to your Slave Select pin, if you arn't using the default pin
if (ether.begin(sizeof Ethernet::buffer, mymac, SS) == 0)
Serial.println( "Failed to access Ethernet controller");
#if STATIC
ether.staticSetup(myip, gwip);
#else
if (!ether.dhcpSetup())
Serial.println("DHCP failed");
#endif
ether.printIp("IP: ", ether.myip);
ether.printIp("GW: ", ether.gwip);
ether.printIp("DNS: ", ether.dnsip);
}
void loop(){
// wait for an incoming TCP packet, but ignore its contents
if (ether.packetLoop(ether.packetReceive())) {
memcpy_P(ether.tcpOffset(), page, sizeof page);
ether.httpServerReply(sizeof page - 1);
}
}
Error
WARNING: library EtherCard claims to run on avr architecture(s) and may be incompatible with your current board which runs on megaavr architecture(s).
C:\Users\jJc\Documents\Arduino\libraries\EtherCard\src\enc28j60.cpp: In static member function 'static void ENC28J60::initSPI()':
C:\Users\jJc\Documents\Arduino\libraries\EtherCard\src\enc28j60.cpp:245:5: error: 'SPCR' was not declared in this scope
SPCR = bit(SPE) | bit(MSTR); // 8 MHz @ 16
^~~~
C:\Users\jJc\Documents\Arduino\libraries\EtherCard\src\enc28j60.cpp:245:5: note: suggested alternative: 'SCL'
SPCR = bit(SPE) | bit(MSTR); // 8 MHz @ 16
^~~~
SCL
In file included from C:\Users\jJc\AppData\Local\Arduino15\packages\MegaCoreX\hardware\megaavr\1.0.8\cores\coreX-corefiles/api/ArduinoAPI.h:52:0,
from C:\Users\jJc\AppData\Local\Arduino15\packages\MegaCoreX\hardware\megaavr\1.0.8\cores\coreX-corefiles/Arduino.h:23,
from C:\Users\jJc\Documents\Arduino\libraries\EtherCard\src\enc28j60.cpp:12:
C:\Users\jJc\Documents\Arduino\libraries\EtherCard\src\enc28j60.cpp:245:16: error: 'SPE' was not declared in this scope
SPCR = bit(SPE) | bit(MSTR); // 8 MHz @ 16
^
C:\Users\jJc\AppData\Local\Arduino15\packages\MegaCoreX\hardware\megaavr\1.0.8\cores\coreX-corefiles/api/Common.h:77:25: note: in definition of macro 'bit'
#define bit(b) (1UL << (b))
^
C:\Users\jJc\Documents\Arduino\libraries\EtherCard\src\enc28j60.cpp:245:16: note: suggested alternative: 'PE'
SPCR = bit(SPE) | bit(MSTR); // 8 MHz @ 16
^
C:\Users\jJc\AppData\Local\Arduino15\packages\MegaCoreX\hardware\megaavr\1.0.8\cores\coreX-corefiles/api/Common.h:77:25: note: in definition of macro 'bit'
#define bit(b) (1UL << (b))
^
C:\Users\jJc\Documents\Arduino\libraries\EtherCard\src\enc28j60.cpp:245:27: error: 'MSTR' was not declared in this scope
SPCR = bit(SPE) | bit(MSTR); // 8 MHz @ 16
^
C:\Users\jJc\AppData\Local\Arduino15\packages\MegaCoreX\hardware\megaavr\1.0.8\cores\coreX-corefiles/api/Common.h:77:25: note: in definition of macro 'bit'
#define bit(b) (1UL << (b))
^
C:\Users\jJc\Documents\Arduino\libraries\EtherCard\src\enc28j60.cpp:245:27: note: suggested alternative: 'PSTR'
SPCR = bit(SPE) | bit(MSTR); // 8 MHz @ 16
^
C:\Users\jJc\AppData\Local\Arduino15\packages\MegaCoreX\hardware\megaavr\1.0.8\cores\coreX-corefiles/api/Common.h:77:25: note: in definition of macro 'bit'
#define bit(b) (1UL << (b))
^
C:\Users\jJc\Documents\Arduino\libraries\EtherCard\src\enc28j60.cpp:246:12: error: 'SPSR' was not declared in this scope
bitSet(SPSR, SPI2X);
^
C:\Users\jJc\AppData\Local\Arduino15\packages\MegaCoreX\hardware\megaavr\1.0.8\cores\coreX-corefiles/api/Common.h:72:30: note: in definition of macro 'bitSet'
#define bitSet(value, bit) ((value) |= (1UL << (bit)))
^~~~~
C:\Users\jJc\Documents\Arduino\libraries\EtherCard\src\enc28j60.cpp:246:12: note: suggested alternative: 'SS'
bitSet(SPSR, SPI2X);
^
C:\Users\jJc\AppData\Local\Arduino15\packages\MegaCoreX\hardware\megaavr\1.0.8\cores\coreX-corefiles/api/Common.h:72:30: note: in definition of macro 'bitSet'
#define bitSet(value, bit) ((value) |= (1UL << (bit)))
^~~~~
C:\Users\jJc\Documents\Arduino\libraries\EtherCard\src\enc28j60.cpp:246:18: error: 'SPI2X' was not declared in this scope
bitSet(SPSR, SPI2X);
^
C:\Users\jJc\AppData\Local\Arduino15\packages\MegaCoreX\hardware\megaavr\1.0.8\cores\coreX-corefiles/api/Common.h:72:49: note: in definition of macro 'bitSet'
#define bitSet(value, bit) ((value) |= (1UL << (bit)))
^~~
C:\Users\jJc\Documents\Arduino\libraries\EtherCard\src\enc28j60.cpp:246:18: note: suggested alternative: 'SPI_t'
bitSet(SPSR, SPI2X);
^
C:\Users\jJc\AppData\Local\Arduino15\packages\MegaCoreX\hardware\megaavr\1.0.8\cores\coreX-corefiles/api/Common.h:72:49: note: in definition of macro 'bitSet'
#define bitSet(value, bit) ((value) |= (1UL << (bit)))
^~~
C:\Users\jJc\Documents\Arduino\libraries\EtherCard\src\enc28j60.cpp: In function 'void xferSPI(byte)':
C:\Users\jJc\Documents\Arduino\libraries\EtherCard\src\enc28j60.cpp:260:5: error: 'SPDR' was not declared in this scope
SPDR = data;
^~~~
C:\Users\jJc\Documents\Arduino\libraries\EtherCard\src\enc28j60.cpp:260:5: note: suggested alternative: 'SDA'
SPDR = data;
^~~~
SDA
C:\Users\jJc\Documents\Arduino\libraries\EtherCard\src\enc28j60.cpp:261:14: error: 'SPSR' was not declared in this scope
while (!(SPSR&(1<<SPIF)))
^~~~
C:\Users\jJc\Documents\Arduino\libraries\EtherCard\src\enc28j60.cpp:261:14: note: suggested alternative: 'SS'
while (!(SPSR&(1<<SPIF)))
^~~~
SS
C:\Users\jJc\Documents\Arduino\libraries\EtherCard\src\enc28j60.cpp:261:23: error: 'SPIF' was not declared in this scope
while (!(SPSR&(1<<SPIF)))
^~~~
C:\Users\jJc\Documents\Arduino\libraries\EtherCard\src\enc28j60.cpp:261:23: note: suggested alternative: 'SPI0'
while (!(SPSR&(1<<SPIF)))
^~~~
SPI0
C:\Users\jJc\Documents\Arduino\libraries\EtherCard\src\enc28j60.cpp: In function 'byte readOp(byte, byte)':
C:\Users\jJc\Documents\Arduino\libraries\EtherCard\src\enc28j60.cpp:271:19: error: 'SPDR' was not declared in this scope
byte result = SPDR;
^~~~
C:\Users\jJc\Documents\Arduino\libraries\EtherCard\src\enc28j60.cpp:271:19: note: suggested alternative: 'SDA'
byte result = SPDR;
^~~~
SDA
C:\Users\jJc\Documents\Arduino\libraries\EtherCard\src\enc28j60.cpp: In function 'void readBuf(uint16_t, byte*)':
C:\Users\jJc\Documents\Arduino\libraries\EtherCard\src\enc28j60.cpp:290:9: error: 'SPDR' was not declared in this scope
SPDR = 0x00;
^~~~
C:\Users\jJc\Documents\Arduino\libraries\EtherCard\src\enc28j60.cpp:290:9: note: suggested alternative: 'SDA'
SPDR = 0x00;
^~~~
SDA
C:\Users\jJc\Documents\Arduino\libraries\EtherCard\src\enc28j60.cpp:292:22: error: 'SPSR' was not declared in this scope
while (!(SPSR & (1<<SPIF)))
^~~~
C:\Users\jJc\Documents\Arduino\libraries\EtherCard\src\enc28j60.cpp:292:22: note: suggested alternative: 'SS'
while (!(SPSR & (1<<SPIF)))
^~~~
SS
C:\Users\jJc\Documents\Arduino\libraries\EtherCard\src\enc28j60.cpp:292:33: error: 'SPIF' was not declared in this scope
while (!(SPSR & (1<<SPIF)))
^~~~
C:\Users\jJc\Documents\Arduino\libraries\EtherCard\src\enc28j60.cpp:292:33: note: suggested alternative: 'SPI0'
while (!(SPSR & (1<<SPIF)))
^~~~
SPI0
C:\Users\jJc\Documents\Arduino\libraries\EtherCard\src\enc28j60.cpp:298:18: error: 'SPSR' was not declared in this scope
while (!(SPSR & (1<<SPIF)))
^~~~
C:\Users\jJc\Documents\Arduino\libraries\EtherCard\src\enc28j60.cpp:298:18: note: suggested alternative: 'SS'
while (!(SPSR & (1<<SPIF)))
^~~~
SS
C:\Users\jJc\Documents\Arduino\libraries\EtherCard\src\enc28j60.cpp:298:29: error: 'SPIF' was not declared in this scope
while (!(SPSR & (1<<SPIF)))
^~~~
C:\Users\jJc\Documents\Arduino\libraries\EtherCard\src\enc28j60.cpp:298:29: note: suggested alternative: 'SPI0'
while (!(SPSR & (1<<SPIF)))
^~~~
SPI0
C:\Users\jJc\Documents\Arduino\libraries\EtherCard\src\enc28j60.cpp: In function 'void writeBuf(uint16_t, const byte*)':
C:\Users\jJc\Documents\Arduino\libraries\EtherCard\src\enc28j60.cpp:310:9: error: 'SPDR' was not declared in this scope
SPDR = *data++;
^~~~
C:\Users\jJc\Documents\Arduino\libraries\EtherCard\src\enc28j60.cpp:310:9: note: suggested alternative: 'SDA'
SPDR = *data++;
^~~~
SDA
C:\Users\jJc\Documents\Arduino\libraries\EtherCard\src\enc28j60.cpp:313:19: error: 'SPSR' was not declared in this scope
while (!(SPSR & (1<<SPIF)))
^~~~
C:\Users\jJc\Documents\Arduino\libraries\EtherCard\src\enc28j60.cpp:313:19: note: suggested alternative: 'SS'
while (!(SPSR & (1<<SPIF)))
^~~~
SS
C:\Users\jJc\Documents\Arduino\libraries\EtherCard\src\enc28j60.cpp:313:30: error: 'SPIF' was not declared in this scope
while (!(SPSR & (1<<SPIF)))
^~~~
C:\Users\jJc\Documents\Arduino\libraries\EtherCard\src\enc28j60.cpp:313:30: note: suggested alternative: 'SPI0'
while (!(SPSR & (1<<SPIF)))
^~~~
SPI0
C:\Users\jJc\Documents\Arduino\libraries\EtherCard\src\enc28j60.cpp:317:18: error: 'SPSR' was not declared in this scope
while (!(SPSR & (1<<SPIF)))
^~~~
C:\Users\jJc\Documents\Arduino\libraries\EtherCard\src\enc28j60.cpp:317:18: note: suggested alternative: 'SS'
while (!(SPSR & (1<<SPIF)))
^~~~
SS
C:\Users\jJc\Documents\Arduino\libraries\EtherCard\src\enc28j60.cpp:317:29: error: 'SPIF' was not declared in this scope
while (!(SPSR & (1<<SPIF)))
^~~~
C:\Users\jJc\Documents\Arduino\libraries\EtherCard\src\enc28j60.cpp:317:29: note: suggested alternative: 'SPI0'
while (!(SPSR & (1<<SPIF)))
^~~~
SPI0
In file included from C:\Users\jJc\AppData\Local\Arduino15\packages\MegaCoreX\hardware\megaavr\1.0.8\cores\coreX-corefiles/api/ArduinoAPI.h:52:0,
from C:\Users\jJc\AppData\Local\Arduino15\packages\MegaCoreX\hardware\megaavr\1.0.8\cores\coreX-corefiles/Arduino.h:23,
from C:\Users\jJc\Documents\Arduino\libraries\EtherCard\src\enc28j60.cpp:12:
C:\Users\jJc\Documents\Arduino\libraries\EtherCard\src\enc28j60.cpp: In static member function 'static byte ENC28J60::initialize(uint16_t, const byte*, byte)':
C:\Users\jJc\Documents\Arduino\libraries\EtherCard\src\enc28j60.cpp:371:17: error: 'SPCR' was not declared in this scope
if (bitRead(SPCR, SPE) == 0)
^
C:\Users\jJc\AppData\Local\Arduino15\packages\MegaCoreX\hardware\megaavr\1.0.8\cores\coreX-corefiles/api/Common.h:71:32: note: in definition of macro 'bitRead'
#define bitRead(value, bit) (((value) >> (bit)) & 0x01)
^~~~~
C:\Users\jJc\Documents\Arduino\libraries\EtherCard\src\enc28j60.cpp:371:17: note: suggested alternative: 'SCL'
if (bitRead(SPCR, SPE) == 0)
^
C:\Users\jJc\AppData\Local\Arduino15\packages\MegaCoreX\hardware\megaavr\1.0.8\cores\coreX-corefiles/api/Common.h:71:32: note: in definition of macro 'bitRead'
#define bitRead(value, bit) (((value) >> (bit)) & 0x01)
^~~~~
C:\Users\jJc\Documents\Arduino\libraries\EtherCard\src\enc28j60.cpp:371:23: error: 'SPE' was not declared in this scope
if (bitRead(SPCR, SPE) == 0)
^
C:\Users\jJc\AppData\Local\Arduino15\packages\MegaCoreX\hardware\megaavr\1.0.8\cores\coreX-corefiles/api/Common.h:71:43: note: in definition of macro 'bitRead'
#define bitRead(value, bit) (((value) >> (bit)) & 0x01)
^~~
C:\Users\jJc\Documents\Arduino\libraries\EtherCard\src\enc28j60.cpp:371:23: note: suggested alternative: 'PE'
if (bitRead(SPCR, SPE) == 0)
^
C:\Users\jJc\AppData\Local\Arduino15\packages\MegaCoreX\hardware\megaavr\1.0.8\cores\coreX-corefiles/api/Common.h:71:43: note: in definition of macro 'bitRead'
#define bitRead(value, bit) (((value) >> (bit)) & 0x01)
^~~
C:\Users\jJc\Documents\Arduino\libraries\EtherCard\src\enc28j60.cpp: In static member function 'static uint8_t ENC28J60::doBIST(byte)':
C:\Users\jJc\Documents\Arduino\libraries\EtherCard\src\enc28j60.cpp:662:17: error: 'SPCR' was not declared in this scope
if (bitRead(SPCR, SPE) == 0)
^
C:\Users\jJc\AppData\Local\Arduino15\packages\MegaCoreX\hardware\megaavr\1.0.8\cores\coreX-corefiles/api/Common.h:71:32: note: in definition of macro 'bitRead'
#define bitRead(value, bit) (((value) >> (bit)) & 0x01)
^~~~~
C:\Users\jJc\Documents\Arduino\libraries\EtherCard\src\enc28j60.cpp:662:17: note: suggested alternative: 'SCL'
if (bitRead(SPCR, SPE) == 0)
^
C:\Users\jJc\AppData\Local\Arduino15\packages\MegaCoreX\hardware\megaavr\1.0.8\cores\coreX-corefiles/api/Common.h:71:32: note: in definition of macro 'bitRead'
#define bitRead(value, bit) (((value) >> (bit)) & 0x01)
^~~~~
C:\Users\jJc\Documents\Arduino\libraries\EtherCard\src\enc28j60.cpp:662:23: error: 'SPE' was not declared in this scope
if (bitRead(SPCR, SPE) == 0)
^
C:\Users\jJc\AppData\Local\Arduino15\packages\MegaCoreX\hardware\megaavr\1.0.8\cores\coreX-corefiles/api/Common.h:71:43: note: in definition of macro 'bitRead'
#define bitRead(value, bit) (((value) >> (bit)) & 0x01)
^~~
C:\Users\jJc\Documents\Arduino\libraries\EtherCard\src\enc28j60.cpp:662:23: note: suggested alternative: 'PE'
if (bitRead(SPCR, SPE) == 0)
^
C:\Users\jJc\AppData\Local\Arduino15\packages\MegaCoreX\hardware\megaavr\1.0.8\cores\coreX-corefiles/api/Common.h:71:43: note: in definition of macro 'bitRead'
#define bitRead(value, bit) (((value) >> (bit)) & 0x01)
^~~
exit status 1
Error compiling for board ATmega4808.
Joseph