Hi, I am currently transitioning from STM32CubeIDE to Arduino IDE so I am not yet too familiar with Arduino IDE. I have difficulties setting up the programming environment to use a SPI-based CAN shield with Arduino GIGA R1 WiFi.
Hardware:
- Arduino GIGA R1 WiFi
- (Clone) of seeedstudio's CAN-BUS Shield V2.0
Software:
- Arduino IDE, with Seeed_Arduino_CAN library
To get started, I grabbed an example code included in seeedstudio's library, however I get compiling errors right away. Narrowing it down, this barebone code will not compile. The target device is set as Arduino GIGA R1 WiFi (M7 (default) core).
#include "mcp_can.h"
void setup() {
}
void loop() {
}
This is the compile error log:
In file included from C:\Users\(user)\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.3.1\cores\arduino/mbed/targets/TARGET_STM/TARGET_STM32H7/STM32Cube_FW/stm32h7xx_hal_conf.h:402:0,
from C:\Users\(user)\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.3.1\cores\arduino/mbed/targets/TARGET_STM/TARGET_STM32H7/STM32Cube_FW/STM32H7xx_HAL_Driver/stm32h7xx_hal.h:30,
from C:\Users\(user)\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.3.1\cores\arduino/mbed/targets/TARGET_STM/TARGET_STM32H7/STM32Cube_FW/CMSIS/stm32h7xx.h:223,
from C:\Users\(user)\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.3.1\cores\arduino/mbed/targets/TARGET_STM/TARGET_STM32H7/cmsis.h:22,
from C:\Users\(user)\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.3.1\cores\arduino/mbed/targets/TARGET_STM/PinNamesTypes.h:33,
from C:\Users\(user)\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.3.1\variants\GIGA/pinmode_arduino.h:24,
from C:\Users\(user)\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.3.1\cores\arduino/Arduino.h:26,
from c:\Users\(user)\Documents\Arduino\libraries\CAN_BUS_Shield\src/mcp_can.h:4,
from c:\Users\(user)\Documents\Arduino\libraries\CAN_BUS_Shield\src/can-serial.h:24,
from C:\Users\(user)\Documents\Arduino\arduino_can\driver_CAN.cpp:1:
C:\Users\(user)\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.3.1\cores\arduino/mbed/targets/TARGET_STM/TARGET_STM32H7/STM32Cube_FW/STM32H7xx_HAL_Driver/stm32h7xx_hal_gpio.h:86:36: error: expected identifier before '(' token
#define GPIO_PIN_0 ((uint16_t)0x0001) /* Pin 0 selected */
^
c:\Users\(user)\Documents\Arduino\libraries\CAN_BUS_Shield\src/mcp2518fd_can_dfs.h:663:16: note: in expansion of macro 'GPIO_PIN_0'
typedef enum { GPIO_PIN_0, GPIO_PIN_1 } GPIO_PIN_POS;
^
C:\Users\(user)\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.3.1\cores\arduino/mbed/targets/TARGET_STM/TARGET_STM32H7/STM32Cube_FW/STM32H7xx_HAL_Driver/stm32h7xx_hal_gpio.h:86:36: error: expected '}' before '(' token
#define GPIO_PIN_0 ((uint16_t)0x0001) /* Pin 0 selected */
^
c:\Users\(user)\Documents\Arduino\libraries\CAN_BUS_Shield\src/mcp2518fd_can_dfs.h:663:16: note: in expansion of macro 'GPIO_PIN_0'
typedef enum { GPIO_PIN_0, GPIO_PIN_1 } GPIO_PIN_POS;
^
C:\Users\(user)\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.3.1\cores\arduino/mbed/targets/TARGET_STM/TARGET_STM32H7/STM32Cube_FW/STM32H7xx_HAL_Driver/stm32h7xx_hal_gpio.h:86:47: error: expected ')' before numeric constant
#define GPIO_PIN_0 ((uint16_t)0x0001) /* Pin 0 selected */
^
c:\Users\(user)\Documents\Arduino\libraries\CAN_BUS_Shield\src/mcp2518fd_can_dfs.h:663:16: note: in expansion of macro 'GPIO_PIN_0'
typedef enum { GPIO_PIN_0, GPIO_PIN_1 } GPIO_PIN_POS;
^
In file included from c:\Users\(user)\Documents\Arduino\libraries\CAN_BUS_Shield\src/mcp2518fd_can.h:6:0,
from C:\Users\(user)\Documents\Arduino\arduino_can\driver_CAN.cpp:4:
c:\Users\(user)\Documents\Arduino\libraries\CAN_BUS_Shield\src/mcp2518fd_can_dfs.h:663:41: error: 'GPIO_PIN_POS' does not name a type; did you mean 'GPIO_PIN_SET'?
typedef enum { GPIO_PIN_0, GPIO_PIN_1 } GPIO_PIN_POS;
^~~~~~~~~~~~
GPIO_PIN_SET
In file included from C:\Users\(user)\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.3.1\cores\arduino/mbed/targets/TARGET_STM/TARGET_STM32H7/STM32Cube_FW/CMSIS/stm32h7xx.h:136:0,
from C:\Users\(user)\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.3.1\cores\arduino/mbed/targets/TARGET_STM/TARGET_STM32H7/cmsis.h:22,
from C:\Users\(user)\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.3.1\cores\arduino/mbed/targets/TARGET_STM/PinNamesTypes.h:33,
from C:\Users\(user)\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.3.1\variants\GIGA/pinmode_arduino.h:24,
from C:\Users\(user)\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.3.1\cores\arduino/Arduino.h:26,
from c:\Users\(user)\Documents\Arduino\libraries\CAN_BUS_Shield\src/mcp_can.h:4,
from c:\Users\(user)\Documents\Arduino\libraries\CAN_BUS_Shield\src/can-serial.h:24,
from C:\Users\(user)\Documents\Arduino\arduino_can\driver_CAN.cpp:1:
C:\Users\(user)\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.3.1\cores\arduino/mbed/targets/TARGET_STM/TARGET_STM32H7/STM32Cube_FW/CMSIS/stm32h747xx.h:2698:43: error: expected ')' before '*' token
#define CRC ((CRC_TypeDef *) CRC_BASE)
^
c:\Users\(user)\Documents\Arduino\libraries\CAN_BUS_Shield\src/mcp2518fd_can_dfs.h:1487:14: note: in expansion of macro 'CRC'
uint32_t CRC : 16;
^
C:\Users\(user)\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.3.1\cores\arduino/mbed/targets/TARGET_STM/TARGET_STM32H7/STM32Cube_FW/CMSIS/stm32h747xx.h:2698:43: error: expected ')' before '*' token
#define CRC ((CRC_TypeDef *) CRC_BASE)
^
c:\Users\(user)\Documents\Arduino\libraries\CAN_BUS_Shield\src/mcp2518fd_can_dfs.h:1487:14: note: in expansion of macro 'CRC'
uint32_t CRC : 16;
^
In file included from c:\Users\(user)\Documents\Arduino\libraries\CAN_BUS_Shield\src/mcp2518fd_can.h:6:0,
from C:\Users\(user)\Documents\Arduino\arduino_can\driver_CAN.cpp:4:
c:\Users\(user)\Documents\Arduino\libraries\CAN_BUS_Shield\src/mcp2518fd_can_dfs.h:1590:1: error: expected declaration before '}' token
}
^
exit status 1
Compilation error: exit status 1Downloading ESP32Servo@3.0.8
ESP32Servo@3.0.8
Installing ESP32Servo@3.0.8
Replacing ESP32Servo@3.0.7 with ESP32Servo@3.0.8
Installed ESP32Servo@3.0.8
Does someone know if that is a known issue (mcp_can incompatibility?), or perhaps have I missed something that I should have done ?


