[英]Python CAN isotp socket is not receiving data but the candump is received
我正在尝试通过笔记本电脑(设备 2)中的独木舟与 Pican3+Raspberry Pi 4(设备 1)进行通信。 我在树莓派中使用 python can isotp 模块。 我可以将 raspberry pi 中的代码中的数据发送到 canoe,但无法接收从 Canoe 发送到 raspberryPi 的数据到我在 python 代码中创建的 isotp.socket。 但是数据是在树莓派端接收的,用candump验证。 下面是使用的代码。
import isotp
s = isotp.socket()
s.bind("can0", isotp.Address(rxid=0x701, txid=0x708))
s.send(b'a')
while True:
da = s.recv()
if da is not None:
print('here')
print(da)
从独木舟发送的消息具有消息 ID 701 和标准 can 帧。 根据我的理解,套接字被绑定为从 can0 通道接收 ID 为 701 的消息。 我错过了什么吗? 附上用独木舟编写的消息截图和来自raspberry的candump,请查看。
代码中没有问题,并且工作正常。 问题出在另一端,我试图将 CAN 帧从笔记本电脑中的 Canoe 发送到 PICAN。 该帧不是按照 ISO TP 格式创建的,因为 raspberry pi linux 中的 iso tp 层无法处理它。 一旦我按照 isotp 制定了 CAN 帧,在代码中创建的套接字接收和处理数据。 有关 ISO TP 协议的更多信息,请查看https://www.emotive.de/wiki/index.php?title=ISOTP
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.