使用ESP32内部CAN控制器资源,实现CAN总线数据收发,注:使用前需要为设备接入 CAN UNIT .
Init bus n extframe True/False mode x baudrate TX RX
Get state of the controller
If any message wating on the FIFO
Send Message with id x
list
或是tuple
, 数据帧的数据长度要求是8个byte
。Receive message
Set filter bank x mode x message
Clear filter
Clear TX queue
Clear RX queue
Restart
Deinit
测试案例: 使用两台M5Core设备,分别将CAN UNIT连接PORT C(如需使用别端口,请更改初始化程序中的引脚配置),分别运行下方程序,按下按键A发送数据帧。