Hello, I’m trying to used CAN shield (old) with the new OpenMV RT1062 using the Exemple/Board Control/can.py. But I have an error OSError: [Errno 116] ETIMEDOUT in send and recv.
With the old version of OpenMV i have no problem using pyb lib.
Somebody have the same problem ? Any idea to solve this. Software or hardware ?
It possible it’s due to the compatibilité of CAN Shield – OpenMV
This module used
P2 = CAN TX
P3 = CAN RX
New module use
P1 = CAN TX (default)
P2 = CAN TX (alternative)
P3 = CAN RX
Is it software or hardware probleme ?
It is working for somebody ?
# This work is licensed under the MIT license.
# Copyright (c) 2013-2024 OpenMV LLC. All rights reserved.
# https://github.com/openmv/openmv/blob/master/LICENSE
#
# CAN Shield Example
#
# This example demonstrates CAN communications between two cameras.
# NOTE: you need two CAN transceiver shields and DB9 cable to run this example.
import time
from machine import CAN
# NOTE: Set to False on receiving node.
TRANSMITTER = True
can = CAN(0, CAN.NORMAL, baudrate=1000000, auto_restart=True)
if TRANSMITTER:
while True:
# Send message with id 1
can.send("Hello", 1, timeout=100, extframe=False)
time.sleep_ms(1000)
else:
# Runs on the receiving node.
# Set a filter to receive messages with id=1 and 2
# Filter index, mode (DUAL, etc..), FIFO (0), params
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))