情况:
-
我们有一台带
USB2CAN adapter
-
我们只有一个节点,因为另一个节点是车辆电缆,可能会断开
-
如果我们在没有另一个节点的情况下在can上写,它会失败(当然),但问题是错误(错误传递)会每秒抛出一次,而且迟早会抛出
无形地
破坏can总线
-
无形意味着如果我重新启动电脑,can界面看起来会很好,但不会有消息通过
-
我已经看到我可以在python can中使用gs_usb驱动程序,但由于我可以简单地使用cansend来破坏东西,我认为这不会有任何区别
$ ip a l can0
4: can0: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state UP group default qlen 10
link/can
# qlen here is 100000 because I tried upping it from 1 but it did not work
# the state will go back to ERROR-ACTIVE when the cable is connected
# error-warn goes up once when the cable is disconnected
# error-pass goes up around 2k per second, even with a single message sent
$ ip -details -statistic link show dev can15: can1: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state UP mode DEFAULT group default qlen 100000
link/can promiscuity 0 minmtu 0 maxmtu 0
can state ERROR-PASSIVE restart-ms 0
bitrate 500000 sample-point 0.875
tq 125 prop-seg 6 phase-seg1 7 phase-seg2 2 sjw 1
gs_usb: tseg1 1..16 tseg2 1..8 sjw 1..4 brp 1..1024 brp-inc 1
clock 48000000
re-started bus-errors arbit-lost error-warn error-pass bus-off
0 0 0 3 10578541 0 numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535
RX: bytes packets errors dropped missed mcast
84628424 10578553 0 0 0 0
TX: bytes packets errors dropped carrier collsns
2 1 0 0 0 0
其他信息:
-
操作系统是linux Debian(Crunchbang++)
-
can设置为
ip link set can1 type can bitrate 500000
-
有
an issue
关于可能看起来像我的供应商回购(没有提供解决方案)
-
我们尝试使用另一家供应商的另一个can到usb适配器,它也有同样的行为
-
唯一的解决方案是移除适配器的电流,我尝试通过软件将电流从USB端口移除到适配器,但没有成功
$ lsusb --tree -v
/: Bus 03.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/1p, 5000M
ID 1d6b:0003 Linux Foundation 3.0 root hub
|__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/4p, 5000M
ID 0424:5534 Microchip Technology, Inc. (formerly SMSC) Hub
/: Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/6p, 480M
ID 1d6b:0002 Linux Foundation 2.0 root hub
|__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/4p, 480M
ID 0424:2134 Microchip Technology, Inc. (formerly SMSC) Hub
|__ Port 2: Dev 6, If 0, Class=Human Interface Device, Driver=usbhid, 12M
ID 0eef:c000 D-WAV Scientific Co., Ltd Multitouch Capacitive Touchscreen eGalaxTouch EXC3188-4643-08.00.00.00 Sirius_4643 PCAP3188UR Series [IIyama Prolite PLT1932MSC
|__ Port 3: Dev 7, If 0, Class=Hub, Driver=hub/4p, 480M
ID 1a40:0101 Terminus Technology Inc. Hub
|__ Port 1: Dev 9, If 1, Class=Application Specific Interface, Driver=, 12M
ID 1d50:606f OpenMoko, Inc. Geschwister Schneider CAN adapter
|__ Port 1: Dev 9, If 0, Class=Vendor Specific Class, Driver=gs_usb, 12M
ID 1d50:606f OpenMoko, Inc. Geschwister Schneider CAN adapter
|__ Port 2: Dev 10, If 0, Class=Vendor Specific Class, Driver=gs_usb, 12M
ID 1d50:606f OpenMoko, Inc. Geschwister Schneider CAN adapter
|__ Port 2: Dev 10, If 1, Class=Application Specific Interface, Driver=, 12M
ID 1d50:606f OpenMoko, Inc. Geschwister Schneider CAN adapter
$ dmesg
...
[ 9.697798] usb 2-1.3.2: New USB device found, idVendor=1d50, idProduct=606f, bcdDevice= 0.00
[ 9.697802] usb 2-1.3.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 9.697805] usb 2-1.3.2: Product: USB2CAN v1
[ 9.697807] usb 2-1.3.2: Manufacturer: InnoMaker
[ 9.697810] usb 2-1.3.2: SerialNumber: 002C00...
...
[ 10.154148] gs_usb 2-1.3.1:1.0: Configuring for 1 interfaces
[ 10.154921] gs_usb 2-1.3.2:1.0: Configuring for 1 interfaces
[ 10.155372] usbcore: registered new interface driver gs_usb
...
[ 12.461996] IPv6: ADDRCONF(NETDEV_CHANGE): can0: link becomes ready
...
[ 15.439110] IPv6: ADDRCONF(NETDEV_CHANGE): can1: link becomes ready
[ 15.572371] can: controller area network core
[ 15.572501] NET: Registered protocol family 29
[ 15.589581] can: raw protocol
python可以查看日志
Count Time dt ID DLC Data (changed)
17 0.002219 0.000000 0x004 8 00 30 00 00 00 00 80 00
208182 122.054997 0.000723 0x024 8 00 30 00 00 00 00 80 00
# my test packet
14 0.000000 0.000000 0x123 2 12 34
我有另一个项目,你可以删除can连接器,在总线上写入会引发错误,但不会触发错误级联,所以我只想复制这种行为
我不知道这是硬件还是软件问题,所以我在stackoverflow上发帖(有74页can总线线程,而其他*溢出几乎没有结果)
其他我要测试的东西
-
回环模式
-
使用虚拟can消耗未确认的错误
-
以某种方式将can适配器设置为“活动”,以便它也确认消息