21ic问答首页 - 调试spi转can芯片MCP2518,linux驱动下无法发送CAN消息
调试spi转can芯片MCP2518,linux驱动下无法发送CAN消息
venus57122024-11-07
本帖最后由 venus5712 于 2024-11-8 11:52 编辑
内核版本5.10.0,SOC芯片Hi3519DV500,系统spi3.1挂载一个mcp2518fd芯片(linux-5.10\drivers\net\can\spi\mcp251xfd)编译模块通过后,系统里加载ko文件
配置can 2.0 模式
ip link set can0 down
ip link set can0 up type can bitrate 500000 sample-point 0.80
ip link set can0 up
~ # insmod mcp251xfd.ko
spi_master spi3: will run message pump with realtime priority
mcp251xfd spi3.1: setup mode 3, 8 bits/w, 15000000 Hz max --> 0
mcp251xfd spi3.1: can_rx_offload_init_queue: skb_queue_len_max=512
mcp251xfd spi3.1 can0: MCP2518FD rev0.0 (+RX_INT -MAB_NO_WARN +CRC_REG +CRC_RX +CRC_TX +ECC -HD c:40.00MHz m:15.00MHz r:15.00MHz e:0.00MHz) successfully initialized.
mcp251xfd spi3.1 can0: FIFO setup: TEF: 8*12 bytes = 96 bytes, TX: 8*16 bytes = 128 bytes
mcp251xfd spi3.1 can0: FIFO setup: RX-0: 32*20 bytes = 640 bytes
mcp251xfd spi3.1 can0: FIFO setup: free: 1184 bytes
接收测试:
~ # ./candump can0 &
~ # can0 001 [8] 00 11 22 33 44 55 66 77
can0 001 [8] 01 11 22 33 44 55 66 77
但是cansend无消息发出,spi配置逻辑分析仪抓取信号如下,CANTX没有信号:
模块配置使用驱动默认配置,没有其他修改。
内核版本5.10.0,SOC芯片Hi3519DV500,系统spi3.1挂载一个mcp2518fd芯片(linux-5.10\drivers\net\can\spi\mcp251xfd)编译模块通过后,系统里加载ko文件
配置can 2.0 模式
ip link set can0 down
ip link set can0 up type can bitrate 500000 sample-point 0.80
ip link set can0 up
~ # insmod mcp251xfd.ko
spi_master spi3: will run message pump with realtime priority
mcp251xfd spi3.1: setup mode 3, 8 bits/w, 15000000 Hz max --> 0
mcp251xfd spi3.1: can_rx_offload_init_queue: skb_queue_len_max=512
mcp251xfd spi3.1 can0: MCP2518FD rev0.0 (+RX_INT -MAB_NO_WARN +CRC_REG +CRC_RX +CRC_TX +ECC -HD c:40.00MHz m:15.00MHz r:15.00MHz e:0.00MHz) successfully initialized.
mcp251xfd spi3.1 can0: FIFO setup: TEF: 8*12 bytes = 96 bytes, TX: 8*16 bytes = 128 bytes
mcp251xfd spi3.1 can0: FIFO setup: RX-0: 32*20 bytes = 640 bytes
mcp251xfd spi3.1 can0: FIFO setup: free: 1184 bytes
接收测试:
~ # ./candump can0 &
~ # can0 001 [8] 00 11 22 33 44 55 66 77
can0 001 [8] 01 11 22 33 44 55 66 77
但是cansend无消息发出,spi配置逻辑分析仪抓取信号如下,CANTX没有信号:
模块配置使用驱动默认配置,没有其他修改。
赞0
评论
2024-11-14
您需要登录后才可以回复 登录 | 注册