linklayer / cantact-fw

Firmware source files for the CANtact tool
http://cantact.io
Other
260 stars 179 forks source link

High RX load TX issue #17

Open riodda opened 6 years ago

riodda commented 6 years ago

I'm having some issues with cantact (minipci variation): Seldomly i'm having this error message bringing up the interface cdc_acm 2-1.4:1.0: failed to set dtr/rts Also when the interface starts if i have no frames on bus the cantact sends it's message correctly, if start loading the bus cantact after a while stops sending frames (but still keep receiving, led blinks and candump shows incoming frames). To fix i need a power cycle, soft reboot of the host machine is not enough I'm sure is not an issue of the linux side becouse if i replace cantact with cantin i have no more issues, therfore i guess the slcan linux side is ok. here are is my starting script:

`#!/bin/sh

slcan_attach -f -s8 -o /dev/ttyACM0 sleep 1 slcand ttyACM0 slcan0 sleep 5 ifconfig slcan0 up sleep 2 /root/JSON.sh/send-3ginfo.sh & ` send-3ginfo.sh just sends the LTE line informations to the can using CANSEND, it's a simple bash script.

Tested also something different

slcand -o -c -f -s8 -S921600 /dev/ttyACM0 slcan1 sleep 2 ifconfig slcan0 up sleep 2 /root/JSON.sh/send-3ginfo.sh &

Changes a bit the behaviour, i keep receving the frames from the OpenWRT box but by the time passes i start having dropped frames and takes longer time to stop sending. Haven't tested yet higher speeds but will do for sure. What is weird is that i can see locally the fames (with candump) but not remotely. That means to me that the frames are sent to the socket interface but not to the bus by the canable.

My setup is:

cantact side: APU3 with last OpenWRT With an ME909s LTE modem (using interfaces ttyUSB2 and usb0)

Bus Side Windows with PCAN interface and PCAN-View to load the bus, the bus is set at 1Mbit, terminated both sides.

riodda commented 6 years ago

I tested with cantin wich is another slcan usb and i had no issue, therfore i fear the problem is not in the slcand but in the cantact firmware. thanks.

normaldotcom commented 6 years ago

I have encountered some performance issues with cantact-fw on high bus load applications and when sending/receiving rapidly. I've been recommending the candlelight firmware to people with canable/cantact recently for high bus load applications on Linux--it works quite well.

https://github.com/HubertD/candleLight_fw

riodda commented 6 years ago

Unfortunately there is no support on openwrt for gs_usb therfore no candlelight for me ! I have no need of receiving any frame i just need to send, is it there a way to set a filter with socketcan/slcan or in the firmware ? thanks!

riodda commented 6 years ago

I fear the problem is not in the firmware but in the hw, i guess i have some noise coming in when i receive frames, is that possible Ethan ? Thanks.

snir-levi commented 6 years ago

I'm having the same issue here. Using Cantact v1.0 I tried about everything:

as @riodda said, i fear the issue is the hw. The reason is that i tried 2 firmwares, and also tried this expermint: One edge connected with usb to my computer and the other does not connected to the OBD2 (to figure out if it is the can bus issue and not the hw side) I transmitted the messages manually with cansend, and looking at the statistics, after 3 messages i couldn't transmit anymore:

95: can0: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state UNKNOWN mode DEFAULT group default qlen 10 link/can promiscuity 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 4 1 0
RX: bytes packets errors dropped overrun mcast
128 16 0 0 0 0
TX: bytes packets errors dropped carrier collsns 24 3 0 0 0 0

Any ideas?