40pin对外接口用作CAN1_TX_M1功能时,配置为1MHz时,只能配置到990kHz这种非标频点,原因是什么;
[Proxy-ON] armsom@armsom-desktop:~/foc_tuner$ sudo ip link set can0 down
[sudo] password for armsom:
[Proxy-ON] armsom@armsom-desktop:~/foc_tuner$ sudo ip link set can0 type can bitrate 1000000
[Proxy-ON] armsom@armsom-desktop:~/foc_tuner$ sudo ip link set can0 up
[Proxy-ON] armsom@armsom-desktop:~/foc_tuner$ ip -details link show can0
4: can0: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000
link/can promiscuity 0 minmtu 0 maxmtu 0
can state ERROR-ACTIVE (berr-counter tx 0 rx 0) restart-ms 1
bitrate 990000 sample-point 0.740
tq 20 prop-seg 18 phase-seg1 18 phase-seg2 13 sjw 1
rockchip_canfd: tseg1 1…128 tseg2 1…128 sjw 1…128 brp 1…256 brp-inc 2
clock 99000000 numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535
[Proxy-ON] armsom@armsom-desktop:~/foc_tuner$
The clock source frequency of the CAN controller does not match the preset baud rate, resulting in the inability to obtain an integer through frequency division calculation。
The device tree needs to be added or modified
&can1 {
status = “okay”;
compatible = “rockchip,can-1.0”;
assigned-clocks = <&cru CLK_CAN1>;
+assigned-clock-rates = <300000000>; // 将这里改为300MHz
pinctrl-names = “default”;
pinctrl-0 = <&can1m0_pins>;
};