Thread (5 messages) 5 messages, 2 authors, 2017-10-05

Re: MCP2517FD Bus-Off recovery

From: Wolfgang Grandegger <hidden>
Date: 2017-10-04 17:31:45

Hello Marcel,

Am 04.10.2017 um 18:32 schrieb Marcel.Birthelmer@microchip.com:
Hi all,
I'm working on a driver for the new MCP2517FD CAN controller (http://www.microchip.com/wwwproducts/en/MCP2517FD). This is a substantially different device from the MCP2515 so it's a separate driver.
Great!
My question pertains to error recovery. This device automatically recovers from Bus-Off to Error-Active after some internal delay (see fig.11-1 of the Family Reference Manual). The ISR detects this state change, but I'm not sure how to handle it in regards to can_restart. Should I just update call netif_carrier_on and netif_wake_queue from the ISR to put the device back into normal mode?
Have a look to the "at91_can" driver. If "restart_ms" is "0", the
automatic recovery will be used. If not, the controller will be stopped:

http://elixir.free-electrons.com/linux/latest/source/drivers/net/can/at91_can.c#L962

In case of automatic recovery, the CAN controller usually signals
back to error passive -> warning -> active. When it's back to error
passive, netif_wake_queue etc. should be called:

http://elixir.free-electrons.com/linux/latest/source/drivers/net/can/at91_can.c#L922

Can automatic recovery be switched off?
Also, should the CAN state really be set to CAN_STATE_BUS_OFF while the device is in bus-off mode, since it will recover automatically and there's no explicit "restart" action?
Yes, the bus-off and restart (back to error active) should be visible
in user-space.

Wolfgang.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help