Hi NXP,
I am using IMX8QM-MEK board, i booted board with BSP version-i.MX Linux Yocto Project BSP 5.4.47_2.2.0 Release.
Following messages has been seen after board boots
root@imx8qmmek:~# [ 35.923813] vref_1v8: disabling
[ 35.926969] epdev_on: disabling
[ 35.930152] SD1_SPWR: disabling
[ 35.933321] can01-en: disabling
[ 35.936488] can2-en: disabling
[ 35.939553] can01-stby: disabling
[ 35.942891] can2-stby: disabling
[ 64.596108] cfg80211: failed to load regulatory.db
I need to enable CAN0 and CAN1.
Seen that in imx8qm-mek.dts flexcan is enabled.
Please let us know the steps how to enable CAN01, CAN02 and CAN3 on this IMX8QM-MEK board.
Thanks and Regards
rahulM
Solved! Go to Solution.
Hi rahulM,
First, you need to configure the bit-timing, we have a document focus on this, please take a look at the document, is focus on another processor that we have but it will be useful to you:
https://community.nxp.com/t5/MPC5xxx-Knowledge-Base/FlexCAN-bit-timing-calculation/ta-p/1122068
ip link set can0 type can bitrate 125000 triple-sampling on
I use this command and the up the CAN bus, please take a look:
root@imx8mpevk:~# ip link set can0 type can bitrate 125000 triple-sampling on
root@imx8mpevk:~# ifconfig can0 up
[ 438.761339] IPv6: ADDRCONF(NETDEV_CHANGE): can0: link becomes ready
root@imx8mpevk:~# 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:32
eth0 Link encap:Ethernet HWaddr 00:04:9f:06:f6:72
UP BROADCAST MULTICAST MTU:1500 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:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
eth1 Link encap:Ethernet HWaddr 00:04:9f:06:f6:73
UP BROADCAST MULTICAST MTU:1500 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:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
Interrupt:48
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:416 errors:0 dropped:0 overruns:0 frame:0
TX packets:416 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:26642 (26.0 KiB) TX bytes:26642 (26.0 KiB)
Regards,
Israel.
thanks
Hi , i am also unable to see CAN interfaces with ifconfig -a command. Are you able to see can them with this command? Could you pleas help me here?
Hi NXP,
My above issue some what i solved by changing devicetree, i am not able to see above error for can0 and can1.
root@imx8qmmek:~# [ 35.926757] vref_1v8: disabling
[ 35.929970] epdev_on: disabling
[ 35.933172] SD1_SPWR: disabling
I am not able to see can0 and can1 on giving command #ifconfig or ls /dev
root@imx8qmmek:~# ifconfig can0 up
ifconfig: SIOCGIFFLAGS: No such device
root@imx8qmmek:~#
Please let me know, how to make enable can0 and can1 at ls /dev or ifconfig
Thanks and Regards
rahulM
Hi rahulM,
i am also unable to see CAN interfaces with ifconfig -a command.
Could you please tell me what networking configurations did you do to see those interfaces with ifconfig -a command?
Regards,
Preetam Chaugule
Hi Pretam/NXP
Ok sure I will help you to enable CAN interface on yocto platform.
Please follow below steps
1. Add packages in your meta/conf/layer.conf
IMAGE_INSTALL_append += "iproute2 libsocketcan canutils"
2. bitbake -f menuconfig linux-imx
CONFIG_CAN=y
CONFIG_CAN_RAW=y
CONFIG_CAN_BCM=y
CONFIG_CAN_GW=y
CONFIG_CAN_DEV=y
CONFIG_CAN_FLEXCAN=y
CONFIG_CAN_SJA1000=y
3. Also enable network utilities
4. bitbake -f menuconfig busybox
enable iproute2, ip link and ip addr
5. check device tree for .compatible
6. bitbake linux-imx
7. bitbake build-wayland
8. After generating image flash and boot the device
9.#ifconfig -a
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:3661 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:16836 (16.4 KiB) TX bytes:0 (0.0 B)
Interrupt:77
can1 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:78
can2 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:79
Now your can interface will be enabled...
Regards
Subramanya N M
Hello, Thank you for the reply. Actually , I am not using Yoctoproject and sadly not familiar with the terminologies.
I am using "imx-android-11.0.0_1.0.0" on "iMx8quadMax MEK".
I am trying to access CAN interfaces of i.MX 8QuadMax MEK using "imx-android-11.0.0_1.0.0" and I dont see any CAN peripherals in the "ifconfig -a" command.
As of now, I have done following things:
I have partitioned CAN interfaces to partition 6 (A core) as per below post :
I have modified device trees with "status = "okay"" for following regulators in "imx8qm-mek-rpmsg.dts" file:
®_can01_en
®_can01_stby
&can0_lpcg
&can1_lpcg
&flexcan1
&flexcan2
I get following output after using command " $ zcat proc/config.gz | grep CAN":
CONFIG_CC_CAN_LINK=y
# CONFIG_NET_EMATCH_CANID is not set
CONFIG_CAN=m
CONFIG_CAN_RAW=m
CONFIG_CAN_BCM=m
CONFIG_CAN_GW=m
CONFIG_CAN_J1939=m
# CAN Device Drivers
CONFIG_CAN_VCAN=m
# CONFIG_CAN_VXCAN is not set
# CONFIG_CAN_SLCAN is not set
CONFIG_CAN_DEV=m
CONFIG_CAN_CALC_BITTIMING=y
CONFIG_CAN_FLEXCAN=m
# CONFIG_CAN_GRCAN is not set
# CONFIG_CAN_KVASER_PCIEFD is not set
# CONFIG_CAN_XILINXCAN is not set
# CONFIG_CAN_C_CAN is not set
# CONFIG_CAN_CC770 is not set
# CONFIG_CAN_IFI_CANFD is not set
# CONFIG_CAN_M_CAN is not set
# CONFIG_CAN_PEAK_PCIEFD is not set
# CONFIG_CAN_SJA1000 is not set
# CONFIG_CAN_SOFTING is not set
# CAN SPI interfaces
# CONFIG_CAN_HI311X is not set
# CONFIG_CAN_MCP251X is not set
# end of CAN SPI interfaces
# CAN USB interfaces
# CONFIG_CAN_8DEV_USB is not set
# CONFIG_CAN_EMS_USB is not set
# CONFIG_CAN_ESD_USB2 is not set
# CONFIG_CAN_GS_USB is not set
# CONFIG_CAN_KVASER_USB is not set
# CONFIG_CAN_MCBA_USB is not set
# CONFIG_CAN_PEAK_USB is not set
# CONFIG_CAN_UCAN is not set
# end of CAN USB interfaces
# CONFIG_CAN_DEBUG_DEVICES is not set
# end of CAN Device Drivers
# CONFIG_SCSI_SCAN_ASYNC is not set
Following msgs are observed while booting up:
[ 4.389071] can01-stby: supplied by can01-en
[ 35.902211] can01-en: disabling
35.905387] can01-stby: disabling
Still, I dont see any peripherals on "ifconfig -a" command.
Any help is highly appreciated.
Also following msgs, but I dont know how relevant are they:
[ 59.295466] apexd: Can't open /system_ext/apex for reading : No such file or directory
[ 59.303553] apexd: Can't open /product/apex for reading : No such file or directory
[ 59.311309] apexd: Can't open /vendor/apex for reading : No such file or directory
Thaks in advance.
Did you resolve this issue? If yes could you please explain how?
Hi rahulM,
As you already do it, first we need to enable it from the device tree, could you share you dts file to check how you are enable the CAN bus?
Regards,
Israel H.
Hi Israel,
Thanks for your reply
Not able to attach .dts file
After making some networking configurations
i am able to see can on ifconfig
root@imx8qmmek:~# ifconfig -a
can0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
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:77
can1 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
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:78
can2 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
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:79
eth0 Link encap:Ethernet HWaddr 00:04:9F:06:CF:07
UP BROADCAST MULTICAST MTU:1500 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:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 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:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
root@imx8qmmek:~# ip link set can0 type can bitrate 125000
ip: either "dev" is duplicate, or "type" is garbage
root@imx8qmmek:~# ifconfig can0 up
[ 35.785977] flexcan 5a8d0000.can can0: bit-timing not yet defined
ifconfig: SIOCSIFFLAGS: Invalid argument
i am using imx8qm-mek.dts as provided by nxp
reg_can01_en: regulator-can01-gen {
compatible = "regulator-fixed";
// compatible = "regulator-fixed", "fsl,imx8qm-flexcan";
regulator-name = "can01-en";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
gpio = <&pca6416 3 GPIO_ACTIVE_HIGH>;
enable-active-high;
};
reg_can2_en: regulator-can2-gen {
compatible = "regulator-fixed";
//compatible = "regulator-fixed", "fsl,imx8qm-flexcan";
regulator-name = "can2-en";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
gpio = <&pca6416 4 GPIO_ACTIVE_HIGH>;
enable-active-high;
};
reg_can01_stby: regulator-can01-stby {
compatible = "regulator-fixed";
//compatible = "regulator-fixed", "fsl,imx8qm-flexcan";
regulator-name = "can01-stby";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
gpio = <&pca6416 5 GPIO_ACTIVE_HIGH>;
enable-active-high;
vin-supply = <®_can01_en>;
};
reg_can2_stby: regulator-can2-stby {
compatible = "regulator-fixed";
//compatible = "regulator-fixed", "fsl,imx8qm-flexcan";
regulator-name = "can2-stby";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
gpio = <&pca6416 6 GPIO_ACTIVE_HIGH>;
enable-active-high;
vin-supply = <®_can2_en>;
};
Please let me know how to solve this issue.
Thanks and Regards
rahulM
Hi rahulM,
First, you need to configure the bit-timing, we have a document focus on this, please take a look at the document, is focus on another processor that we have but it will be useful to you:
https://community.nxp.com/t5/MPC5xxx-Knowledge-Base/FlexCAN-bit-timing-calculation/ta-p/1122068
ip link set can0 type can bitrate 125000 triple-sampling on
I use this command and the up the CAN bus, please take a look:
root@imx8mpevk:~# ip link set can0 type can bitrate 125000 triple-sampling on
root@imx8mpevk:~# ifconfig can0 up
[ 438.761339] IPv6: ADDRCONF(NETDEV_CHANGE): can0: link becomes ready
root@imx8mpevk:~# 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:32
eth0 Link encap:Ethernet HWaddr 00:04:9f:06:f6:72
UP BROADCAST MULTICAST MTU:1500 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:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
eth1 Link encap:Ethernet HWaddr 00:04:9f:06:f6:73
UP BROADCAST MULTICAST MTU:1500 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:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
Interrupt:48
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:416 errors:0 dropped:0 overruns:0 frame:0
TX packets:416 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:26642 (26.0 KiB) TX bytes:26642 (26.0 KiB)
Regards,
Israel.
thank you