OPENMV IDE V 5.0 and CAN BUS functions implemented for RT1062 CAM

Hello,

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 ?

Regards

Davide Pontremolesi

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.

This is the code used for the test:

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))

This should send:

You need to put receive in a loop (probably with a delay if you want to see received messages).