CAN Support on N6

Hi, I am having trouble trying to get CAN working with the N6. I have tried both the pyb and machine libraries and neither have the CAN module present. Is this going to be released in the firmware at some point to have this enabled?

Currently have firmware 4.8.0 (as a side note the latest dev release seems to not allow my IDE to connect to the board and simply says “busy”).

Hi, you need the latest dev firmware. You have to install the newest version of the IDE for it to work with your camera: Download – OpenMV

CAN is merged into the dev release, and it’s working.

Hi, I have updated my IDE and downloaded the latest release from github on the N6. It still doesn’t seem to be available. This is what I am running

import pyb
import machine

print(f"pyb contents \n {dir(pyb)}“)
print(f"machine contents \n {dir(machine)}”)

"pyb contents
[‘class’, ‘name’, ‘main’, ‘ADC’, ‘ADCAll’, ‘ExtInt’, ‘Flash’, ‘LED’, ‘Pin’, ‘RTC’, ‘SDCard’, ‘SPI’, ‘Timer’, ‘UART’, ‘dict’, ‘country’, ‘disable_irq’, ‘enable_irq’, ‘fault_debug’, ‘repl_info’, ‘repl_uart’, ‘rng’, ‘wfi’]
machine contents
[‘class’, ‘name’, ‘ADC’, ‘DEEPSLEEP_RESET’, ‘HARD_RESET’, ‘I2C’, ‘LED’, ‘PWM’, ‘PWRON_RESET’, ‘Pin’, ‘RTC’, ‘SOFT_RESET’, ‘SPI’, ‘Signal’, ‘SoftI2C’, ‘SoftSPI’, ‘Timer’, ‘UART’, ‘USBDevice’, ‘WDT’, ‘WDT_RESET’, ‘dict’, ‘file’, ‘bitstream’, ‘bootloader’, ‘deepsleep’, ‘dht_readinto’, ‘disable_irq’, ‘enable_irq’, ‘freq’, ‘idle’, ‘info’, ‘lightsleep’, ‘mem16’, ‘mem32’, ‘mem8’, ‘os’, ‘reset’, ‘reset_cause’, ‘rng’, ‘sleep’, ‘soft_reset’, ‘time_pulse_us’, ‘unique_id’]

OpenMV e86106720c; MicroPython 0f831e89f0; OpenMV N6 with STM32N657X0
Type “help()” for more information."

Hi George,

firmware.zip (1.2 MB)

Upstream MicroPython doesn’t enable the N6 CAN, just the H7. I’ve gone through the codebase and enabled it… however, didn’t have time to test it yet. Just got it to compile. Probably broken, but the modules appear now.

I’ll give it a test tomorrow. However, if it’s working already, let me know.

Note that only CAN1 is operational. CAN3 is not.

Okay, I got N6 CAN working.

Here’s a binary:

firmware.zip (1.2 MB)

There are a bunch of changes needed for this. It will be a while before this passes PR review in upstream MicroPython is mergedable into OpenMV.

from machine import CAN
import time

can = CAN(1, 500_000)
can.set_filters(None)
while True:
    can.send(123, b"\xDE\xAD\xBE\xEF")
    msg = can.recv()
    if msg:
        print(msg)
    time.sleep(0.01)