Redboard Artemis with SF CAN-Bus Shield Troubles

I am tinkering with a Redboard Artemis with Sparkfun CAN-bus shield. I have never worked with either of these, so maybe I am doing something wrong. The headers are soldered on and inserted onto the RBA. I have the Sparkfun Redboard Artemis selected in the board manager, and the COM port is correct and selected. I am able to upload example sketches for my RFM69 just fine. So I removed the the RFM69 transceiver to play with the CAN shield which is probably fine as far as hardware connections go. Hopefully the pin mapping isn’t a problem as the layout looks the same as an Uno board which the shield was designed for. The problem is in the software hurdle I can’t seem to get past to even test the shield.

Has anyone gotten their Artemis boards to work with the SF CAN library? I can’t get this stuff to compile at all. First, I would get an error telling me that the include library <util/delay.h> doesn’t exist. It has to do with some timer functions I guess, and I tried to edit the CAN library files and comment out any #include delay.h. So now when I try to compile any of the demo sketches, I get a whopper of an error message instead that might mean the Artemis isn’t compatible? See a copy snip of the error.

Can anyone make any sense of this wall of text?

Arduino: 1.8.13 (Windows Store 1.8.39.0) (Windows 10), Board: "SparkFun RedBoard Artemis, 921600, SparkFun Variable Loader (Recommended)"

WARNING: library SparkFun_CAN-Bus_Arduino_Library-master claims to run on avr architecture(s) and may be incompatible with your current board which runs on apollo3 architecture(s).

In file included from C:\Users\Tai Nguyen\Documents\ArduinoData\packages\SparkFun\hardware\apollo3\1.1.1/cores/arduino/ard_sup/Arduino.h:78,

                 from C:\Users\Tai Nguyen\Documents\Arduino\libraries\SparkFun_CAN-Bus_Arduino_Library-master\src\mcp2515.c:33:

C:\Users\Tai Nguyen\Documents\ArduinoData\packages\SparkFun\hardware\apollo3\1.1.1/cores/arduino/ard_sup/ap3_gpio.h:69:6: error: conflicting types for 'padMode'

 void padMode(uint8_t pad, am_hal_gpio_pincfg_t mode, ap3_err_t *retval);

      ^~~~~~~

C:\Users\Tai Nguyen\Documents\ArduinoData\packages\SparkFun\hardware\apollo3\1.1.1/cores/arduino/ard_sup/ap3_gpio.h:68:6: note: previous declaration of 'padMode' was here

 void padMode(uint8_t pad, am_hal_gpio_pincfg_t mode);

      ^~~~~~~

C:\Users\Tai Nguyen\Documents\ArduinoData\packages\SparkFun\hardware\apollo3\1.1.1/cores/arduino/ard_sup/ap3_gpio.h:72:6: error: conflicting types for 'pinMode'

 void pinMode(uint8_t pin, am_hal_gpio_pincfg_t mode);

      ^~~~~~~

C:\Users\Tai Nguyen\Documents\ArduinoData\packages\SparkFun\hardware\apollo3\1.1.1/cores/arduino/ard_sup/ap3_gpio.h:71:6: note: previous declaration of 'pinMode' was here

 void pinMode(uint8_t pin, uint8_t mode);

      ^~~~~~~

C:\Users\Tai Nguyen\Documents\ArduinoData\packages\SparkFun\hardware\apollo3\1.1.1/cores/arduino/ard_sup/ap3_gpio.h:73:6: error: conflicting types for 'pinMode'

 void pinMode(uint8_t pin, am_hal_gpio_pincfg_t mode, ap3_err_t *retval);

      ^~~~~~~

C:\Users\Tai Nguyen\Documents\ArduinoData\packages\SparkFun\hardware\apollo3\1.1.1/cores/arduino/ard_sup/ap3_gpio.h:71:6: note: previous declaration of 'pinMode' was here

 void pinMode(uint8_t pin, uint8_t mode);

      ^~~~~~~

C:\Users\Tai Nguyen\Documents\ArduinoData\packages\SparkFun\hardware\apollo3\1.1.1/cores/arduino/ard_sup/ap3_gpio.h:81:79: error: expected ';', ',' or ')' before '=' token

 unsigned long pulseIn(uint8_t pinNumber, uint8_t state, unsigned long timeout = 1000000L);

                                                                               ^

In file included from C:\Users\Tai Nguyen\Documents\ArduinoData\packages\SparkFun\hardware\apollo3\1.1.1/cores/arduino/ard_sup/Arduino.h:67,

                 from C:\Users\Tai Nguyen\Documents\Arduino\libraries\SparkFun_CAN-Bus_Arduino_Library-master\src\mcp2515.c:33:

c:\users\tai nguyen\documents\arduinodata\packages\sparkfun\tools\arm-none-eabi-gcc\8-2018-q4-major\arm-none-eabi\include\stdlib.h:70:5: error: expected identifier or '(' before 'int'

 int abs (int);

     ^~~

C:\Users\Tai Nguyen\Documents\ArduinoData\packages\SparkFun\hardware\apollo3\1.1.1/cores/arduino/ard_sup/Arduino_defines.h:58:21: error: expected ')' before '>' token

 #define abs(x) ((x) > 0 ? (x) : -(x))

                     ^

In file included from C:\Users\Tai Nguyen\Documents\ArduinoData\packages\SparkFun\hardware\apollo3\1.1.1/cores/arduino/ard_sup/ard_supers/Print.h:26,

                 from C:\Users\Tai Nguyen\Documents\ArduinoData\packages\SparkFun\hardware\apollo3\1.1.1/cores/arduino/ard_sup/ard_supers/Stream.h:26,

                 from C:\Users\Tai Nguyen\Documents\ArduinoData\packages\SparkFun\hardware\apollo3\1.1.1/cores/arduino/ard_sup/ard_supers/HardwareSerial.h:27,

                 from C:\Users\Tai Nguyen\Documents\ArduinoData\packages\SparkFun\hardware\apollo3\1.1.1/cores/arduino/ard_sup/ap3_uart.h:29,

                 from C:\Users\Tai Nguyen\Documents\ArduinoData\packages\SparkFun\hardware\apollo3\1.1.1/cores/arduino/ard_sup/Arduino.h:80,

                 from C:\Users\Tai Nguyen\Documents\Arduino\libraries\SparkFun_CAN-Bus_Arduino_Library-master\src\mcp2515.c:33:

