-
Notifications
You must be signed in to change notification settings - Fork 289
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cansequence tool shows wrong telegram order #166
Comments
Hey @mawekman, can you try my latest firmware: https://github.com/marckleinebudde/candleLight_fw/tree/multichannel |
Can you connect the candlelight without an USB-hub? |
Hey @marckleinebudde, if have compiled and flashed your firmware but the behaviour ist the same. Connecting the candlelight to an port not routed over an USB-hub is not possible on pi4. The pi4 boards use an pcie USB controller to provide USB Interfaces. We have tested a VIA VL805 Chip pcie card (this is the one on the standard pi4 board) on the cm4-io-board and a pcie card with a Renesas upd720201 chip. The behaviour of both cards is the same. |
I think the RX side on the µC hardware is configured for FIFO, so there shouldn't be any re-orderings on the hardware side. Is your kernel new enough to support HW timestamps? What does |
Hi @marckleinebudde , I'm working on compiling a new kernel with timestamping support in the gs_usb driver. I just noticed that I translated the wrong candlelight firmware branch. So I will repeat uploading a new firmware. But when I compile the correct multichannel branch I get following error: |
It should compile now - I've force pushed the |
I'm sorry, I've updated the branch but it's still the same issue. |
Please show me the output of:
|
`root@debian11:/mnt/hgfs/share/marckleinebudde/repos/candleLight_fw# git status nothing to commit, working tree clean You may now: |
Ok, you're indeed building the correct branch. Maybe a different compiler version. Let's try:
Then we see the used compiler, here it's
It's from current Debian testing. |
It seems my compiler ist quit old.
So I will first udate the gcc and try it again. |
Is that current Debian stable aka Bullseye aka Debian 11? I can reproduce the issue with the old compiler. Update: I have a fix that works with the old compiler. |
I've force pushed my branch. Now it works even with the older compiler. |
Hi @marckleinebudde, thanks a lot for your help. |
I don't think anyone has tested USB-CAN devices under RT configurations. As I speculated earlier #166 (comment), I think the networking stack might reorder the CAN frames. I think this problem is best discussed on the [email protected] mailing list. |
For the reference: |
oh wow good work tracking that down. How are other (non-CAN) usb network adapters handling this ? |
I should add the solution to my mail, here's the problem description:
The solution to the problem is to use NAPI and then All networking drivers not using NAPI have this problem. Someone tested a non-NAPI USB Ethernet adapter and saw OoO TCP packages in wireshark. TCP tries to fix this, but IIRC this resulted in retransmissions and then duplicate TCP packets. At least this was not beneficial for TCP performance. Don't know what this does to a realtime UDP audio stream 😢. Some newer USB-Ethernet drivers like the |
The driver used to pass received CAN frames/skbs to the network stack with netif_rx(). In netif_rx() the skbs are queued to the local CPU. If IRQs are handled in round robin, OoO packets may occur. To avoid out-of-order reception convert the driver from netif_rx() to NAPI. For USB devices with timestamping support use the rx-offload helper can_rx_offload_queue_timestamp() for the RX, and can_rx_offload_get_echo_skb_queue_timestamp() for the TX path. Devices without timestamping support use can_rx_offload_queue_tail() for RX, and can_rx_offload_get_echo_skb_queue_tail() for the TX path. Link: https://lore.kernel.org/all/[email protected] Link: candle-usb/candleLight_fw#166 Link: https://lore.kernel.org/all/[email protected] Signed-off-by: Marc Kleine-Budde <[email protected]>
Hi all,
First of all, this is a great project. We bought two candlelight usb-can sticks from linux automation as we might plan to use this interface on our products.
In our tests we now have a phenomenon that we cannot explain. We use the cansequence tool to create load on the canbus. With a baudrate of 1MBit and a load between 60% and 95%, we notice again and again that telegrams are received in the wrong order. Another non-candlelight-based cancontroller receives the telegrams in the correct order at the same moment, so I assume that the CAN telegrams are in the correct order on the bus. It looks like this:
Telegrams are not lost but in the wrong order.
We are using a raspberry cm4 based system (cm4 io board).
Has anyone ever seen something similar or have an idea what's going wrong ?
Thanks in advance !
The text was updated successfully, but these errors were encountered: