I did get this to work. I'm using this library for the CAN part:
https://github.com/aaknitt/esp32_can/tree/master
Put this code in lib and change the pin designations in esp32_can.cpp:
ESP32CAN attribute((weak)) CAN0(GPIO_NUM_1, GPIO_NUM_2) ;
platformio.ini looks like this:
[env:m5stack-stamps3]
platform = espressif32
board = m5stack-stamps3
framework = arduino
lib_deps =
https://github.com/collin80/can_common
https://github.com/plapointe6/EspMQTTClient
m5stack/M5Dial
m5stack/M5Unified
upload_speed = 1500000
monitor_speed = 115200
Plug it into Port B
Setup code is like:
CAN0.setCANPins(GPIO_NUM_1, GPIO_NUM_2);
USBSerial.println("Set CAN pins...");
CAN0.begin(500000);
USBSerial.println("CAN has started...");
CAN0.watchFor();
CAN0.setCallback(0, theCanDecoder);
If you want full code I can probably clean this all up and publish on Git.