I’m using a RT1062 CAM with CAN/RS232 SHIELD with CAN chip connected on P1 and P3. I’m using OPENMV IDE 5.0. I try to follow few SW example for CAN BUS but seems not working, no CAN message transmitted nor received.
Could you please confirm CAN/RS232 SHIELD can work with RT1062 and IDE V 5.0 ? Is it possible to get implementation example ?
Hi, please install the latest firmware via Tools->Install the Latest Dev firmware. CAN wasn’t enabled on the RT1062 in the v5.0.0 release but is enabled via the tip of dev.
Note that the API completely changed from what it was previously as it is now officially supported by MicroPython.
import time
from machine import CAN
TRANSMITTER = True
can = CAN(1, bitrate=1000000)
if TRANSMITTER:
while True:
can.send(123, b"\xDE\xAD\xBE\xEF")
print("tx !")
time.sleep_ms(1000)
else:
can.setfilter(0, CAN.DUAL, 0, [1, 2])
while True:
# Receive messages on FIFO 0 (there's only one fifo)
print(can.recv(0, timeout=10000))