i.MX6q sabresd CAN/FLEXCAN Support

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

i.MX6q sabresd CAN/FLEXCAN Support

3,324件の閲覧回数
aravindsrinivas
Contributor I

I am trying to bring up CAN I/F on i.mx6q sabresd on Android 8.0. i have made the kernel configurations such as 

CONFIG_CAN=y
CONFIG_CAN_VCAN=y
CONFIG_CAN_FLEXCAN=y
CONFIG_CAN_M_CAN=y

 and dtsi changes 

can1: flexcan@02090000 {
compatible = "fsl,imx6q-flexcan";
reg = <0x02090000 0x4000>;
interrupts = <0 110 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&clks IMX6QDL_CLK_CAN1_IPG>,
<&clks IMX6QDL_CLK_CAN1_SERIAL>;
clock-names = "ipg", "per";
stop-mode = <&gpr 0x34 28 0x10 17>;
status = "enabled";
};

can2: flexcan@02094000 {
compatible = "fsl,imx6q-flexcan";
reg = <0x02094000 0x4000>;
interrupts = <0 111 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&clks IMX6QDL_CLK_CAN2_IPG>,
<&clks IMX6QDL_CLK_CAN2_SERIAL>;
clock-names = "ipg", "per";
stop-mode = <&gpr 0x34 29 0x10 18>;
status = "enabled";
};

can1 {
pinctrl_flexcan1_1: flexcan1grp-1 {
fsl,pins = <
MX6QDL_PAD_KEY_ROW2__FLEXCAN1_RX 0x1b0b0
MX6QDL_PAD_KEY_COL2__FLEXCAN1_TX 0x1b0b0
MX6QDL_PAD_GPIO_2__GPIO1_IO02 0x4001b0b0 /* CAN_STBY */
>;
};

pinctrl_flexcan1_2: flexcan1grp-2 {
fsl,pins = <
MX6QDL_PAD_GPIO_7__FLEXCAN1_TX 0x1b0b0
MX6QDL_PAD_KEY_ROW2__FLEXCAN1_RX 0x1b0b0
MX6QDL_PAD_GPIO_2__GPIO1_IO02 0x4001b0b0 /* CAN_STBY */
>;
};

pinctrl_flexcan1_3: flexcan1grp-3 {
fsl,pins = <
MX6QDL_PAD_GPIO_7__FLEXCAN1_TX 0x1b0b0
MX6QDL_PAD_GPIO_8__FLEXCAN1_RX 0x1b0b0
MX6QDL_PAD_GPIO_2__GPIO1_IO02 0x4001b0b0 /* CAN_STBY */
>;
};
};

how ever i am not able to enumerated can0 port on /sys/class/net/

my ifconfig -a is 

sabresd_6dq:/ # ifconfig -a
eth0 Link encap:Ethernet HWaddr 00:04:9f:05:b7:18 Driver fec
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 TX bytes:0

sit0 Link encap:IPv6-in-IPv4
NOARP MTU:1480 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:1
RX bytes:0 TX bytes:0

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:1
RX bytes:0 TX bytes:0

kernel logs

sabresd_6dq:/ # dmesg | grep can
[ 0.502410] i2c i2c-0: can't use DMA, using PIO instead.
[ 0.503669] i2c i2c-1: can't use DMA, using PIO instead.
[ 0.504463] i2c i2c-2: can't use DMA, using PIO instead.
[ 1.819637] vcan: Virtual CAN interface driver
[ 1.825525] flexcan 2090000.flexcan: could not find pctldev for node /soc/can1/flexcan1grp-3, deferring probe
[ 1.834207] flexcan 2094000.flexcan: could not find pctldev for node /soc/can2/flexcan2grp-1, deferring probe
[ 4.009768] snvs-secvio 20cc000.caam-snvs: can't get snvs clock
[ 4.261684] can: controller area network core (rev 20120528 abi 9)
[ 4.269794] can: raw protocol (rev 20120528)
[ 4.272825] can: broadcast manager protocol (rev 20161123 t)
[ 4.277194] can: netlink gateway (rev 20130117) max_hops=1
[ 4.353356] flexcan 2090000.flexcan: could not find pctldev for node /soc/can1/flexcan1grp-3, deferring probe
[ 4.362515] flexcan 2094000.flexcan: could not find pctldev for node /soc/can2/flexcan2grp-1, deferring probe
[ 4.635453] flexcan 2090000.flexcan: could not find pctldev for node /soc/can1/flexcan1grp-3, deferring probe
[ 4.644554] flexcan 2094000.flexcan: could not find pctldev for node /soc/can2/flexcan2grp-1, deferring probe
[ 4.664613] flexcan 2090000.flexcan: could not find pctldev for node /soc/can1/flexcan1grp-3, deferring probe
[ 4.674109] flexcan 2094000.flexcan: could not find pctldev for node /soc/can2/flexcan2grp-1, deferring probe
[ 12.998737] flexcan 2090000.flexcan: could not find pctldev for node /soc/can1/flexcan1grp-3, deferring probe
[ 13.041782] flexcan 2094000.flexcan: could not find pctldev for node /soc/can2/flexcan2grp-1, deferring probe
[ 73.135941] flexcan 2090000.flexcan: could not find pctldev for node /soc/can1/flexcan1grp-3, deferring probe
[ 73.147405] flexcan 2094000.flexcan: could not find pctldev for node /soc/can2/flexcan2grp-1, deferring probe

