CAN interface stops working in between communication.

cancel
Showing results for 
Search instead for 
Did you mean: 

CAN interface stops working in between communication.

984 Views
surendradhobale
Contributor III

Hello,

        We have interfaced the external CAN Controller MCP2515 over SPI with NXP T1042 controller in linux enviornment. The transimission and reception of the message frames works correctly. But currently facing one strange issue.

When transmission/reception of the messages going on, in between the CAN interface going down and unable to receive the messages. The interface become hang. After that if interface is down and up, again the message transmission reception works correctly and after sometime again same behaviour.

Same behaviour with connected two CAN interface. ( on our board two can interface available ).

when seen the /proc/interrupt the count is not increasing of the interrupts and also not seen the errors in the can statistics.

We are using kernel 4.1.

Anyone help us on this issue ?

Regards,

Surendra

Labels (1)
0 Kudos
3 Replies

490 Views
Pavel
NXP TechSupport
NXP TechSupport

Look at the Section 22.4.15 of the MPC5125 Reference Manual. Check bus-off state of the MPC5125. See also the Table 22-8.


Have a great day,
Pavel Chubakov

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

490 Views
surendradhobale
Contributor III

Hello Pavel Chubakov,

   Thanks for your reply. We have checked, CAN controller is not in BUS_OFF State or any error condition, still observed this behavior.

In our design we have connected two CAN controller  [ T1042 <=====via SPI=========> MCP2515 ] and IRQ2  and IRQ3 pin of the T1042  used to receive the interrupts.

our dts file:

soc: soc@ffe000000 {
                spi@110000 {

                can1:   can1@1 {
                                compatible = "microchip,mcp2515";
                                spi-max-frequency = <10000000>; /* input clock */
                                reg = <1>;
                                clocks = <&clk24m>;
                                interrupts = <3 0x2 0 0>;
                        };

                can0:   can0@0 {
                                compatible = "microchip,mcp2515";
                                spi-max-frequency = <10000000>; /* input clock */
                                reg = <0>;
                                clocks = <&clk24m>;
                                interrupts = <2 0x2 0 0>;
                        };

Driver probing working fine. Functional mechanism working fine. But after some time oberving the issue.i.e really strange.

In current debugging of the driver, saw the interrupt received continuasly and isr routine executing. But in the error case, stops receiving the interrupts. in /proc/interrupt interrupt counter stops.

# cat /proc/interrrupts

 19:          2          1          2      21722   OpenPIC     2 Edge      mcp251x

when saw the interrupt pin(INT) on the oscilloscope,not seen  any activity on the INT pin.

:~ # ls -al /sys/class/net/can*
lrwxrwxrwx    1 root     root             0 Jul 27 16:00 /sys/class/net/can0 -> ../../devices/platform/ffe000000.soc/ffe110000.spi/spi_master/spi32766/spi32766.1/net/can0
lrwxrwxrwx    1 root     root             0 Jul 27 16:00 /sys/class/net/can1 -> ../../devices/platform/ffe000000.soc/ffe110000.spi/spi_master/spi32766/spi32766.0/net/ca

In the driver/net/can/spi/mcp251x.c, only for the debug purpose, added following lines, really interrupt coming or not.

static irqreturn_t mcp251x_can_ist(int irq, void *dev_id)
{
        struct mcp251x_priv *priv = dev_id;
        struct spi_device *spi = priv->spi;
        struct net_device *net = priv->net;
        u8 intf, eflag;

#ifdef CAN_DEBUG
                printk("*");

                mutex_lock(&priv->mcp_lock);
                mcp251x_read_2regs(spi, CANINTF, &intf, &eflag);
                printk("[%x] [%x] \n", intf, eflag);

                mcp251x_write_bits(spi, CANINTF, CANINTF_RX0IF, 0x00);
                mcp251x_write_bits(spi, CANINTF, CANINTF_RX1IF, 0x00);
                mcp251x_write_bits(spi, CANINTF, CANINTF_ERR, 0x00);

                mutex_unlock(&priv->mcp_lock);
                 return IRQ_HANDLED;
#endif

Here, as ouput after sometime , ISR not execute, i.e interrupt not receive.

Now why this interrupt is not generated by the MCP2515? Any clue  or Can you guide in which area , we need to check?

Thanks for your support.

Regards,

Surendra

0 Kudos

490 Views
surendradhobale
Contributor III

This issue is resolved.

As a solution for this problem I use "IRQF_TRIGGERED_LOW | IRQF_ONESHOT"
for IRQ registration and it works fine.

0 Kudos