-
Notifications
You must be signed in to change notification settings - Fork 5k
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
mcp251xfd spi0.0 can0: Transmit Event FIFO buffer not empty 2-CH CAN FD HAT Rev2.1 #5083
Comments
How often do you see this event?
The driver throws this message if the chip does't behave as the driver expects. It's unclear if this is a bug in the driver or in the chip. It doesn't happen that often (during my testing), the driver recovers and I haven't had time to debug this issue. Can you describe you use case, maybe hit sheds time light to the problem? You can make the driver silent by changing the
|
I have problems as soon I connect two slaves (CANopen devices not supporting FD) to my network with node id 1 and 2. |
The bcm2835 library is not needed by the kernel driver for the mcp251xfd. How often do you get event the
What does exactly happen when the init fails? Is there a timeout? Goes the bus into bus off? Can you send me the output of
Do you know if CODESYS uses the regular |
The first thing I did was to simplify my CODESYS application so only SDO initialization takes place, and only PDO rx/tx is possible after the initialization. All code removed. Jul 6 13:29:13 cilix-19 kernel: [ 465.249474] Disabling IRQ #82 From here on it goes fast and the flash is filled up. It seems When I do a warm reset in CODESYS (it clears all variables and stops the application) I get Is that acceptable? You requested the result of "candump -l any,0~0,#FFFFFFFF" here it is: I still think that a special crafted network creates the fault, and I do not exclude my Nanotec motor driver to be faulty. |
[...]
Yes, that's at least the first message from the driver itself. But the message directly before this is more important:
From
...the interrupt line between the MCP2518FD chip and the raspi. That's not good.
No, see above.
Ok, there are some error messages from the controller, but I forgot to give you the command line to let candump decode the error message, sorry. Try this one instead:
There are some CRC write errors in the log:
That means the SPI message form the raspi to the mcp2518fd got corrupted somehow. Is it possible that your motor driver creates EMI and destroys the SPI message? Are you using a shared power supply for the raspi and the motors? Marc |
My system is very simple given in my first post. I have only one HAT the CAN bus controller and I am only using can0 Something must have corrupted the CANbus driver, I see the following options.
candump any,0~0,#FFFFFFFF -exdtA |
Can you try to disable the CODESYS altogether and/or flash a new µSD card with a fresh system.
From this log we see that the SPI controller doesn't read anything from the mcp2518fd controller, as the data and crc is |
pi@cilix-19:~ $ uname -a pi@cilix-19:~ $ cat /etc/rpi-issue pi@cilix-19:~ $ vcgencmd version I did apt-get upgarde and sudo apt-get --with-new-pkgs upgrade and apt-get install can-utils Jul 7 12:29:49 cilix-19 systemd[1]: Starting Permit User Sessions... Clearly my HAT is faulty especially for can1. That is very impressive since I never have used can1, nothing has been connected to it. I have no application using can1. Am I wrong or do you see something? I had another device (always buy 2 when you need one) and from dmesg: So it seems that the last is working but not the first. However I have one more test to do, because I am not fully convinced. |
I waited a while then I changed controller back to the first and now that one is also working as seen from dmesg [ 6.714808] CAN device driver interface What we have is this:
Can you explain that? |
Do you use the same SD card? First let's get the both CAN interfaces detected properly, then do some tests between To test between
and on another terminal:
That should run without problems. Use Another test would be:
On another terminal (Edit: fixed interface name):
The |
I created as described a new image on a new SD card. pi@cilix-19:~ $ pi@cilix-19:~ $ cangen can0 -Di -L1 -I2 -p10 -g 1 I get without errors not on the receiving interface either |
...or the
Doh! Right, I've fixed that.
Fine -
You should not get any CRC error messages from the driver in the kernel log. Maybe when you connect the CAN bus....
Ok - On my desk I've a setup that doesn't like when I plug one of my CAN-USB adapters to the USB port, results in CRC errors in the SPI communication. Anyhow - If the driver in your setup goes reproducible into the |
I switch my motor driver on/off several times and my network doesn't seem to create any errors. I do not get "Transmit Event ..." |
I know we are using bcm2835 so I am concerned with these warnings seen with dmesg but I do not know all these modules are they in anyway related to CAN ? [ 4.663823] snd_bcm2835: module is from the staging directory, the quality is unknown, you have been warned. |
All unrelated to CAN. Should be no problem. |
I have now installed my very simple application no code, no GUI [ 18.650204] can: controller area network core I have no CANOpen SYNC enabled The Pi which is master has real problem receiving a BOOTUP message from the slaves but eventually candump any,0~0,#FFFFFFFF -exdtA However after long time trying to boot node 1 I get (I didn't have any candump running unfortunately) And so on. However my controller didn't seem to be faulty. I stopped codesys deleted the logs and I can still start a can1 network. |
Does this happen during boot?
Can you try this config.txt? |
Yes, but remember I now have CODESYS installed and my application which sets up the can0 automatically at boot. I do not know if that has an impact on what dmesg shows. Interesting config.file I will try that tomorrow |
My controller is still working testing it with cangen. It works right out of the box. But it is not Bullseye. What do you think? Is mcp2515 more tolerant/robust than mcp251xfd? |
Please post your complete
Please post the error message.
No
No |
Here it is I renamed the file so we don't get confused with the mcp251xfd. |
Okay - now try my config.txt from #5083 (comment) |
I want to point out that the carrier board has good lightning-proof, and ESD protection. I think better than the HAT CAN FD controller and I am still concerned about a faulty signals from the motor driver. In syslog I have: Jul 8 11:17:36 cilix-19 kernel: [ 663.705295] mcp251xfd spi0.0 can0: CRC write command format error. and so on |
Which |
Your suggested config.txt on Pi 4 |
Ok. Next try: Please change use this in the
Please send your boot log, including the
line. Do you have a scope? Can you measure the frequency of the |
I have not tried out your last proposal (speed=10000000) because I discovered that your config.txt file didn't allow me enable a can1 network. I get |
I have now flashed my carrier board with Bullseye I have not CODESYS installed, so it is as simple as possible. It didn't work I got a lot of NNNNNNN... For the time being the 2-CH CAN FD HAT Rev2.1 with the present driver cannot communicate with a device with MCP2515. |
FYI: See https://lore.kernel.org/all/[email protected]/ for a discussion on setting the |
Describe the bug
In my application the /var/log/syslog is filled up with:
mcp251xfd spi0.0 can0: Transmit Event FIFO buffer not empty
After a while the disk is full and the system can crash. Is there any way I can disable the logging from the CAN bus?
I have two slaves on my network to which it is difficult to establish a connection. With two other slaves it seems to work (But I didn't check the logs)
I have controlled the two slaves with Pican2 in the past but not with Bullseye
The physical network is 1.2m
Any suggestions @marckleinebudde https://github.com/marckleinebudde ?
Steps to reproduce the behaviour
Difficult to reproduce the exact same result every time.
But 2 slaves Nanotec motor drivers with node id 1 and 2 [CL4-E-2-12-5VDI]
An application that initializes these with an SDO
The configuration of the HAT is seen under the system description.
Device (s)
Raspberry Pi 4 Mod. B
System
2-CH CAN FD HAT Rev2.1
ip -d link show dev can0
4: can0: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state UP mode DEFAULT group default qlen 10
link/can promiscuity 0 minmtu 0 maxmtu 0
can state ERROR-ACTIVE (berr-counter tx 0 rx 0) restart-ms 0
bitrate 250000 sample-point 0.875
tq 25 prop-seg 69 phase-seg1 70 phase-seg2 20 sjw 1
mcp251xfd: tseg1 2..256 tseg2 1..128 sjw 1..128 brp 1..256 brp-inc 1
mcp251xfd: dtseg1 1..32 dtseg2 1..16 dsjw 1..16 dbrp 1..256 dbrp-inc 1
clock 40000000 numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535
uname -a
Linux cilix-19 5.15.32-v7l+1538 SMP Thu Mar 31 19:39:41 BST 2022 armv7l GNU/Linux
On a Raspberry Pi4
pi@cilix-19:~ $ cat /etc/rpi-issue
Raspberry Pi reference 2022-04-04
Generated using pi-gen, https://github.com/RPi-Distro/pi-gen, 226b479f8d32919c9fe36dd5b4c20c02682f8180, stage2
pi@cilix-19:~ $ vcgencmd version
Mar 24 2022 13:19:26
Copyright (c) 2012 Broadcom
version e5a963efa66a1974127860b42e913d2374139ff5 (clean) (release) (start)
Logs
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: