Hello, I am trying to communicate via CAN but I am always gettitn an OsError_16 after trying to send three messages. However in the bus I dont see those messages.

Here is my code:

# Untitled - By: Juan - lu. ene. 8 2018

import sensor, image, time, utime
import pyb

can = pyb.CAN(2)                        #The bus 2(PB12, PB13) is the only can bus on the Open MVCam

can.init(pyb.CAN.NORMAL, extframe=False, prescaler=18, sjw=1, bs1=8, bs2=3) #250kb/s
# APB1 = 54MHz, Prescaler 18 et 250kB/s --> 12 time quanta par bit (1 + 8 + 3 = 12)
can.setfilter(0, pyb.CAN.LIST16, 0, [0x700, 0x700, 0x701, 0x702], rtr = [0, 1, 0, 0])

sensor.skip_frames(time = 2000)

clock = time.clock()
tiempo= utime.ticks_ms() # get millisecond counter
    img = sensor.snapshot()
    data= b'\x01\x50'
    if (tiempo + 1000)< (tiempo2):
        tiempo= utime.ticks_ms() # get millisecond counter
        can.send(data, id = 0x702, timeout=0, rtr=False)
        print("can : message sent") # [Debug]

And the Serial Output

>>> (216000000, 216000000, 54000000, 108000000)
can : message sent
can : message sent
can : message sent

Traceback (most recent call last):
  File "<stdin>", line 28, in <module>
OSError: 16
MicroPython v1.9.2-4416-g17df8ae1 on 2017-11-04; OPENMV3 with STM32F765
Type "help()" for more information.

Any ideas?

Hi, I’ve never done anything with the CAN peripheral. Ibrahim might know how to work it. Pinging him.

Note, if you ask for help on the main MP forums they might know more.

I’m not sure either, I don’t have the hardware to test CAN. OSError 16 is “Device or resource busy” I found this on MP forums: