简体   繁体   English

imx上的Linux 2.6:无法使用candump记录发送的CAN帧

[英]Linux 2.6 on imx: Can't log sent CAN frames using candump

I have a custom build linux 2.6 running on a imx CPU. 我有一个在imx CPU上运行的自定义版本linux 2.6。 CAN communication with external nodes works like a charm, but the frames that I send to the nodes from my app is not printed when using "candump can0" in the terminal (when I run the same app on my host using a usb-CAN dongle this problem does not occur). 与外部节点的CAN通信就像一个咒语,但是当我在终端中使用“ candump can0”时(当我使用usb-CAN加密狗在主机上运行相同的应用程序时,我从我的应用程序发送到节点的帧不会被打印)不会发生此问题)。

When extended CAN frames are sent they show up using candump. 发送扩展的CAN帧时,它们会使用candump显示。

I understand that it might be convenient that messages that is sent is filtered, but I should be possible to choose. 我知道过滤发送的邮件可能很方便,但是我应该可以选择。

Any clues are welcome. 任何线索都欢迎。 I'm thinking that it might be some filtering in the driver that causes this. 我认为可能是驱动程序中的某些过滤导致了此问题。

The FLexCAN driver has the following config files: FLexCAN驱动程序具有以下配置文件:

abort br_propseg dump_rx_mb loopback state wakeup bcc br_pseg1 dump_xmit_mb maxmb std_msg xmit_maxmb bitrate br_pseg2 中止br_propseg dump_rx_mb环回状态唤醒bcc br_pseg1 dump_xmit_mb maxmb std_msg xmit_maxmb比特率br_pseg2
ext_msg modals subsystem boff_rec br_rjw fifo power tsyn br_clksrc driver listen smp uevent br_presdiv ext_msg模态子系统boff_rec br_rjw fifo power tsyn br_clksrc驱动程序监听smp uevent br_presdiv
dump_reg local_priority srx_dis wak_src dump_reg local_priority srx_dis wak_src

The can-utils package requires SocketCAN, which was integrated into the stock kernel 2.6.30. can-utils软件包需要SocketCAN,它已集成到常规内核2.6.30中。

If you are using SocketCAN, you should be able to turn on loopback to receive messages that are being transmitted from your interface (and they must actually be transmitted on the wires to be received via loopback). 如果你正在使用SocketCAN,你应该能够开启环回至接收正在从接口发送的消息(他们必须确实在电线传送到通过回送接收)。

From bash: 从bash:

ifconfig can0 down
ip link set can0 type can loopback on
ifconfig can0 up
candump can0|grep C0FFEE

and in another terminal: 在另一个终端:

cansend can0 00C0FFEE#00112233445566

Alright, I have been at this issue many times but given up. 好吧,我曾多次在这个问题上,但是放弃了。 But know I stumbled on the solution: 但是知道我偶然发现了解决方案:

The setting file called srx_dis in the FlexCAN folder controls this behaviour. FlexCAN文件夹中名为srx_dis的设置文件可控制此行为。 So, if you want to be able to read the CAN frames you send on the imx53_loco, do the following: 因此,如果您希望能够读取在imx53_loco上发送的CAN帧,请执行以下操作:

ifconfig can0 down
echo 0 > /sys/bus/platform/devices/FlexCAN.0/srx_dis
ifconfig can0 up

The reason I want to do this is for creating a service tool on the same device which can log all CAN frames. 我要这样做的原因是在同一设备上创建可以记录所有CAN帧的服务工具。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM