M2 CAN Loopback
Send a CAN frame on CAN0 and receive it on CAN1, and vice versa.
Items Used
1x M2
M2 Sketch
Upload THIS SKETCH to your M2, which sends a CAN frame on CAN0 or CAN1 when you push switch 1 or 2, respectively. M2 will also blink a light when it receives a CAN frame on either channel.
OBD3way Setup
Connect M2 and OBD3way board as shown below. This connects M2's CAN0 to CAN1, hence "loopback".
Test
Try sending a CAN frame on both CAN0 and CAN1; the M2 LED should blink after each time signifying it has received its own message! (The M2 sketch also includes serial printouts, keep your M2 connected to your computer and open the Arduino IDE's serial monitor at baud 115200 to view these messages.)
Last updated