[imx8mp] use FLEXCAN2 controller by M7

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

[imx8mp] use FLEXCAN2 controller by M7

Jump to solution
540 Views
schwammal
Contributor I

Hello everyone,

I am new here and I got my hands on an imx8mp µC.
On the µC I want to run an application which needs two CANs.
For this µC are CAN demo implementations available, which I am able to run on my Hardware.

To run one of this examples on FLEXCAN2 instead of FLEXCAN1 the board configuration has to change.
In particular I added the PIN and Clock config for FLEXCAN2.

Currently the initialization for FLEXCAN1 is running fine, but the initialization of FLEXCAN2 is stuck while disabling the FLEXCAN Module. 

Within the Demo Code is a init for an specific GPIO pin.
/* GPIO5_IO05 is used to control CAN1_STBY which is ebaled active high */
gpio_pin_config_t config = {kGPIO_DigitalOutput, 1, kGPIO_NoIntmode};
GPIO_PinInit(GPIO5, 5U, &config);

I do not set an GPIO for CAN2 and I think there is my issue.
Does anyone know where I can find the information which GPIO I have to use for CAN2?

Thanks for your help in advance.

Greetings
schwammal

Labels (1)
0 Kudos
Reply
1 Solution
517 Views
AldoG
NXP TechSupport
NXP TechSupport

Hello,

it is actually a bit difficult to use FlexCAN2 on the EVK, as the pins used for this one are shared with PDM and also there is a switch that need to be enabled in order for it to actually be selected.

AldoG_0-1719333130590.png

So, it is not enough to just mux the FlexCAN correctly but to set this switch as well, to see an example of such implementation one could refer to the Linux Device tree:
https://github.com/nxp-imx/linux-imx/blob/lf-6.6.y/arch/arm64/boot/dts/freescale/imx8mp-evk.dts#L422
https://github.com/nxp-imx/linux-imx/blob/lf-6.6.y/arch/arm64/boot/dts/freescale/imx8mp-evk.dts#L107...
https://github.com/nxp-imx/linux-imx/blob/lf-6.6.y/arch/arm64/boot/dts/freescale/imx8mp-evk.dts#L109...

Best regards/Saludos,
Aldo.

View solution in original post

0 Kudos
Reply
2 Replies
518 Views
AldoG
NXP TechSupport
NXP TechSupport

Hello,

it is actually a bit difficult to use FlexCAN2 on the EVK, as the pins used for this one are shared with PDM and also there is a switch that need to be enabled in order for it to actually be selected.

AldoG_0-1719333130590.png

So, it is not enough to just mux the FlexCAN correctly but to set this switch as well, to see an example of such implementation one could refer to the Linux Device tree:
https://github.com/nxp-imx/linux-imx/blob/lf-6.6.y/arch/arm64/boot/dts/freescale/imx8mp-evk.dts#L422
https://github.com/nxp-imx/linux-imx/blob/lf-6.6.y/arch/arm64/boot/dts/freescale/imx8mp-evk.dts#L107...
https://github.com/nxp-imx/linux-imx/blob/lf-6.6.y/arch/arm64/boot/dts/freescale/imx8mp-evk.dts#L109...

Best regards/Saludos,
Aldo.

0 Kudos
Reply
481 Views
schwammal
Contributor I

Hi Aldo,

thanks for this information.
From the Files you have shared I assume, that I have to set the MX8MP_IOMUXC_SAI2_MCLK__GPIO4_IO27 to high to switch for CAN2.

The initialization is still not working properly, but I will talk to my colleagues about it bevor posting an update.

 

Best regards
schwammal