Hi, I’m trying to send some FD frames with the ‘python-can’ v4.1.0 on Ubuntu 20.04.6 LTS (Kernel 5.15.0-67-generic + Python 3.8.10) + SocketCAN driver.
The CAN bus is configured like this:
ip link set down can0
ip link set can0 type can bitrate 500000 sample-point 0.80 dbitrate 2000000 dsample-point 0.8 fd on restart-ms 100
ip link set up can0
The python test code:
# python 3.8.10
# python-can 4.1.0
import time
import can
class Test:
def run(self):
try:
bus = can.interface.Bus(interface='socketcan', channel='can0', fd=True)
cnt = 0
data = bytearray(16)
data[0] = 0xAA
for i in range(100):
data[1] = cnt & 0xFF
msg = can.Message(arbitration_id=0x111, is_extended_id=False, data=data, is_fd=True, bitrate_switch=True)
cnt += 1
time.sleep(0.5)
except:
pass
finally:
if bus is not None:
bus.shutdown()
t = Test()
t.run()
I see only classic CAN frames coming out - no FD and BRS flags set! To be sure, even checked the physical bus with an oscilloscope - didn’t observe bitrate switching.
Why is that?
(BTW, the same script runs fine on Win10 + VCI drivers.)