Anything i am missing?

attached my sabresd board where i have fixed a DB9 connector in CAN I/F port.

Thanks in advance.

ラベル(2)
0 件の賞賛
返信
10 返答(返信)

2,791件の閲覧回数
aravindsrinivas
Contributor I

Hi Igor,

Managed to get the driver registered on Android 8.0

130|sabresd_6dq:/ # dmesg | grep can

[ 1.799585] vcan: Virtual CAN interface driver
[ 1.805627] 2090000.flexcan supply xceiver not found, using dummy regulator
[ 1.812139] flexcan 2090000.flexcan: gpr /soc/aips-bus@02000000/iomuxc-gpr@020e0000 req_gpr 0x34 req_bit 28 ack_gpr 0x10 ack_bit 17
[ 1.812197] flexcan 2090000.flexcan: device registered (reg_base=f82f8000, irq=33)
[ 3.804080] imx6q-pinctrl 20e0000.iomuxc: pin MX6Q_PAD_KEY_ROW2 already requested by 2090000.flexcan; cannot claim for soc:hdmi_cec@00120000
[ 4.618004] snvs-secvio 20cc000.caam-snvs: can't get snvs clock
[ 4.871769] can: controller area network core (rev 20120528 abi 9)
[ 4.879904] can: raw protocol (rev 20120528)
[ 4.882900] can: broadcast manager protocol (rev 20161123 t)
[ 4.887269] can: netlink gateway (rev 20130117) max_hops=1
[ 199.665669] flexcan 2090000.flexcan can0: writing ctrl=0x0e312005
[ 199.665683] flexcan 2090000.flexcan can0: flexcan_set_bittiming: mcr=0x5980000f ctrl=0x0e312005
[ 199.665691] flexcan 2090000.flexcan can0: flexcan_chip_start: writing mcr=0x7de20209
[ 199.665699] flexcan 2090000.flexcan can0: flexcan_chip_start: writing ctrl=0x0e312055
[ 199.665751] flexcan 2090000.flexcan can0: flexcan_chip_start: reading mcr=0x64e20209 ctrl=0x0e31ac55
[ 199.665812] IPv6: ADDRCONF(NETDEV_CHANGE): can0: link becomes ready
[ 302.170212] flexcan 2090000.flexcan can0: New error state: 1
[ 302.173352] flexcan 2090000.flexcan can0: New error state: 3
[ 302.173361] flexcan 2090000.flexcan can0: bus-off

Now the issue is no frames are transmitted. i only have the cansend and candump utility working, cannot use cantest .

sabresd_6dq:/ # cansend can0 5A1#11.22.33.44.55.66.77.88
interface = can0, family = 29, type = 3, proto = 1

sabresd_6dq:/ # ip -details -statistics link show can0
2: can0: <NO-CARRIER,NOARP,UP,ECHO> mtu 16 qdisc pfifo_fast state DOWN mode DEFAULT group default qlen 10
link/can promiscuity 0
can state BUS-OFF (berr-counter tx 0 rx 0) restart-ms 0
bitrate 125000 sample-point 0.875
tq 500 prop-seg 6 phase-seg1 7 phase-seg2 2 sjw 1
flexcan: tseg1 4..16 tseg2 2..8 sjw 1..4 brp 1..256 brp-inc 1
clock 30000000
re-started bus-errors arbit-lost error-warn error-pass bus-off
0 0 0 1 0 1
RX: bytes packets errors dropped overrun mcast
16 2 0 0 0 0
TX: bytes packets errors dropped carrier collsns
0 0 0 0 0 0

