imx8qm-mek: Ongoing issue with CAN bus on imx8qm-mek board

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

imx8qm-mek: Ongoing issue with CAN bus on imx8qm-mek board

1,895 Views
merlinfriesen
Contributor I

Hi,

I see the thread below that references CAN however it has not covered or fixed my issues.

https://community.nxp.com/t5/i-MX-Processors/CANBus-interface-for-i-MX8QM-MEK-board/m-p/1171974

1. I see flexcan ports are disabled by default in fsl-imx8qm-mek-rpmsg.dtsi
    So I have created a patch file for Yocto that fixes this (for flexcan1,2,3).

&flexcan1 {
- status = "disabled";
+ status = "okay";
};

2. I compile using Yocto to create new images.

3. U-boot confirms that fsl-imx8qm-mek-rpmsg.dtb is the active dtb file.

4. I decompile the dtb (using dtc)
    and confirm the 3 flexcan ports have :

    status = "okay"

5. However, if I look in sysfs after boot and do the following

      cat /sys/firmware/devicetree/base/can@5a8x0000/status

      for all 3 flexcan ports they show as DISABLED.

6. Something is still wrong.
    The original thread suggests the Cortext M4 owns the can devices and this is
    why they are not enabled.

    The SCFW manages the M4 so I download code from here:

https://www.nxp.com/webapp/sps/download/license.jsp?colCode=L4.14.62_1.0.0_Beta_SCFWKIT&appType=file...

    The orginal thread suggests to comment out this line in board.c
    //BRD_ERR(rm_set_resource_movable(pt_boot, SC_R_CAN_0, SC_R_CAN_2, SC_TRUE));

    However this line does not exist and I see no code in the SCFW that controls CAN.


What am I missing; can you help?

thanks!
Merlin

0 Kudos
5 Replies

1,835 Views
merlinfriesen
Contributor I

.

0 Kudos

1,866 Views
igorpadykov
NXP Employee
NXP Employee

Hi Merlin

 

L4.14.62 release is very old and not more supported, recommended to try latest described on

https://www.nxp.com/design/software/embedded-software/i-mx-software/embedded-linux-for-i-mx-applicat...

For CAN one can try dts without rpmsg, difference is described in AN13275 p.28

How to Enable Linux BSP L5.4 on a New iMX8/8X Board

 

Best regards
igor

0 Kudos

1,842 Views
merlinfriesen
Contributor I

Hi Igor

Thanks for your reply.
I took your advice and moved to L5.4.

As you note the default DTB is using ...rpmsg.dtb
I now use imx8qm-mek-root.dtb

I also modified board.c (I am using iMX8QM-MEK) as follows
and reflashed at offset 0x22 after flashing the WIC image.

/* List of resources */
//mf static const sc_rsrc_t rsrc_list[9U] =
static const sc_rsrc_t rsrc_list[7U] =
{
SC_R_IRQSTR_M4_1,
SC_R_UART_2,
SC_R_MU_6B,
SC_R_MU_7B,
SC_R_MU_9B,
SC_R_GPT_3,
//mf RM_RANGE(SC_R_CAN_0, SC_R_CAN_2),
SC_R_FSPI_0
};

/* List of pads */
//mf static const sc_pad_t pad_list[8U] =
static const sc_pad_t pad_list[6U] =
{
RM_RANGE(SC_P_M41_I2C0_SCL, SC_P_M41_GPIO0_01),
RM_RANGE(SC_P_UART0_CTS_B, SC_P_UART0_RTS_B),
//mf RM_RANGE(SC_P_FLEXCAN0_RX, SC_P_FLEXCAN2_TX),
RM_RANGE(SC_P_QSPI0A_DATA0, SC_P_COMP_CTL_GPIO_1V8_3V3_QSPI0)
};

I now see the following :
1. lsmod shows
dev_can and flexcan modules loaded
2. /proc/device-tree/../can.../status
Shows 'Okay' for all 3 devices

However ifconfig
still does not show canX devices.

Any thoughts ?


thanks !
Merlin

0 Kudos

1,837 Views
igorpadykov
NXP Employee
NXP Employee

Hi Merlin

 

one can try Demo Image    i.MX 8QuadMax MEK​

use a flash.bin without M4 firmware (imx-boot-imx8qmmek-sd.bin-flash_linux,

check if the can modules are loaded

1|mek_8q:/ # lsmod
Module Size Used by
flexcan 57344 0
can_dev 45056 1 flexcan
can_gw 36864 0
can_bcm 32768 0
can_raw 40960 0
can 36864 3 can_gw,can_bcm,can_raw
moal 692224 0
mlan 786432 1 moal

One can load them using modeprobe.

AN13210  How to Use FlexCAN in Linux - i.MX 8MP EVK

 

Best regards
igor

0 Kudos

1,834 Views
merlinfriesen
Contributor I

Hi Igor

Thanks for your reply.
I took your advice and moved to L5.4.

As you note the default DTB is using <>-rpmsg.dtb.
-- I now use imx8qm-mek-root.dtb

I also modified board.c (I am using iMX8QM-MEK) as follows
and reflashed at offset 0x22 after flashing the WIC image.

/* List of resources */
//mf static const sc_rsrc_t rsrc_list[9U] =
static const sc_rsrc_t rsrc_list[7U] =
{
SC_R_IRQSTR_M4_1,
SC_R_UART_2,
SC_R_MU_6B,
SC_R_MU_7B,
SC_R_MU_9B,
SC_R_GPT_3,
//mf RM_RANGE(SC_R_CAN_0, SC_R_CAN_2),
SC_R_FSPI_0
};

/* List of pads */
//mf static const sc_pad_t pad_list[8U] =
static const sc_pad_t pad_list[6U] =
{
RM_RANGE(SC_P_M41_I2C0_SCL, SC_P_M41_GPIO0_01),
RM_RANGE(SC_P_UART0_CTS_B, SC_P_UART0_RTS_B),
//mf RM_RANGE(SC_P_FLEXCAN0_RX, SC_P_FLEXCAN2_TX),
RM_RANGE(SC_P_QSPI0A_DATA0, SC_P_COMP_CTL_GPIO_1V8_3V3_QSPI0)
};

I now see the following :

0. The MEK board boots Ok.
1. lsmod shows dev_can and flexcan modules loaded
2. /proc/device-tree/../can@.../status
      Shows 'Okay' for all 3 devices

However ifconfig
still does not show canX devices.

Any thoughts ?


thanks !
Merlin

0 Kudos