pierremolinaro / acan-esp32

An ESP32 CAN 2.0B library
MIT License
40 stars 16 forks source link

Possible to have 2 CAN channels? (1 internal 1 MCP2515) #1

Closed turbotom93 closed 2 years ago

turbotom93 commented 3 years ago

Can I use this library with the builtin CAN controller and a MCP2515 at the same time? If so, how would I setup and differentiate the two channels?

pierremolinaro commented 3 years ago

Yes, you can use together the ACAN2515 library and the ACAN_ESP32 library in a same project. They are designed to coexist within the same project.

For setting up, I propose the following roadmap: 1) run the ACAN_ESP32 LoopBackDemo, you have to adapt the code to your actual TX and RX pins ; 2) run the ACAN2515 LoopBackDemo, you have to adapt the code to your actual MCP2515_CS and MCP2515_INT pins ; 3) merge the two codes: The ACAN_ESP32 interface object is ACAN_ESP32::can, so for sending throught native CAN you call ACAN_ESP32::can.tryToSend, and for receiving you call ACAN_ESP32::can.receive ; The ACAN2515 interface object is can, so for sending throught native CAN you call can.tryToSend, and for receiving you call can.receive ; the ACAN2515 interface object nalme is free, you can rename it to can2515, so as to make the name more appropriate.

In the settings object of each interface, you specify its bit rate. You are free to use the same bit rate, or adopt different ones.

Regards,

Pierre

Le 4 juin 2021 à 05:23, turbotom93 @.***> a écrit :

Can I use this library with the builtin CAN controller and a MCP2515 at the same time? If so, how would I setup and differentiate the two channels?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/pierremolinaro/acan-esp32/issues/1, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEWKZVGIHAGSHBG4DI2V2TDTRBBLHANCNFSM46B7AC5A.