在 Ubuntu 的 Raspberry Pi 4 B 上使用 MCP2515 进行 CAN 屏蔽 [英] CAN-shield with MCP2515 on Raspberry Pi 4 B with Ubuntu

查看:43
本文介绍了在 Ubuntu 的 Raspberry Pi 4 B 上使用 MCP2515 进行 CAN 屏蔽的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用连接到 Raspberry Pi 4 Model B 的 MCP2515 控制器运行 CAN 屏蔽.它已经在 Raspbian 下运行,但因为我需要 ROS2,我现在想在 Ubuntu (20.04) 下运行它.在这里它不再起作用了.

I would like to run a CAN shield with MCP2515 controller connected to a Raspberry Pi 4 Model B. It already worked under Raspbian but because I need ROS2 I want to run it under Ubuntu (20.04) now. Here it does not work anymore.

我所做的是编辑 /boot/config.txt 并添加以下几行:

What I did was editing /boot/config.txt and adding the following lines:

dtparam=spi=on
dtoverlay=mcp2515-can0,oscillator=12000000,interrupt=25 
dtoverlay=spi-bcm2835

但是ifconfig可以给出

can: error fetching interface information: Device not found

问题似乎与这个:spi-bcm2835 模块未显示为 lsmod 的输出,并且 dmesg 具有以下条目:

The problem seems to be very similar to this one: The spi-bcm2835 module is not shown as output of lsmod and dmesg has this entry:

[    1.428843] spi-bcm2835 fe204000.spi: could not get clk: -517

这是 Ubuntu 在 Raspberry Pi 上的普遍问题吗?如果是这样,是否有解决此问题的方法?

Is this a general problem of Ubuntu on the Raspberry Pi? If so, is there a workaround for this issue?

推荐答案

对于 ubuntu,引导分区挂载在 /boot/firmware 下,包含 3 个文件:config.txt、syscfg.txt 和 usercfg.文本.usercfg.txt 包含在 config.txt 中,推荐用于承载用户自定义配置.因此,将您的行保存在 usercfg.txt 中应该可以使其正常工作

For ubuntu the boot partition is mounted under /boot/firmware with 3 files: config.txt, syscfg.txt, and usercfg.txt. The usercfg.txt is included by config.txt and is recommended to bearing user customized configuration. So saving your lines in usercfg.txt instead should make it works

usercfg.txt

ifconfig

can-utils 的 candump

这篇关于在 Ubuntu 的 Raspberry Pi 4 B 上使用 MCP2515 进行 CAN 屏蔽的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