On 22.12.2022 07:44:59, Stefan Althöfer wrote: > I'm using the MCP2518FD CAN controller with Rasperry PI 4 and are > suffering from wrong data reception. > > My hardware is a Model 4 B with MCP2581 Click board(s) attached with a > prototype (hand-made) interface PCB, as well as baseboards for a CM4 > with a single MCP2518 on it. The error occurs on both of them. Do you get the same error if the test is only running on a single mcp2518fd? Do you get the same error if only a single mcp2518fd is attached to the raspi? > I have reduced my test case to a simple single thread self-receipt test: > * TX two messages > * Wait for RX and send out a new message on every receipt > * TX for messages in total Can you share the config/scripts/... to set up the interfaces? Can you share the test code? > Refer to the attached PDF for some error cases. The text in the PDF is rendered down to paths only. So not select- nor searchable, please send plain text files for further logs. > Last send frames are at the top of the logs. You can see that wrong > messages appear in the RX queue, which have been successfully > transmitted in previous test loop. The data that is actually sent out > is correct however (checked with an external logger for some cases). Looking at the first page, there are 2 identical lines marked in red. The next page show 4 red lines. So under certain load situations you see that old messages are received twice. If I remember correctly I heard something similar from someone else before. It occurred with a modified driver. For various reasons that has never debugged. I think I've fixed the root cause of the problem during the v5.18 development cycle. > The error appeared very often (every 1..10 minutes) when I was using > kernel raspberrypi 5.15.32-v7l+ and reduced to once in several hours > when I switched to raspberrypi 6.0.12-v7l+. BTW I modified the > loopback to external loopback To check for correct transmission. No > other changes to the driver as taken from the Raspbian repository. Can you share your kernel, including the modifications? > I see infrequent mcp251xfd CRC read errors. I think those are due to > the 2518 SPI errata. However they don't occur at the time when the > wrong messages are received (refer to the PDF). > > Questions: > - Is this a known problem? No - it should not happen on any mainline kernel. > - What did change from 5.15.32 to 6.0.12 to reduce the error rate? > Maybe this is just because of a change in execution timing? Quite a lot: Next to probably unrelated changes (e.g. PLL support), the workarounds for CRC errors were updated, in v5.18 multiple RX FIFOs are used and IRQ coalescing support has been added. > - Any suggestion how I can step further in fixing this issue. regards, Marc -- Pengutronix e.K. | Marc Kleine-Budde | Embedded Linux | https://www.pengutronix.de | Vertretung West/Dortmund | Phone: +49-231-2826-924 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |