Skip to content
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

mcp251x Error during multiple ip link ups/downs #5976

Open
matihuf opened this issue Feb 21, 2024 · 1 comment
Open

mcp251x Error during multiple ip link ups/downs #5976

matihuf opened this issue Feb 21, 2024 · 1 comment

Comments

@matihuf
Copy link

matihuf commented Feb 21, 2024

Describe the bug

Hello,

I work with the CAN bus (simple write and reads works fine) I wanted to prepare automatic detection of the baud rate. The problem occurs when we changing interface settings in a loop. After a few tries, "RTNETLINK Replies: Connection Timeout" appears and the Raspberry Pi hangs.

I founded similar problem at fork but for mcp25xxfd driver msperl#12

Steps to reproduce the behaviour

Connect to a CAN bus device that sends data and run script at Raspberry Pi. I added sleeps to check if this could help

#!/bin/bash
array=(10000 20000 50000 100000 125000 250000 500000 800000 1000000)
can=$1
while true
do
    for i in "${array[@]}"
    do
        echo $i
        sleep 1
        sudo ip link set $can down
        sleep 1
        sudo ip link set $can up type can bitrate $i
        sleep 1
        candump $can -T 100
    done
done

Device (s)

Raspberry Pi CM4 Lite

System

Raspberry Pi reference 2023-10-10
Generated using pi-gen, https://github.com/RPi-Distro/pi-gen, 962bf483c8f326405794827cce8c0313fd5880a8, stage2

Aug 10 2023 15:33:38
Copyright (c) 2012 Broadcom
version 03dc77429335caee083e22ddc8eec09c07f12a7a (clean) (release) (start)

Linux raspberrypi 6.1.0-rpi4-rpi-v8 #1 SMP PREEMPT Debian 1:6.1.54-1+rpt2 (2023-10-05) aarch64 GNU/Linux

Logs

Feb 21 14:40:10 raspberrypi kernel: mcp251x spi0.0: MCP251x didn't enter in config mode
Feb 21 14:40:10 raspberrypi kernel: A link change request failed with some changes committed already. Interface can1 may have been left with an inconsistent configuration, please check.

Additional context

No response

@matihuf matihuf changed the title mcp251x: Error during multiple ip link ups/downs mcp251x Error during multiple ip link ups/downs Feb 22, 2024
@Mike-M0
Copy link

Mike-M0 commented Nov 6, 2024

I am facing exactly the same issue, with a Pi spi mcp2515. But only, when it previously was configured on 125k bitrate and any CAN communication is still active.
The first "ip link set up..." ends with a RTNETLINK error, a second "set up" command freezes the Pi.
When disabling the CAN companion after the first failed "set up", the second works and the Pi continues running.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants