Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compilation issue with CAN communication on MCP chip #3

Open
julesberhault opened this issue May 9, 2024 · 1 comment
Open

Compilation issue with CAN communication on MCP chip #3

julesberhault opened this issue May 9, 2024 · 1 comment

Comments

@julesberhault
Copy link

Compilation error: 'MCP2515Class' does not name a type; did you mean 'MCP2515_INT'?

Trying to compile SineWaveCAN on ESP32 (M5Stack Basic) with MCP2515 chip (M5Stack COMMU)

Board: M5Stack-Core-ESP32
Dependencies:

Error output:

In file included from /private/var/folders/0y/hgrmrp757yzggl0t3b389nh40000gn/T/.arduinoIDE-unsaved202449-82551-1bp13dc.h7akg/SineWaveCAN/SineWaveCAN.ino:50:
/Users/julesberhault/Documents/Arduino/libraries/ODriveArduino/src/ODriveMCPCAN.hpp:17:21: error: 'MCP2515Class' was not declared in this scope
 static bool sendMsg(MCP2515Class& can_intf, uint32_t id, uint8_t length, const uint8_t* data) {
                     ^~~~~~~~~~~~
/Users/julesberhault/Documents/Arduino/libraries/ODriveArduino/src/ODriveMCPCAN.hpp:17:21: note: suggested alternative: 'MCP2515_INT'
 static bool sendMsg(MCP2515Class& can_intf, uint32_t id, uint8_t length, const uint8_t* data) {
                     ^~~~~~~~~~~~
                     MCP2515_INT
/Users/julesberhault/Documents/Arduino/libraries/ODriveArduino/src/ODriveMCPCAN.hpp:17:35: error: 'can_intf' was not declared in this scope
 static bool sendMsg(MCP2515Class& can_intf, uint32_t id, uint8_t length, const uint8_t* data) {
                                   ^~~~~~~~
/Users/julesberhault/Documents/Arduino/libraries/ODriveArduino/src/ODriveMCPCAN.hpp:17:35: note: suggested alternative: 'wprintf'
 static bool sendMsg(MCP2515Class& can_intf, uint32_t id, uint8_t length, const uint8_t* data) {
                                   ^~~~~~~~
                                   wprintf
/Users/julesberhault/Documents/Arduino/libraries/ODriveArduino/src/ODriveMCPCAN.hpp:17:54: error: expected primary-expression before 'id'
 static bool sendMsg(MCP2515Class& can_intf, uint32_t id, uint8_t length, const uint8_t* data) {
                                                      ^~
/Users/julesberhault/Documents/Arduino/libraries/ODriveArduino/src/ODriveMCPCAN.hpp:17:66: error: expected primary-expression before 'length'
 static bool sendMsg(MCP2515Class& can_intf, uint32_t id, uint8_t length, const uint8_t* data) {
                                                                  ^~~~~~
/Users/julesberhault/Documents/Arduino/libraries/ODriveArduino/src/ODriveMCPCAN.hpp:17:74: error: expected primary-expression before 'const'
 static bool sendMsg(MCP2515Class& can_intf, uint32_t id, uint8_t length, const uint8_t* data) {
                                                                          ^~~~~
/Users/julesberhault/Documents/Arduino/libraries/ODriveArduino/src/ODriveMCPCAN.hpp:17:93: error: expression list treated as compound expression in initializer [-fpermissive]
 static bool sendMsg(MCP2515Class& can_intf, uint32_t id, uint8_t length, const uint8_t* data) {
                                                                                             ^
/Users/julesberhault/Documents/Arduino/libraries/ODriveArduino/src/ODriveMCPCAN.hpp:35:24: error: variable or field 'pumpEvents' declared void
 static void pumpEvents(MCP2515Class& intf) {
                        ^~~~~~~~~~~~
/Users/julesberhault/Documents/Arduino/libraries/ODriveArduino/src/ODriveMCPCAN.hpp:35:24: error: 'MCP2515Class' was not declared in this scope
/Users/julesberhault/Documents/Arduino/libraries/ODriveArduino/src/ODriveMCPCAN.hpp:35:24: note: suggested alternative: 'MCP2515_INT'
 static void pumpEvents(MCP2515Class& intf) {
                        ^~~~~~~~~~~~
                        MCP2515_INT
/Users/julesberhault/Documents/Arduino/libraries/ODriveArduino/src/ODriveMCPCAN.hpp:35:38: error: 'intf' was not declared in this scope
 static void pumpEvents(MCP2515Class& intf) {
                                      ^~~~
/Users/julesberhault/Documents/Arduino/libraries/ODriveArduino/src/ODriveMCPCAN.hpp:35:38: note: suggested alternative: 'rintf'
 static void pumpEvents(MCP2515Class& intf) {
                                      ^~~~
                                      rintf
In file included from /private/var/folders/0y/hgrmrp757yzggl0t3b389nh40000gn/T/.arduinoIDE-unsaved202449-82551-1bp13dc.h7akg/SineWaveCAN/SineWaveCAN.ino:3:
/Users/julesberhault/Documents/Arduino/libraries/ODriveArduino/src/ODriveMCPCAN.hpp:41:25: error: 'MCP2515Class' was not declared in this scope
 CREATE_CAN_INTF_WRAPPER(MCP2515Class)
                         ^~~~~~~~~~~~
/Users/julesberhault/Documents/Arduino/libraries/ODriveArduino/src/ODriveCAN.h:12:40: note: in definition of macro 'CREATE_CAN_INTF_WRAPPER'
     ODriveCanIntfWrapper wrap_can_intf(TIntf& intf) { \
                                        ^~~~~
/Users/julesberhault/Documents/Arduino/libraries/ODriveArduino/src/ODriveMCPCAN.hpp:41:25: note: suggested alternative: 'MCP2515_INT'
 CREATE_CAN_INTF_WRAPPER(MCP2515Class)
                         ^~~~~~~~~~~~
/Users/julesberhault/Documents/Arduino/libraries/ODriveArduino/src/ODriveCAN.h:12:40: note: in definition of macro 'CREATE_CAN_INTF_WRAPPER'
     ODriveCanIntfWrapper wrap_can_intf(TIntf& intf) { \
                                        ^~~~~
/Users/julesberhault/Documents/Arduino/libraries/ODriveArduino/src/ODriveCAN.h:12:47: error: 'intf' was not declared in this scope
     ODriveCanIntfWrapper wrap_can_intf(TIntf& intf) { \
                                               ^~~~
/Users/julesberhault/Documents/Arduino/libraries/ODriveArduino/src/ODriveMCPCAN.hpp:41:1: note: in expansion of macro 'CREATE_CAN_INTF_WRAPPER'
 CREATE_CAN_INTF_WRAPPER(MCP2515Class)
 ^~~~~~~~~~~~~~~~~~~~~~~
/Users/julesberhault/Documents/Arduino/libraries/ODriveArduino/src/ODriveCAN.h:12:47: note: suggested alternative: 'rintf'
     ODriveCanIntfWrapper wrap_can_intf(TIntf& intf) { \
                                               ^~~~
/Users/julesberhault/Documents/Arduino/libraries/ODriveArduino/src/ODriveMCPCAN.hpp:41:1: note: in expansion of macro 'CREATE_CAN_INTF_WRAPPER'
 CREATE_CAN_INTF_WRAPPER(MCP2515Class)
 ^~~~~~~~~~~~~~~~~~~~~~~
/Users/julesberhault/Documents/Arduino/libraries/ODriveArduino/src/ODriveCAN.h:12:53: error: expected ',' or ';' before '{' token
     ODriveCanIntfWrapper wrap_can_intf(TIntf& intf) { \
                                                     ^
/Users/julesberhault/Documents/Arduino/libraries/ODriveArduino/src/ODriveMCPCAN.hpp:41:1: note: in expansion of macro 'CREATE_CAN_INTF_WRAPPER'
 CREATE_CAN_INTF_WRAPPER(MCP2515Class)
 ^~~~~~~~~~~~~~~~~~~~~~~
/private/var/folders/0y/hgrmrp757yzggl0t3b389nh40000gn/T/.arduinoIDE-unsaved202449-82551-1bp13dc.h7akg/SineWaveCAN/SineWaveCAN.ino:90:1: error: 'MCP2515Class' does not name a type; did you mean 'MCP2515_INT'?
 MCP2515Class& can_intf = CAN;
 ^~~~~~~~~~~~
 MCP2515_INT
/private/var/folders/0y/hgrmrp757yzggl0t3b389nh40000gn/T/.arduinoIDE-unsaved202449-82551-1bp13dc.h7akg/SineWaveCAN/SineWaveCAN.ino: In function 'void receiveCallback(int)':
/private/var/folders/0y/hgrmrp757yzggl0t3b389nh40000gn/T/.arduinoIDE-unsaved202449-82551-1bp13dc.h7akg/SineWaveCAN/SineWaveCAN.ino:108:37: error: 'CAN' was not declared in this scope
   CanMsg msg = {.id = (unsigned int)CAN.packetId(), .len = (uint8_t)packet_size};
                                     ^~~
/private/var/folders/0y/hgrmrp757yzggl0t3b389nh40000gn/T/.arduinoIDE-unsaved202449-82551-1bp13dc.h7akg/SineWaveCAN/SineWaveCAN.ino:108:37: note: suggested alternative: 'NAN'
   CanMsg msg = {.id = (unsigned int)CAN.packetId(), .len = (uint8_t)packet_size};
                                     ^~~
                                     NAN
/private/var/folders/0y/hgrmrp757yzggl0t3b389nh40000gn/T/.arduinoIDE-unsaved202449-82551-1bp13dc.h7akg/SineWaveCAN/SineWaveCAN.ino: In function 'bool setupCan()':
/private/var/folders/0y/hgrmrp757yzggl0t3b389nh40000gn/T/.arduinoIDE-unsaved202449-82551-1bp13dc.h7akg/SineWaveCAN/SineWaveCAN.ino:115:3: error: 'CAN' was not declared in this scope
   CAN.setPins(MCP2515_CS, MCP2515_INT);
   ^~~
/private/var/folders/0y/hgrmrp757yzggl0t3b389nh40000gn/T/.arduinoIDE-unsaved202449-82551-1bp13dc.h7akg/SineWaveCAN/SineWaveCAN.ino:115:3: note: suggested alternative: 'NAN'
   CAN.setPins(MCP2515_CS, MCP2515_INT);
   ^~~
   NAN
/private/var/folders/0y/hgrmrp757yzggl0t3b389nh40000gn/T/.arduinoIDE-unsaved202449-82551-1bp13dc.h7akg/SineWaveCAN/SineWaveCAN.ino: At global scope:
/private/var/folders/0y/hgrmrp757yzggl0t3b389nh40000gn/T/.arduinoIDE-unsaved202449-82551-1bp13dc.h7akg/SineWaveCAN/SineWaveCAN.ino:144:31: error: 'can_intf' was not declared in this scope
 ODriveCAN odrv0(wrap_can_intf(can_intf), ODRV0_NODE_ID); // Standard CAN message ID
                               ^~~~~~~~
/private/var/folders/0y/hgrmrp757yzggl0t3b389nh40000gn/T/.arduinoIDE-unsaved202449-82551-1bp13dc.h7akg/SineWaveCAN/SineWaveCAN.ino:144:31: note: suggested alternative: 'wprintf'
 ODriveCAN odrv0(wrap_can_intf(can_intf), ODRV0_NODE_ID); // Standard CAN message ID
                               ^~~~~~~~
                               wprintf
/private/var/folders/0y/hgrmrp757yzggl0t3b389nh40000gn/T/.arduinoIDE-unsaved202449-82551-1bp13dc.h7akg/SineWaveCAN/SineWaveCAN.ino: In function 'void setup()':
/private/var/folders/0y/hgrmrp757yzggl0t3b389nh40000gn/T/.arduinoIDE-unsaved202449-82551-1bp13dc.h7akg/SineWaveCAN/SineWaveCAN.ino:204:16: error: 'can_intf' was not declared in this scope
     pumpEvents(can_intf);
                ^~~~~~~~
/private/var/folders/0y/hgrmrp757yzggl0t3b389nh40000gn/T/.arduinoIDE-unsaved202449-82551-1bp13dc.h7akg/SineWaveCAN/SineWaveCAN.ino:204:16: note: suggested alternative: 'wprintf'
     pumpEvents(can_intf);
                ^~~~~~~~
                wprintf
/private/var/folders/0y/hgrmrp757yzggl0t3b389nh40000gn/T/.arduinoIDE-unsaved202449-82551-1bp13dc.h7akg/SineWaveCAN/SineWaveCAN.ino:204:5: error: 'pumpEvents' was not declared in this scope
     pumpEvents(can_intf);
     ^~~~~~~~~~
/private/var/folders/0y/hgrmrp757yzggl0t3b389nh40000gn/T/.arduinoIDE-unsaved202449-82551-1bp13dc.h7akg/SineWaveCAN/SineWaveCAN.ino:204:5: note: suggested alternative: 'ETSEvent'
     pumpEvents(can_intf);
     ^~~~~~~~~~
     ETSEvent
/private/var/folders/0y/hgrmrp757yzggl0t3b389nh40000gn/T/.arduinoIDE-unsaved202449-82551-1bp13dc.h7akg/SineWaveCAN/SineWaveCAN.ino:238:18: error: 'can_intf' was not declared in this scope
       pumpEvents(can_intf);
                  ^~~~~~~~
/private/var/folders/0y/hgrmrp757yzggl0t3b389nh40000gn/T/.arduinoIDE-unsaved202449-82551-1bp13dc.h7akg/SineWaveCAN/SineWaveCAN.ino:238:18: note: suggested alternative: 'wprintf'
       pumpEvents(can_intf);
                  ^~~~~~~~
                  wprintf
/private/var/folders/0y/hgrmrp757yzggl0t3b389nh40000gn/T/.arduinoIDE-unsaved202449-82551-1bp13dc.h7akg/SineWaveCAN/SineWaveCAN.ino:238:7: error: 'pumpEvents' was not declared in this scope
       pumpEvents(can_intf);
       ^~~~~~~~~~
/private/var/folders/0y/hgrmrp757yzggl0t3b389nh40000gn/T/.arduinoIDE-unsaved202449-82551-1bp13dc.h7akg/SineWaveCAN/SineWaveCAN.ino:238:7: note: suggested alternative: 'ETSEvent'
       pumpEvents(can_intf);
       ^~~~~~~~~~
       ETSEvent
/private/var/folders/0y/hgrmrp757yzggl0t3b389nh40000gn/T/.arduinoIDE-unsaved202449-82551-1bp13dc.h7akg/SineWaveCAN/SineWaveCAN.ino: In function 'void loop()':
/private/var/folders/0y/hgrmrp757yzggl0t3b389nh40000gn/T/.arduinoIDE-unsaved202449-82551-1bp13dc.h7akg/SineWaveCAN/SineWaveCAN.ino:246:14: error: 'can_intf' was not declared in this scope
   pumpEvents(can_intf); // This is required on some platforms to handle incoming feedback CAN messages
              ^~~~~~~~
/private/var/folders/0y/hgrmrp757yzggl0t3b389nh40000gn/T/.arduinoIDE-unsaved202449-82551-1bp13dc.h7akg/SineWaveCAN/SineWaveCAN.ino:246:14: note: suggested alternative: 'wprintf'
   pumpEvents(can_intf); // This is required on some platforms to handle incoming feedback CAN messages
              ^~~~~~~~
              wprintf
/private/var/folders/0y/hgrmrp757yzggl0t3b389nh40000gn/T/.arduinoIDE-unsaved202449-82551-1bp13dc.h7akg/SineWaveCAN/SineWaveCAN.ino:246:3: error: 'pumpEvents' was not declared in this scope
   pumpEvents(can_intf); // This is required on some platforms to handle incoming feedback CAN messages
   ^~~~~~~~~~
/private/var/folders/0y/hgrmrp757yzggl0t3b389nh40000gn/T/.arduinoIDE-unsaved202449-82551-1bp13dc.h7akg/SineWaveCAN/SineWaveCAN.ino:246:3: note: suggested alternative: 'ETSEvent'
   pumpEvents(can_intf); // This is required on some platforms to handle incoming feedback CAN messages
   ^~~~~~~~~~
   ETSEvent

exit status 1

Compilation error: 'MCP2515Class' does not name a type; did you mean 'MCP2515_INT'?
@samuelsadok
Copy link
Member

It seems you're using a different MCP library. The ODrive library assumes this one, which looks like this in the library manager:
image

If you prefer MCP_CAN_lib instead, you would have to write a small glue layer similar to the existing "ODriveMCPCAN.hpp".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants