Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.0k views
in Technique[技术] by (71.8m points)

raspberry pi3 - Linux MCP2551 CAN Bus: Stop working after one frame

I got a problem for days now, my Can Bus stop working after sending the first message.

I use as a client the IOT-Gate-RPI which have the raspberry pi 3 compute module and a integrated hat with the MCP2551 chip for can Bus. On the other side of the line, as a monitor, I use the IXXAT software CANAnalyzer 3 Mini running on W10.

Here is my settings on Linux: On /Boot/config.txt, I added:

dtparam=spi=on
dtoverlay=mcp2515-can0,oscillator=16000000,interrupt=25
dtoverlay=spi0-hw-cs #(For Kernel > 4.4.x)

I also made sure it will be mounted on boot with:

auto can0
iface can0 inet manual
    pre-up /sbin/ip link set can0 type can bitrate 125000 triple-sampling on restart-ms 100
    up /sbin/ifconfig can0 up
    down /sbin/ifconfig can0 down

Then, with can-utils:

$sudo ip link set can0 up
$cansend can0 111#1122334455667788 #Random message

And so far, so good, the message appears on the monitor on the other side. But then, if I send it again, nothing appears, I have to set the can0 down and then up to be able to send a new message.

[EDIT 2021-02-10] As asked by @Lundin, I used an oscillo to check the signals shapes. So just to explain the new set-up, the datas are continuously send by a BMS ( Battery Management System) connected on the CAN Bus. On the first picture, there's just this BMS and an IXXAT CAN to USB dongle. The signal is pretty neat and all the datas arrive safely. On the second picture, I just plug the MCP2515 hat of my IOT-Gate-RPI and the signal get messy straight. And I can only send one frame as described above.

Picture_1

Picture_2

Also the pinout given by Compulab on the IOT-Gate-RPI is the one on the third pic. Which pinout will you give according to picture 4 ?

1 = ? 2 = ? 3 = ? 4 = ? 5 = ? 6 = ?

Picture_3

Picture_4

Thank a lot for your help.

Best regards

question from:https://stackoverflow.com/questions/66065475/linux-mcp2551-can-bus-stop-working-after-one-frame

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

So I just got a reply from Compulab support, there was a problem in the interrupt pin declared, it's 13 instead of 25.

On /Boot/config.txt:

dtparam=spi=on
dtoverlay=mcp2515-can0,oscillator=16000000,interrupt=13
dtoverlay=spi0-hw-cs #(For Kernel > 4.4.x)

Thanks everyone for your help, I learn a lot !


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...