Description
Initializing:
#!/bin/bash
sudo ip link set down can0
sudo modprobe can
sudo modprobe can_raw
sudo modprobe mttcan
sudo ip link set can0 type can bitrate 1000000 dbitrate 5000000 berr-reporting on fd on
sudo ip link set up can0
ip -details link show can0
Output:
85: can0: <NOARP,UP,LOWER_UP,ECHO> mtu 72 qdisc pfifo_fast state UP mode DEFAULT group default qlen 10
link/can promiscuity 0 minmtu 0 maxmtu 0
can <BERR-REPORTING,FD> state ERROR-ACTIVE (berr-counter tx 0 rx 0) restart-ms 0
bitrate 1000000 sample-point 0.740
tq 20 prop-seg 18 phase-seg1 18 phase-seg2 13 sjw 1
mttcan: tseg1 2..255 tseg2 0..127 sjw 1..127 brp 1..511 brp-inc 1
dbitrate 5000000 dsample-point 0.700
dtq 20 dprop-seg 3 dphase-seg1 3 dphase-seg2 3 dsjw 1
mttcan: dtseg1 1..31 dtseg2 0..15 dsjw 1..15 dbrp 1..15 dbrp-inc 1
clock 50000000 numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 6553
After selecting nominal baudrate as 1M and data baudrate as 5M, and it also outputs the right baudrate by ip -details link show can0
. The data section is still outputing at 1M. Below is a figure probing from a logic analyzer whe orin tries to send 007#FFFFFFFFFFFFFFFC.
A FDCAN with 5M baudrate data frame looks like below when probing from a logic analyzer:
As shown, “DB” which is the data, is 5 times shorter than the previous one.
Change TDRC (idk if it’s relevant)
I also found a section in CAN guide here about changing “TDRC”. But upon checking, I do not have this file, as shwon below:
/sys/bus/platform/devices/c310000.mttcan/net/can0$ ls
addr_assign_type broadcast carrier_down_count device dormant gfc_filter ifindex mtu netdev_group phys_port_name proto_down statistics tdc_offset ttmlm tttmc tx_queue_len xidam
address carrier carrier_up_count dev_id duplex gro_flush_timeout iflink name_assign_type operstate phys_switch_id queues std_filter testing ttocf txbar type xtd_filter
addr_len carrier_changes cccr_init_txbar dev_port flags ifalias link_mode napi_defer_hard_irqs phys_port_id power speed subsystem trigger_mem ttrmc tx_cancel uevent
Any help would be greatly appreciated