msperl / linux-rpi

Other
22 stars 26 forks source link

mcp25xxfd: Errors during multiple ip link ups/downs #12

Open engnfrc opened 5 years ago

engnfrc commented 5 years ago

Hello,

I've started using the driver that you've written for the MCP25xxFD family and am having good luck with it so far. I edited the driver in a manner such that I can set the controller to Loopback and Listen-Only modes too. Right now I'm working on achieving auto-baud functionality at the application layer, I switch to Listen-Only mode and then every 5 seconds I switch to a new bitrate until I start receiving messages. The issue I'm running into is that if I allow this to run for too long then I get into a state that I can only recover from by restarting the RPi.

When I get into this unrecoverable state I have this message printed out from ip link: RTNETLINK answers: Connection timed out

and if I check in dmesg I see an error like this: Oct 2 13:05:24 rpi kernel: [65525.636197] mcp25xxfd spi0.0: Failed to switch to mode 2 in time Oct 2 13:05:24 rpi kernel: [65525.636442] A link change request failed with some changes committed already. Interface can0 may have been left with an inconsistent configuration, please check. Oct 2 13:05:25 rpi kernel: [65526.218801] mcp25xxfd spi0.1: Failed to switch to mode 2 in time Oct 2 13:05:25 rpi kernel: [65526.218963] A link change request failed with some changes committed already. Interface can1 may have been left with an inconsistent configuration, please check.

Do you have any ideas on how to overcome this issue?

Is this a driver level issue? If so, how can I safely reload the driver without doing a restart? I tried the dtoverlay command, but that gives: sudo dtoverlay -r mcp2518fd-click-can0 * Overlay 'mcp2518fd-click-can0' is not loaded sudo dtoverlay mcp2518fd-click-can0 oscillator=40000000 spimaxfrequency=20000000 interrupt=6 * Failed to apply overlay '0_mcp2518fd-click-can0' (kernel)

Or is it a controller level issue? Would resetting the controller fix things? If so, what can I do to send the controller reset command from a higher-level application?

Thanks!

engnfrc commented 4 years ago

Just checking back in, is there anyone available to help me out with this question?

engnfrc commented 4 years ago

Also, any idea what could cause this error? I do not believe it's an SPI issue, as slowing down the clock frequency had not effect and over half the time the device performs just fine.

[263792.757403] mcp25xxfd spi1.0 can2: tefif: fifo 0 not pending - tef data: id: 00000000 flags: 00000000, ts: 00000000 - this may be a problem with spi signal quality- try reducing spi-clock speed if this can get reproduced

engnfrc commented 4 years ago

Using driver fixes from Issue #7 and #8, the error mentioned on Oct 21 appears to be remedied.