also cannot toggle gpio 7 & 8 to high to verify in scope -> echo 1 > /sys/class/gpio/gpio8/value doesnt take effect.

sabresd_6dq:/sys/class/gpio/gpio7 # cat /sys/kernel/debug/gpio
gpiochip0: GPIOs 0-31, parent: platform/209c000.gpio, 209c000.gpio:
gpio-2 ( |BT power enable ) out hi
gpio-4 ( |Volume Up ) in hi
gpio-5 ( |Volume Down ) in hi
gpio-7 ( |sysfs ) in lo
gpio-8 ( |sysfs ) out lo
gpio-9 ( |microphone detect ) in hi
gpio-25 ( |phy-reset ) out hi
gpio-29 ( |usb_h1_vbus ) out hi

Thanks,

Aravind

0 件の賞賛
返信

2,791件の閲覧回数
igorpadykov
NXP Employee
NXP Employee

Hi Aravind

flexcan is not supported on i.MX6Q Sabre SD board,

one can look at flexcan example for i.MX6Q Sabre AI board and check:

How to enable CAN bus on i.MX6Q SabreSD 

imx6qdl-sabreauto.dtsi\dts\boot\arm\arch - linux-imx - i.MX Linux kernel 

Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 件の賞賛
返信

2,791件の閲覧回数
aravindsrinivas
Contributor I

Hi Igor,

This link seems to be broken or i am unauthorized to access .

How to enable CAN bus on i.MX6Q SabreSD - https://community.nxp.com/docs/DOC-94887

Thanks,

Aravind

0 件の賞賛
返信

2,791件の閲覧回数
igorpadykov
NXP Employee
NXP Employee

Hi Aravind

I sent file via mail.

Best regards
igor

0 件の賞賛
返信

2,791件の閲覧回数
aravindsrinivas
Contributor I

Hi Igor. Thanks for the File. But this seems to be for Linux. in Android i dont have any such folder like /arch/arm/mach-mx6/ and neither file like board-mx6q_sabresd.c/.h .

Also the procedure for cantest/canutils/libsocketcan were based on linux.

Can you point me more insight on how should i proceed in android.

Thanks,

Aravind

0 件の賞賛
返信

2,790件の閲覧回数
igorpadykov
NXP Employee
NXP Employee

Hi Aravind

general steps are described on

How to use FlexCAN in Android OS 

Best regards
igor

0 件の賞賛
返信

2,790件の閲覧回数
aravindsrinivas
Contributor I

Thanks igor for your reply.

Is CAN supported on Android 8.0 on i.MX6 sabre sd? What kind of support for CAN I/F support available for i.MX6 sabre sd?

- aravind

0 件の賞賛
返信

2,791件の閲覧回数
igorpadykov
NXP Employee
NXP Employee

>Is CAN supported on Android 8.0 on i.MX6 sabre sd?

not.

Best regards
igor

0 件の賞賛
返信

2,791件の閲覧回数
aravindsrinivas
Contributor I

Thanks igor. Is linux having support for CAN/FLEXCAN on i.mx 6 sabresd ?. 

From datasheets it say CAN/FLEXCAN supported. Whats the platform where its verified on i.mx6 quad sabresd.

Also another question whether it can be enabled on Android 8.0 for i.mx 6 Quad sabresd if we use NXP Professional services.

Thanks,

aravind

0 件の賞賛
返信

2,791件の閲覧回数
igorpadykov
NXP Employee
NXP Employee

Hi Aravind

>Is linux having support for CAN/FLEXCAN on i.mx 6 sabresd ?

no for i.MX6Q Sabre SD. Yes for i.MX6SX Sabre SD. For other platforms

suggest to check Sabre SD schematics.

>whether it can be enabled on Android 8.0 for i.mx 6 Quad sabresd if we use NXP Professional services.

yes

Best regards
igor

0 件の賞賛
返信