I recently tried to add canbus support to my boot2qt. So via my custom meta-layer, I have added canutils and libsocketcan without any problem.
Then within my distro, I added /etc/systemd/network/80-can.network to start canbus at startup
[Match] Name=can0 [CAN] BitRate=500000
Now when I boot my system, the result of dmesg | grep can is always like this
# dmesg | grep can [ 0.038658] dma_flexcan0 : no governor for states [ 0.038671] dma_flexcan1 : no governor for states [ 0.038684] dma_flexcan2 : no governor for states [ 5.031842] ahci-imx 5f020000.sata: can't get per_clk0 clock. [ 8.902208] flexcan 5a8d0000.can: 5a8d0000.can supply xceiver not found, using dummy regulator [ 8.919258] flexcan 5a8d0000.can: device registered (reg_base=ffff000019d70000, irq=63) [ 8.937963] flexcan 5a8e0000.can: 5a8e0000.can supply xceiver not found, using dummy regulator [ 8.962485] flexcan 5a8e0000.can: device registered (reg_base=ffff000019db0000, irq=64) [ 9.855369] IPv6: ADDRCONF(NETDEV_UP): can0: link is not ready [ 9.861456] IPv6: ADDRCONF(NETDEV_CHANGE): can0: link becomes ready
Which seems right.
But when I am running ifconfig or ip link, I don’t always have the same results
When it works, I have this result
# ifconfig can0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 UP RUNNING NOARP MTU:16 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:10 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B) Interrupt:63
# ip link 3: can0: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state UP mode DEFAULT group default qlen 10 link/can
But sometimes when booting my device, dmesg seems correct as always but ifconfig or ip link indicate that can0 is DOWN
# dmesg | grep can0 [ 0.038651] dma_flexcan0 : no governor for states [ 9.794019] IPv6: ADDRCONF(NETDEV_UP): can0: link is not ready [ 9.800267] IPv6: ADDRCONF(NETDEV_CHANGE): can0: link becomes ready # ifconfig # ip link 3: can0: <NOARP,ECHO> mtu 16 qdisc pfifo_fast state DOWN mode DEFAULT group default qlen 10 link/can
Even if I redo
# ip link set can0 up
The can interface stays DOWN
So what could be the problem? And what could I do to resolve this?
(Using Apalis-imx8qp V1.0B and Ixora carrier board V1.1B, Boot2Qt with Qt 5.15.5 built based on this manifest v5.15.5-lts.xml - yocto/boot2qt-manifest.git - Unnamed repository; edit this file 'description' to name the repository.)