S32G CAN网关测试

  • canutils 使用

    ./cansend can0 -e 0x11 0x22 0x33 0x44 0x55 0x66 0x77 0x88
    

    发送默认ID为0x1的can标准帧,数据为0x11 22 33 44 55 66 77 88, 每次最大8个byte

    ./cansend can0 -i 0x800 0x11 0x22 0x33 0x44 0x55 0x66 0x77 0x88 -e
    

    -e 表示扩展帧,CAN_ID最大29bit,标准帧CAN_ID最大11bit
    -i表示CAN_ID

  • iproute2 使用

    ip link set llcecan0 type can restart-ms 100
    ip link set llcecan0 up type can bitrate 1000000
    ip link set llcecan0 up type can
    ip -details link show llcecan0
    
    ip link set llcecan1 type can restart-ms 100
    ip link set llcecan1 up type can bitrate 1000000
    ip link set llcecan1 up type can
    ip -details link show llcecan1
    candump llcecan1 &
    cansend llcecan0 123#11223344556677
    
  • CAN 网关测试

    root@s32g274ardb2:~# ip --detail link show can0
    2: can0: <NOARP,UP,LOWER_UP,ECHO> mtu 72 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000
        link/can  promiscuity 0 minmtu 0 maxmtu 0
        can <FD> state ERROR-ACTIVE (berr-counter tx 6 rx 0) restart-ms 0
              bitrate 1000000 sample-point 0.750
              tq 12 prop-seg 29 phase-seg1 30 phase-seg2 20 sjw 1
              flexcan: tseg1 2..96 tseg2 2..32 sjw 1..32 brp 1..1024 brp-inc 1
              dbitrate 4000000 dsample-point 0.800
              dtq 12 dprop-seg 7 dphase-seg1 8 dphase-seg2 4 dsjw 1
              flexcan: dtseg1 2..39 dtseg2 2..8 dsjw 1..8 dbrp 1..1024 dbrp-inc 1
              clock 80000000 numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535
    root@s32g274ardb2:~# cansend can0 123#1122334455667788
    root@s32g274ardb2:~# candump can0
      can0  001   [8]  00 00 00 00 00 00 00 00
      can0  002   [8]  01 00 00 00 00 00 00 00
      can0  003   [8]  02 00 00 00 00 00 00 00
      can0  004   [8]  03 00 00 00 00 00 00 00
      can0  005   [8]  04 00 00 00 00 00 00 00
    

    在这里插入图片描述

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值