C:\Users\Tai Nguyen\Documents\ArduinoData\packages\SparkFun\hardware\apollo3\1.1.1/cores/arduino/ard_sup/ard_supers/Printable.h:24:1: error: unknown type name 'class'

 class Print;

 ^~~~~

C:\Users\Tai Nguyen\Documents\ArduinoData\packages\SparkFun\hardware\apollo3\1.1.1/cores/arduino/ard_sup/ard_supers/Printable.h:32:1: error: unknown type name 'class'

 class Printable

 ^~~~~

C:\Users\Tai Nguyen\Documents\ArduinoData\packages\SparkFun\hardware\apollo3\1.1.1/cores/arduino/ard_sup/ard_supers/Printable.h:33:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token

 {

 ^

In file included from C:\Users\Tai Nguyen\Documents\ArduinoData\packages\SparkFun\hardware\apollo3\1.1.1/cores/arduino/ard_sup/ard_supers/Stream.h:26,

                 from C:\Users\Tai Nguyen\Documents\ArduinoData\packages\SparkFun\hardware\apollo3\1.1.1/cores/arduino/ard_sup/ard_supers/HardwareSerial.h:27,

                 from C:\Users\Tai Nguyen\Documents\ArduinoData\packages\SparkFun\hardware\apollo3\1.1.1/cores/arduino/ard_sup/ap3_uart.h:29,

                 from C:\Users\Tai Nguyen\Documents\ArduinoData\packages\SparkFun\hardware\apollo3\1.1.1/cores/arduino/ard_sup/Arduino.h:80,

                 from C:\Users\Tai Nguyen\Documents\Arduino\libraries\SparkFun_CAN-Bus_Arduino_Library-master\src\mcp2515.c:33:

C:\Users\Tai Nguyen\Documents\ArduinoData\packages\SparkFun\hardware\apollo3\1.1.1/cores/arduino/ard_sup/ard_supers/Print.h:36:1: error: unknown type name 'class'

 class Print

 ^~~~~

C:\Users\Tai Nguyen\Documents\ArduinoData\packages\SparkFun\hardware\apollo3\1.1.1/cores/arduino/ard_sup/ard_supers/Print.h:37:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token

 {

 ^

In file included from C:\Users\Tai Nguyen\Documents\ArduinoData\packages\SparkFun\hardware\apollo3\1.1.1/cores/arduino/ard_sup/ard_supers/HardwareSerial.h:27,

                 from C:\Users\Tai Nguyen\Documents\ArduinoData\packages\SparkFun\hardware\apollo3\1.1.1/cores/arduino/ard_sup/ap3_uart.h:29,

                 from C:\Users\Tai Nguyen\Documents\ArduinoData\packages\SparkFun\hardware\apollo3\1.1.1/cores/arduino/ard_sup/Arduino.h:80,

                 from C:\Users\Tai Nguyen\Documents\Arduino\libraries\SparkFun_CAN-Bus_Arduino_Library-master\src\mcp2515.c:33:

C:\Users\Tai Nguyen\Documents\ArduinoData\packages\SparkFun\hardware\apollo3\1.1.1/cores/arduino/ard_sup/ard_supers/Stream.h:49:1: error: unknown type name 'class'

 class Stream : public Print

 ^~~~~

C:\Users\Tai Nguyen\Documents\ArduinoData\packages\SparkFun\hardware\apollo3\1.1.1/cores/arduino/ard_sup/ard_supers/Stream.h:49:14: error: expected '=', ',', ';', 'asm' or '__attribute__' before ':' token

 class Stream : public Print

              ^

In file included from C:\Users\Tai Nguyen\Documents\ArduinoData\packages\SparkFun\hardware\apollo3\1.1.1/cores/arduino/ard_sup/ap3_uart.h:29,

                 from C:\Users\Tai Nguyen\Documents\ArduinoData\packages\SparkFun\hardware\apollo3\1.1.1/cores/arduino/ard_sup/Arduino.h:80,

                 from C:\Users\Tai Nguyen\Documents\Arduino\libraries\SparkFun_CAN-Bus_Arduino_Library-master\src\mcp2515.c:33:

C:\Users\Tai Nguyen\Documents\ArduinoData\packages\SparkFun\hardware\apollo3\1.1.1/cores/arduino/ard_sup/ard_supers/HardwareSerial.h:60:1: error: unknown type name 'class'

 class HardwareSerial : public Stream

 ^~~~~

C:\Users\Tai Nguyen\Documents\ArduinoData\packages\SparkFun\hardware\apollo3\1.1.1/cores/arduino/ard_sup/ard_supers/HardwareSerial.h:60:22: error: expected '=', ',', ';', 'asm' or '__attribute__' before ':' token

 class HardwareSerial : public Stream

                      ^

In file included from C:\Users\Tai Nguyen\Documents\ArduinoData\packages\SparkFun\hardware\apollo3\1.1.1/cores/arduino/ard_sup/Arduino.h:80,

                 from C:\Users\Tai Nguyen\Documents\Arduino\libraries\SparkFun_CAN-Bus_Arduino_Library-master\src\mcp2515.c:33:

C:\Users\Tai Nguyen\Documents\ArduinoData\packages\SparkFun\hardware\apollo3\1.1.1/cores/arduino/ard_sup/ap3_uart.h:40:20: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token

 typedef RingBufferN<AP3_UART_RINGBUFF_SIZE> AP3UartRingBuffer;

                    ^

C:\Users\Tai Nguyen\Documents\ArduinoData\packages\SparkFun\hardware\apollo3\1.1.1/cores/arduino/ard_sup/ap3_uart.h:58:1: error: unknown type name 'class'

 class Uart : public HardwareSerial

 ^~~~~

C:\Users\Tai Nguyen\Documents\ArduinoData\packages\SparkFun\hardware\apollo3\1.1.1/cores/arduino/ard_sup/ap3_uart.h:58:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before ':' token

 class Uart : public HardwareSerial

            ^

In file included from C:\Users\Tai Nguyen\Documents\ArduinoData\packages\SparkFun\hardware\apollo3\1.1.1/cores/arduino/ard_sup/Arduino.h:81,

                 from C:\Users\Tai Nguyen\Documents\Arduino\libraries\SparkFun_CAN-Bus_Arduino_Library-master\src\mcp2515.c:33:

C:\Users\Tai Nguyen\Documents\ArduinoData\packages\SparkFun\hardware\apollo3\1.1.1/cores/arduino/ard_sup/ap3_analog.h:57:11: error: conflicting types for 'servoWrite'

 ap3_err_t servoWrite(uint8_t pin, uint32_t val, uint16_t minMicros, uint16_t maxMicros);

           ^~~~~~~~~~

C:\Users\Tai Nguyen\Documents\ArduinoData\packages\SparkFun\hardware\apollo3\1.1.1/cores/arduino/ard_sup/ap3_analog.h:56:11: note: previous declaration of 'servoWrite' was here

 ap3_err_t servoWrite(uint8_t pin, uint32_t val);

           ^~~~~~~~~~

C:\Users\Tai Nguyen\Documents\ArduinoData\packages\SparkFun\hardware\apollo3\1.1.1/cores/arduino/ard_sup/ap3_analog.h:60:11: error: conflicting types for 'tone'

 ap3_err_t tone(uint8_t pin, uint32_t freq, uint32_t duration);

           ^~~~

C:\Users\Tai Nguyen\Documents\ArduinoData\packages\SparkFun\hardware\apollo3\1.1.1/cores/arduino/ard_sup/ap3_analog.h:59:11: note: previous declaration of 'tone' was here

 ap3_err_t tone(uint8_t pin, uint32_t freq);

           ^~~~

In file included from C:\Users\Tai Nguyen\Documents\ArduinoData\packages\SparkFun\hardware\apollo3\1.1.1/cores/arduino/ard_sup/Arduino.h:84,

                 from C:\Users\Tai Nguyen\Documents\Arduino\libraries\SparkFun_CAN-Bus_Arduino_Library-master\src\mcp2515.c:33:

C:\Users\Tai Nguyen\Documents\ArduinoData\packages\SparkFun\hardware\apollo3\1.1.1/cores/arduino/ard_sup/ard_supers/WMath.h:22:13: error: conflicting types for 'random'

 extern long random( long ) ;

             ^~~~~~

In file included from C:\Users\Tai Nguyen\Documents\ArduinoData\packages\SparkFun\hardware\apollo3\1.1.1/cores/arduino/ard_sup/ard_supers/Printable.h:22,

                 from C:\Users\Tai Nguyen\Documents\ArduinoData\packages\SparkFun\hardware\apollo3\1.1.1/cores/arduino/ard_sup/ard_supers/Print.h:26,

                 from C:\Users\Tai Nguyen\Documents\ArduinoData\packages\SparkFun\hardware\apollo3\1.1.1/cores/arduino/ard_sup/ard_supers/Stream.h:26,

                 from C:\Users\Tai Nguyen\Documents\ArduinoData\packages\SparkFun\hardware\apollo3\1.1.1/cores/arduino/ard_sup/ard_supers/HardwareSerial.h:27,

                 from C:\Users\Tai Nguyen\Documents\ArduinoData\packages\SparkFun\hardware\apollo3\1.1.1/cores/arduino/ard_sup/ap3_uart.h:29,

                 from C:\Users\Tai Nguyen\Documents\ArduinoData\packages\SparkFun\hardware\apollo3\1.1.1/cores/arduino/ard_sup/Arduino.h:80,

                 from C:\Users\Tai Nguyen\Documents\Arduino\libraries\SparkFun_CAN-Bus_Arduino_Library-master\src\mcp2515.c:33:

c:\users\tai nguyen\documents\arduinodata\packages\sparkfun\tools\arm-none-eabi-gcc\8-2018-q4-major\arm-none-eabi\include\stdlib.h:255:6: note: previous declaration of 'random' was here

 long random (void);

      ^~~~~~

In file included from C:\Users\Tai Nguyen\Documents\ArduinoData\packages\SparkFun\hardware\apollo3\1.1.1/cores/arduino/ard_sup/Arduino.h:84,

                 from C:\Users\Tai Nguyen\Documents\Arduino\libraries\SparkFun_CAN-Bus_Arduino_Library-master\src\mcp2515.c:33:

C:\Users\Tai Nguyen\Documents\ArduinoData\packages\SparkFun\hardware\apollo3\1.1.1/cores/arduino/ard_sup/ard_supers/WMath.h:23:13: error: conflicting types for 'random'

 extern long random( long, long ) ;

             ^~~~~~

In file included from C:\Users\Tai Nguyen\Documents\ArduinoData\packages\SparkFun\hardware\apollo3\1.1.1/cores/arduino/ard_sup/ard_supers/Printable.h:22,

                 from C:\Users\Tai Nguyen\Documents\ArduinoData\packages\SparkFun\hardware\apollo3\1.1.1/cores/arduino/ard_sup/ard_supers/Print.h:26,

                 from C:\Users\Tai Nguyen\Documents\ArduinoData\packages\SparkFun\hardware\apollo3\1.1.1/cores/arduino/ard_sup/ard_supers/Stream.h:26,

                 from C:\Users\Tai Nguyen\Documents\ArduinoData\packages\SparkFun\hardware\apollo3\1.1.1/cores/arduino/ard_sup/ard_supers/HardwareSerial.h:27,

                 from C:\Users\Tai Nguyen\Documents\ArduinoData\packages\SparkFun\hardware\apollo3\1.1.1/cores/arduino/ard_sup/ap3_uart.h:29,

                 from C:\Users\Tai Nguyen\Documents\ArduinoData\packages\SparkFun\hardware\apollo3\1.1.1/cores/arduino/ard_sup/Arduino.h:80,

                 from C:\Users\Tai Nguyen\Documents\Arduino\libraries\SparkFun_CAN-Bus_Arduino_Library-master\src\mcp2515.c:33:

c:\users\tai nguyen\documents\arduinodata\packages\sparkfun\tools\arm-none-eabi-gcc\8-2018-q4-major\arm-none-eabi\include\stdlib.h:255:6: note: previous declaration of 'random' was here

 long random (void);

      ^~~~~~

In file included from C:\Users\Tai Nguyen\Documents\ArduinoData\packages\SparkFun\hardware\apollo3\1.1.1/cores/arduino/ard_sup/Arduino.h:84,

                 from C:\Users\Tai Nguyen\Documents\Arduino\libraries\SparkFun_CAN-Bus_Arduino_Library-master\src\mcp2515.c:33:

C:\Users\Tai Nguyen\Documents\ArduinoData\packages\SparkFun\hardware\apollo3\1.1.1/cores/arduino/ard_sup/ard_supers/WMath.h:28:17: error: conflicting types for 'makeWord'

 extern uint16_t makeWord( uint8_t h, uint8_t l ) ;

                 ^~~~~~~~

C:\Users\Tai Nguyen\Documents\ArduinoData\packages\SparkFun\hardware\apollo3\1.1.1/cores/arduino/ard_sup/ard_supers/WMath.h:27:17: note: previous declaration of 'makeWord' was here

 extern uint16_t makeWord( uint16_t w ) ;

                 ^~~~~~~~

In file included from C:\Users\Tai Nguyen\Documents\ArduinoData\packages\SparkFun\hardware\apollo3\1.1.1/cores/arduino/ard_sup/Arduino.h:87,

                 from C:\Users\Tai Nguyen\Documents\Arduino\libraries\SparkFun_CAN-Bus_Arduino_Library-master\src\mcp2515.c:33:

C:\Users\Tai Nguyen\Documents\ArduinoData\packages\SparkFun\hardware\apollo3\1.1.1\variants\redboard_artemis/config/variant.h:33:1: error: unknown type name 'class'

 class Uart; // Forward declaration of Uart

 ^~~~~

C:\Users\Tai Nguyen\Documents\ArduinoData\packages\SparkFun\hardware\apollo3\1.1.1\variants\redboard_artemis/config/variant.h:34:13: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'Serial'

 extern Uart Serial;

             ^~~~~~

C:\Users\Tai Nguyen\Documents\ArduinoData\packages\SparkFun\hardware\apollo3\1.1.1\variants\redboard_artemis/config/variant.h:35:13: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'Serial1'

 extern Uart Serial1;

             ^~~~~~~

C:\Users\Tai Nguyen\Documents\Arduino\libraries\SparkFun_CAN-Bus_Arduino_Library-master\src\mcp2515.c: In function 'spi_putc':

C:\Users\Tai Nguyen\Documents\Arduino\libraries\SparkFun_CAN-Bus_Arduino_Library-master\src\mcp2515.c:53:2: error: 'SPDR' undeclared (first use in this function); did you mean 'SDA'?

  SPDR = data;

  ^~~~

  SDA

C:\Users\Tai Nguyen\Documents\Arduino\libraries\SparkFun_CAN-Bus_Arduino_Library-master\src\mcp2515.c:53:2: note: each undeclared identifier is reported only once for each function it appears in

C:\Users\Tai Nguyen\Documents\Arduino\libraries\SparkFun_CAN-Bus_Arduino_Library-master\src\mcp2515.c:56:12: error: 'SPSR' undeclared (first use in this function); did you mean 'PSTR'?

  while( !( SPSR & (1<<SPIF) ) )

            ^~~~

            PSTR

C:\Users\Tai Nguyen\Documents\Arduino\libraries\SparkFun_CAN-Bus_Arduino_Library-master\src\mcp2515.c:56:23: error: 'SPIF' undeclared (first use in this function); did you mean 'TPI'?

  while( !( SPSR & (1<<SPIF) ) )

                       ^~~~

                       TPI

In file included from C:\Users\Tai Nguyen\Documents\Arduino\libraries\SparkFun_CAN-Bus_Arduino_Library-master\src\mcp2515.c:40:

C:\Users\Tai Nguyen\Documents\Arduino\libraries\SparkFun_CAN-Bus_Arduino_Library-master\src\mcp2515.c: In function 'mcp2515_write_register':

C:\Users\Tai Nguyen\Documents\Arduino\libraries\SparkFun_CAN-Bus_Arduino_Library-master\src\global.h:37:19: error: 'PORTB' undeclared (first use in this function); did you mean 'PORT'?

 #define _port2(x) PORT ## x

                   ^~~~

C:\Users\Tai Nguyen\Documents\Arduino\libraries\SparkFun_CAN-Bus_Arduino_Library-master\src\global.h:24:19: note: in expansion of macro '_port2'

 #define PORT(x)   _port2(x)

                   ^~~~~~

C:\Users\Tai Nguyen\Documents\Arduino\libraries\SparkFun_CAN-Bus_Arduino_Library-master\src\global.h:28:19: note: in expansion of macro 'PORT'

 #define _XRS(x,y) PORT(x) &= ~(1<<y)

                   ^~~~

C:\Users\Tai Nguyen\Documents\Arduino\libraries\SparkFun_CAN-Bus_Arduino_Library-master\src\global.h:17:19: note: in expansion of macro '_XRS'

 #define RESET(x)  _XRS(x)

                   ^~~~

C:\Users\Tai Nguyen\Documents\Arduino\libraries\SparkFun_CAN-Bus_Arduino_Library-master\src\mcp2515.c:65:2: note: in expansion of macro 'RESET'

  RESET(MCP2515_CS);

  ^~~~~

C:\Users\Tai Nguyen\Documents\Arduino\libraries\SparkFun_CAN-Bus_Arduino_Library-master\src\mcp2515.c: In function 'mcp2515_read_register':

C:\Users\Tai Nguyen\Documents\Arduino\libraries\SparkFun_CAN-Bus_Arduino_Library-master\src\global.h:37:19: error: 'PORTB' undeclared (first use in this function); did you mean 'PORT'?

 #define _port2(x) PORT ## x

                   ^~~~

C:\Users\Tai Nguyen\Documents\Arduino\libraries\SparkFun_CAN-Bus_Arduino_Library-master\src\global.h:24:19: note: in expansion of macro '_port2'

 #define PORT(x)   _port2(x)

                   ^~~~~~

C:\Users\Tai Nguyen\Documents\Arduino\libraries\SparkFun_CAN-Bus_Arduino_Library-master\src\global.h:28:19: note: in expansion of macro 'PORT'

 #define _XRS(x,y) PORT(x) &= ~(1<<y)

                   ^~~~

C:\Users\Tai Nguyen\Documents\Arduino\libraries\SparkFun_CAN-Bus_Arduino_Library-master\src\global.h:17:19: note: in expansion of macro '_XRS'

 #define RESET(x)  _XRS(x)

                   ^~~~

C:\Users\Tai Nguyen\Documents\Arduino\libraries\SparkFun_CAN-Bus_Arduino_Library-master\src\mcp2515.c:79:2: note: in expansion of macro 'RESET'

  RESET(MCP2515_CS);

  ^~~~~

C:\Users\Tai Nguyen\Documents\Arduino\libraries\SparkFun_CAN-Bus_Arduino_Library-master\src\mcp2515.c: In function 'mcp2515_bit_modify':

C:\Users\Tai Nguyen\Documents\Arduino\libraries\SparkFun_CAN-Bus_Arduino_Library-master\src\global.h:37:19: error: 'PORTB' undeclared (first use in this function); did you mean 'PORT'?

 #define _port2(x) PORT ## x

                   ^~~~

C:\Users\Tai Nguyen\Documents\Arduino\libraries\SparkFun_CAN-Bus_Arduino_Library-master\src\global.h:24:19: note: in expansion of macro '_port2'

 #define PORT(x)   _port2(x)

                   ^~~~~~

C:\Users\Tai Nguyen\Documents\Arduino\libraries\SparkFun_CAN-Bus_Arduino_Library-master\src\global.h:28:19: note: in expansion of macro 'PORT'

 #define _XRS(x,y) PORT(x) &= ~(1<<y)

                   ^~~~

C:\Users\Tai Nguyen\Documents\Arduino\libraries\SparkFun_CAN-Bus_Arduino_Library-master\src\global.h:17:19: note: in expansion of macro '_XRS'

 #define RESET(x)  _XRS(x)

                   ^~~~

C:\Users\Tai Nguyen\Documents\Arduino\libraries\SparkFun_CAN-Bus_Arduino_Library-master\src\mcp2515.c:94:2: note: in expansion of macro 'RESET'

  RESET(MCP2515_CS);

  ^~~~~

C:\Users\Tai Nguyen\Documents\Arduino\libraries\SparkFun_CAN-Bus_Arduino_Library-master\src\mcp2515.c: In function 'mcp2515_read_status':

C:\Users\Tai Nguyen\Documents\Arduino\libraries\SparkFun_CAN-Bus_Arduino_Library-master\src\global.h:37:19: error: 'PORTB' undeclared (first use in this function); did you mean 'PORT'?

 #define _port2(x) PORT ## x

                   ^~~~

C:\Users\Tai Nguyen\Documents\Arduino\libraries\SparkFun_CAN-Bus_Arduino_Library-master\src\global.h:24:19: note: in expansion of macro '_port2'

 #define PORT(x)   _port2(x)

                   ^~~~~~

C:\Users\Tai Nguyen\Documents\Arduino\libraries\SparkFun_CAN-Bus_Arduino_Library-master\src\global.h:28:19: note: in expansion of macro 'PORT'

 #define _XRS(x,y) PORT(x) &= ~(1<<y)

                   ^~~~

C:\Users\Tai Nguyen\Documents\Arduino\libraries\SparkFun_CAN-Bus_Arduino_Library-master\src\global.h:17:19: note: in expansion of macro '_XRS'

 #define RESET(x)  _XRS(x)

                   ^~~~

C:\Users\Tai Nguyen\Documents\Arduino\libraries\SparkFun_CAN-Bus_Arduino_Library-master\src\mcp2515.c:109:2: note: in expansion of macro 'RESET'

  RESET(MCP2515_CS);

  ^~~~~

C:\Users\Tai Nguyen\Documents\Arduino\libraries\SparkFun_CAN-Bus_Arduino_Library-master\src\mcp2515.c: In function 'mcp2515_init':

C:\Users\Tai Nguyen\Documents\Arduino\libraries\SparkFun_CAN-Bus_Arduino_Library-master\src\global.h:37:19: error: 'PORTB' undeclared (first use in this function); did you mean 'PORT'?

 #define _port2(x) PORT ## x

                   ^~~~

C:\Users\Tai Nguyen\Documents\Arduino\libraries\SparkFun_CAN-Bus_Arduino_Library-master\src\global.h:24:19: note: in expansion of macro '_port2'

 #define PORT(x)   _port2(x)

                   ^~~~~~

C:\Users\Tai Nguyen\Documents\Arduino\libraries\SparkFun_CAN-Bus_Arduino_Library-master\src\global.h:29:18: note: in expansion of macro 'PORT'

 #define _XS(x,y) PORT(x) |= (1<<y)

                  ^~~~

C:\Users\Tai Nguyen\Documents\Arduino\libraries\SparkFun_CAN-Bus_Arduino_Library-master\src\global.h:18:18: note: in expansion of macro '_XS'

 #define SET(x)   _XS(x)

                  ^~~

C:\Users\Tai Nguyen\Documents\Arduino\libraries\SparkFun_CAN-Bus_Arduino_Library-master\src\mcp2515.c:124:2: note: in expansion of macro 'SET'

  SET(MCP2515_CS);

  ^~~

C:\Users\Tai Nguyen\Documents\Arduino\libraries\SparkFun_CAN-Bus_Arduino_Library-master\src\global.h:38:18: error: 'DDRB' undeclared (first use in this function); did you mean 'DDR'?

 #define _ddr2(x) DDR ## x

                  ^~~

C:\Users\Tai Nguyen\Documents\Arduino\libraries\SparkFun_CAN-Bus_Arduino_Library-master\src\global.h:25:18: note: in expansion of macro '_ddr2'

 #define DDR(x)   _ddr2(x)

                  ^~~~~

C:\Users\Tai Nguyen\Documents\Arduino\libraries\SparkFun_CAN-Bus_Arduino_Library-master\src\global.h:32:19: note: in expansion of macro 'DDR'

 #define _XSO(x,y) DDR(x) |= (1<<y)

                   ^~~

C:\Users\Tai Nguyen\Documents\Arduino\libraries\SparkFun_CAN-Bus_Arduino_Library-master\src\global.h:20:23: note: in expansion of macro '_XSO'

 #define SET_OUTPUT(x) _XSO(x)

                       ^~~~

C:\Users\Tai Nguyen\Documents\Arduino\libraries\SparkFun_CAN-Bus_Arduino_Library-master\src\mcp2515.c:125:2: note: in expansion of macro 'SET_OUTPUT'

  SET_OUTPUT(MCP2515_CS);

  ^~~~~~~~~~

C:\Users\Tai Nguyen\Documents\Arduino\libraries\SparkFun_CAN-Bus_Arduino_Library-master\src\global.h:38:18: error: 'DDRD' undeclared (first use in this function); did you mean 'DDR'?

 #define _ddr2(x) DDR ## x

                  ^~~

C:\Users\Tai Nguyen\Documents\Arduino\libraries\SparkFun_CAN-Bus_Arduino_Library-master\src\global.h:25:18: note: in expansion of macro '_ddr2'

 #define DDR(x)   _ddr2(x)

                  ^~~~~

C:\Users\Tai Nguyen\Documents\Arduino\libraries\SparkFun_CAN-Bus_Arduino_Library-master\src\global.h:33:19: note: in expansion of macro 'DDR'

 #define _XSI(x,y) DDR(x) &= ~(1<<y)

                   ^~~

C:\Users\Tai Nguyen\Documents\Arduino\libraries\SparkFun_CAN-Bus_Arduino_Library-master\src\global.h:21:22: note: in expansion of macro '_XSI'

 #define SET_INPUT(x) _XSI(x)

                      ^~~~

C:\Users\Tai Nguyen\Documents\Arduino\libraries\SparkFun_CAN-Bus_Arduino_Library-master\src\mcp2515.c:135:2: note: in expansion of macro 'SET_INPUT'

  SET_INPUT(MCP2515_INT);

  ^~~~~~~~~

C:\Users\Tai Nguyen\Documents\Arduino\libraries\SparkFun_CAN-Bus_Arduino_Library-master\src\global.h:37:19: error: 'PORTD' undeclared (first use in this function); did you mean 'PORT'?

 #define _port2(x) PORT ## x

                   ^~~~

C:\Users\Tai Nguyen\Documents\Arduino\libraries\SparkFun_CAN-Bus_Arduino_Library-master\src\global.h:24:19: note: in expansion of macro '_port2'

 #define PORT(x)   _port2(x)

                   ^~~~~~

C:\Users\Tai Nguyen\Documents\Arduino\libraries\SparkFun_CAN-Bus_Arduino_Library-master\src\global.h:29:18: note: in expansion of macro 'PORT'

 #define _XS(x,y) PORT(x) |= (1<<y)

                  ^~~~

C:\Users\Tai Nguyen\Documents\Arduino\libraries\SparkFun_CAN-Bus_Arduino_Library-master\src\global.h:18:18: note: in expansion of macro '_XS'

 #define SET(x)   _XS(x)

                  ^~~

C:\Users\Tai Nguyen\Documents\Arduino\libraries\SparkFun_CAN-Bus_Arduino_Library-master\src\mcp2515.c:136:2: note: in expansion of macro 'SET'

  SET(MCP2515_INT);

  ^~~

C:\Users\Tai Nguyen\Documents\Arduino\libraries\SparkFun_CAN-Bus_Arduino_Library-master\src\mcp2515.c:139:2: error: 'SPCR' undeclared (first use in this function); did you mean 'SCB'?

  SPCR = (1<<SPE)|(1<<MSTR) | (0<<SPR1)|(1<<SPR0);

  ^~~~

  SCB

C:\Users\Tai Nguyen\Documents\Arduino\libraries\SparkFun_CAN-Bus_Arduino_Library-master\src\mcp2515.c:139:13: error: 'SPE' undeclared (first use in this function)

  SPCR = (1<<SPE)|(1<<MSTR) | (0<<SPR1)|(1<<SPR0);

             ^~~

C:\Users\Tai Nguyen\Documents\Arduino\libraries\SparkFun_CAN-Bus_Arduino_Library-master\src\mcp2515.c:139:22: error: 'MSTR' undeclared (first use in this function); did you mean 'PSTR'?

  SPCR = (1<<SPE)|(1<<MSTR) | (0<<SPR1)|(1<<SPR0);

                      ^~~~

                      PSTR

C:\Users\Tai Nguyen\Documents\Arduino\libraries\SparkFun_CAN-Bus_Arduino_Library-master\src\mcp2515.c:139:34: error: 'SPR1' undeclared (first use in this function); did you mean 'SJW1'?

  SPCR = (1<<SPE)|(1<<MSTR) | (0<<SPR1)|(1<<SPR0);

                                  ^~~~

                                  SJW1

C:\Users\Tai Nguyen\Documents\Arduino\libraries\SparkFun_CAN-Bus_Arduino_Library-master\src\mcp2515.c:139:44: error: 'SPR0' undeclared (first use in this function); did you mean 'SJW0'?

  SPCR = (1<<SPE)|(1<<MSTR) | (0<<SPR1)|(1<<SPR0);

                                            ^~~~

                                            SJW0

C:\Users\Tai Nguyen\Documents\Arduino\libraries\SparkFun_CAN-Bus_Arduino_Library-master\src\mcp2515.c:140:2: error: 'SPSR' undeclared (first use in this function); did you mean 'PSTR'?

  SPSR = 0;

  ^~~~

  PSTR

C:\Users\Tai Nguyen\Documents\Arduino\libraries\SparkFun_CAN-Bus_Arduino_Library-master\src\mcp2515.c:149:2: warning: implicit declaration of function '_delay_us'; did you mean 'delay'? [-Wimplicit-function-declaration]

  _delay_us(10);

  ^~~~~~~~~

  delay

In file included from C:\Users\Tai Nguyen\Documents\Arduino\libraries\SparkFun_CAN-Bus_Arduino_Library-master\src\mcp2515.c:40:

C:\Users\Tai Nguyen\Documents\Arduino\libraries\SparkFun_CAN-Bus_Arduino_Library-master\src\mcp2515.c: In function 'mcp2515_check_message':

C:\Users\Tai Nguyen\Documents\Arduino\libraries\SparkFun_CAN-Bus_Arduino_Library-master\src\global.h:39:18: error: 'PIND' undeclared (first use in this function); did you mean 'PIN'?

 #define _pin2(x) PIN ## x

                  ^~~

C:\Users\Tai Nguyen\Documents\Arduino\libraries\SparkFun_CAN-Bus_Arduino_Library-master\src\global.h:26:18: note: in expansion of macro '_pin2'

 #define PIN(x)   _pin2(x)

                  ^~~~~

C:\Users\Tai Nguyen\Documents\Arduino\libraries\SparkFun_CAN-Bus_Arduino_Library-master\src\global.h:35:20: note: in expansion of macro 'PIN'

 #define _XR(x,y) ((PIN(x) & (1<<y)) != 0)

                    ^~~

C:\Users\Tai Nguyen\Documents\Arduino\libraries\SparkFun_CAN-Bus_Arduino_Library-master\src\global.h:22:20: note: in expansion of macro '_XR'

 #define IS_SET(x)  _XR(x)

                    ^~~

C:\Users\Tai Nguyen\Documents\Arduino\libraries\SparkFun_CAN-Bus_Arduino_Library-master\src\mcp2515.c:201:11: note: in expansion of macro 'IS_SET'

  return (!IS_SET(MCP2515_INT));

           ^~~~~~

C:\Users\Tai Nguyen\Documents\Arduino\libraries\SparkFun_CAN-Bus_Arduino_Library-master\src\mcp2515.c: In function 'mcp2515_get_message':

C:\Users\Tai Nguyen\Documents\Arduino\libraries\SparkFun_CAN-Bus_Arduino_Library-master\src\mcp2515.c:226:6: warning: implicit declaration of function 'bit_is_set'; did you mean 'timerisset'? [-Wimplicit-function-declaration]

  if (bit_is_set(status,6)) {

      ^~~~~~~~~~

      timerisset

In file included from C:\Users\Tai Nguyen\Documents\Arduino\libraries\SparkFun_CAN-Bus_Arduino_Library-master\src\mcp2515.c:40:

C:\Users\Tai Nguyen\Documents\Arduino\libraries\SparkFun_CAN-Bus_Arduino_Library-master\src\global.h:37:19: error: 'PORTB' undeclared (first use in this function); did you mean 'PORT'?

 #define _port2(x) PORT ## x

                   ^~~~

C:\Users\Tai Nguyen\Documents\Arduino\libraries\SparkFun_CAN-Bus_Arduino_Library-master\src\global.h:24:19: note: in expansion of macro '_port2'

 #define PORT(x)   _port2(x)

                   ^~~~~~

C:\Users\Tai Nguyen\Documents\Arduino\libraries\SparkFun_CAN-Bus_Arduino_Library-master\src\global.h:28:19: note: in expansion of macro 'PORT'

 #define _XRS(x,y) PORT(x) &= ~(1<<y)

                   ^~~~

C:\Users\Tai Nguyen\Documents\Arduino\libraries\SparkFun_CAN-Bus_Arduino_Library-master\src\global.h:17:19: note: in expansion of macro '_XRS'

 #define RESET(x)  _XRS(x)

                   ^~~~

C:\Users\Tai Nguyen\Documents\Arduino\libraries\SparkFun_CAN-Bus_Arduino_Library-master\src\mcp2515.c:239:2: note: in expansion of macro 'RESET'

  RESET(MCP2515_CS);

  ^~~~~

C:\Users\Tai Nguyen\Documents\Arduino\libraries\SparkFun_CAN-Bus_Arduino_Library-master\src\mcp2515.c: In function 'mcp2515_send_message':

C:\Users\Tai Nguyen\Documents\Arduino\libraries\SparkFun_CAN-Bus_Arduino_Library-master\src\mcp2515.c:287:6: warning: implicit declaration of function 'bit_is_clear'; did you mean 'bitClear'? [-Wimplicit-function-declaration]

  if (bit_is_clear(status, 2)) {

      ^~~~~~~~~~~~

      bitClear

In file included from C:\Users\Tai Nguyen\Documents\Arduino\libraries\SparkFun_CAN-Bus_Arduino_Library-master\src\mcp2515.c:40:

C:\Users\Tai Nguyen\Documents\Arduino\libraries\SparkFun_CAN-Bus_Arduino_Library-master\src\global.h:37:19: error: 'PORTB' undeclared (first use in this function); did you mean 'PORT'?

 #define _port2(x) PORT ## x

                   ^~~~

C:\Users\Tai Nguyen\Documents\Arduino\libraries\SparkFun_CAN-Bus_Arduino_Library-master\src\global.h:24:19: note: in expansion of macro '_port2'

 #define PORT(x)   _port2(x)

                   ^~~~~~

C:\Users\Tai Nguyen\Documents\Arduino\libraries\SparkFun_CAN-Bus_Arduino_Library-master\src\global.h:28:19: note: in expansion of macro 'PORT'

 #define _XRS(x,y) PORT(x) &= ~(1<<y)

                   ^~~~

C:\Users\Tai Nguyen\Documents\Arduino\libraries\SparkFun_CAN-Bus_Arduino_Library-master\src\global.h:17:19: note: in expansion of macro '_XRS'

 #define RESET(x)  _XRS(x)

                   ^~~~

C:\Users\Tai Nguyen\Documents\Arduino\libraries\SparkFun_CAN-Bus_Arduino_Library-master\src\mcp2515.c:301:2: note: in expansion of macro 'RESET'

  RESET(MCP2515_CS);

  ^~~~~

C:\Users\Tai Nguyen\Documents\Arduino\libraries\SparkFun_CAN-Bus_Arduino_Library-master\src\mcp2515.c: In function 'spi_putc':

C:\Users\Tai Nguyen\Documents\Arduino\libraries\SparkFun_CAN-Bus_Arduino_Library-master\src\mcp2515.c:60:1: warning: control reaches end of non-void function [-Wreturn-type]

 }

 ^

C:\Users\Tai Nguyen\Documents\Arduino\libraries\SparkFun_CAN-Bus_Arduino_Library-master\src\mcp2515.c: In function 'mcp2515_check_message':

C:\Users\Tai Nguyen\Documents\Arduino\libraries\SparkFun_CAN-Bus_Arduino_Library-master\src\mcp2515.c:202:1: warning: control reaches end of non-void function [-Wreturn-type]

 }

 ^

In file included from C:\Users\Tai Nguyen\Documents\ArduinoData\packages\SparkFun\hardware\apollo3\1.1.1/cores/arduino/ard_sup/Arduino.h:81,

                 from C:\Users\Tai Nguyen\Documents\Arduino\libraries\SparkFun_CAN-Bus_Arduino_Library-master\src\mcp2515.c:33:

At top level:

C:\Users\Tai Nguyen\Documents\ArduinoData\packages\SparkFun\hardware\apollo3\1.1.1/cores/arduino/ard_sup/ap3_analog.h:37:14: warning: 'g_ADCHandle' defined but not used [-Wunused-variable]

 static void *g_ADCHandle;

              ^~~~~~~~~~~

exit status 1

Error compiling for board SparkFun RedBoard Artemis.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Ah, thanks for sharing. Looks like this library was written about 5 years ago. It seems to rely on some outdated or microcontroller specific capabilities (generally a bad idea if you want to work cross-platform for all Arduinos)

The main thing that sticks out to me is the <util/delay.h>. It looks like something that would only exist in a particular Arduino core (in this case AVR based boards). A good cross-platform library will only depend on “Arduino.h” and the functions that it can access from there. In this case the “[_delay_us” function is probably (one of) the thing(s) that need that <util/delay.h> header file. You could replace it with “[delayMicroseconds” which is part of the official Arduino API.

However to do that you will need to re-factor the code some more… As indicated by warnings like this:

C:\Users\Tai Nguyen\Documents\ArduinoData\packages\SparkFun\hardware\apollo3\1.1.1/cores/arduino/ard_sup/ap3_gpio.h:69:6: error: conflicting types for 'padMode'

 void padMode(uint8_t pad, am_hal_gpio_pincfg_t mode, ap3_err_t *retval);

      ^~~~~~~

C:\Users\Tai Nguyen\Documents\ArduinoData\packages\SparkFun\hardware\apollo3\1.1.1/cores/arduino/ard_sup/ap3_gpio.h:68:6: note: previous declaration of 'padMode' was here

 void padMode(uint8_t pad, am_hal_gpio_pincfg_t mode);

      ^~~~~~~

C:\Users\Tai Nguyen\Documents\ArduinoData\packages\SparkFun\hardware\apollo3\1.1.1/cores/arduino/ard_sup/ap3_gpio.h:72:6: error: conflicting types for 'pinMode'

 void pinMode(uint8_t pin, am_hal_gpio_pincfg_t mode);

      ^~~~~~~

C:\Users\Tai Nguyen\Documents\ArduinoData\packages\SparkFun\hardware\apollo3\1.1.1/cores/arduino/ard_sup/ap3_gpio.h:71:6: note: previous declaration of 'pinMode' was here

 void pinMode(uint8_t pin, uint8_t mode);

      ^~~~~~~

C:\Users\Tai Nguyen\Documents\ArduinoData\packages\SparkFun\hardware\apollo3\1.1.1/cores/arduino/ard_sup/ap3_gpio.h:73:6: error: conflicting types for 'pinMode'

 void pinMode(uint8_t pin, am_hal_gpio_pincfg_t mode, ap3_err_t *retval);

      ^~~~~~~

C:\Users\Tai Nguyen\Documents\ArduinoData\packages\SparkFun\hardware\apollo3\1.1.1/cores/arduino/ard_sup/ap3_gpio.h:71:6: note: previous declaration of 'pinMode' was here

 void pinMode(uint8_t pin, uint8_t mode);

the C file “[mcp2515.c” is trying to include “Arduino.h” but “Arduino.h” includes files with C++ features like function overloading. That means that in Arduino “Arduino.h” should never be included in C files. One possible fix would be to change “mcp2515.c” to “mcp2515.cpp” and ensure that the C++ linkage is respected.

I will open an issue on the library’s GitHub repo that references this post. IMO that library needs to be updated to modern standards.](SparkFun_CAN-Bus_Arduino_Library/src/mcp2515.c at 99644e84e184ecb8240c22ee06ea4a4871b766ba · sparkfun/SparkFun_CAN-Bus_Arduino_Library · GitHub)](ArduinoCore-API/api/Common.h at 3daf1893582d3a1cc6f5b56f7e6949009052a05a · arduino/ArduinoCore-API · GitHub)](SparkFun_CAN-Bus_Arduino_Library/src/mcp2515.c at 99644e84e184ecb8240c22ee06ea4a4871b766ba · sparkfun/SparkFun_CAN-Bus_Arduino_Library · GitHub)

Thank for clearing that up. I was chasing down everything I could in that error message, only to be lead down yet another rhetorical fork in the road. Then I thought, hmm maybe this library is just ancient, and my suspicions were true. I’ll revisit the GitHub for it to see how it progresses along.

Though I have created an issue and notified the right people at SparkFun there is no guarantee that we will make the required changes. It may be left up to the community to make a PR. If you are interested in getting it going you could give it a shot. If you had any big questions I could probably point you in the right direction too. Thanks again for notifying us.