FlexCAN i.MX7 M4 stuck waiting for LPM_ACK

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

FlexCAN i.MX7 M4 stuck waiting for LPM_ACK

Jump to solution
1,011 Views
dogisfat
Contributor IV

I am trying to get the M4 of the i.MX7 communicating over CAN. I have included the flexcan.c and flexcan.h file in my project from the FreeRTOS_BSP_1.0.1_iMX7D_Linux.tar.gz BSP.

When initializing the FlexCAN peripheral the system gets stuck in the call to FLEXCAN_Disable in the FLEXCAN_Init call on :

/* Wait until disabled */
 while (!(CAN_MCR_REG(base) & CAN_MCR_LPM_ACK_MASK));

I can verify that the MDIS bit is set in the MCR register with the debugger. I have configured the clocking and RDC of the FlexCAN as follows:

/* In this example, we need to grasp board flexcan exclusively */
 RDC_SetPdapAccess(RDC, rdcPdapFlexCan1, 3 << (BOARD_DOMAIN_ID * 2), false, false);

/* Select board flexcan derived from OSC clock(24M) */
CCM_UpdateRoot(CCM, ccmRootCan1, ccmRootmuxCanOsc24m, 0, 0);
/* Enable flexcan clock */
CCM_EnableRoot(CCM, ccmRootCan1);
CCM_ControlGate(CCM, ccmCcgrGateCan1, ccmClockNeededAll);

What may be causing the system to hang on the LPM_ACK bit when trying to disable the module?

Labels (3)
Tags (3)
0 Kudos
1 Solution
656 Views
dogisfat
Contributor IV

The issue was with the IOMUX Daisy configuration. I am using the CL_SOM_iMX7 from compulab. Adding the following lines to the pin configurations fixed the issue:

// CAN1 RX

IOMUXC_FLEXCAN1_RX_SELECT_INPUT = IOMUXC_FLEXCAN1_RX_SELECT_INPUT_DAISY(1);

// CAN2 RX

IOMUXC_FLEXCAN2_RX_SELECT_INPUT = IOMUXC_FLEXCAN2_RX_SELECT_INPUT_DAISY(1);

View solution in original post

0 Kudos
3 Replies
657 Views
dogisfat
Contributor IV

The issue was with the IOMUX Daisy configuration. I am using the CL_SOM_iMX7 from compulab. Adding the following lines to the pin configurations fixed the issue:

// CAN1 RX

IOMUXC_FLEXCAN1_RX_SELECT_INPUT = IOMUXC_FLEXCAN1_RX_SELECT_INPUT_DAISY(1);

// CAN2 RX

IOMUXC_FLEXCAN2_RX_SELECT_INPUT = IOMUXC_FLEXCAN2_RX_SELECT_INPUT_DAISY(1);

0 Kudos
656 Views
Carlos_Musich
NXP Employee
NXP Employee

Thank you for sharing your solution Allen. We appreciate it.


Regards,
Carlos
NXP Technical Support

0 Kudos
656 Views
dogisfat
Contributor IV

I found this (MQX FlexCAN ) thread for an iMX6SX getting stuck on the same line. Unfortunately the Clock Control Module (CCM) is not the same between the iMX6SX and the iMX7D. The problem seems like it is related to the clock. Digging around I found that the CCM registers for the IGP_CLK_ROOT show the clock as disabled. I cannot enable it and this thread (https://community.nxp.com/message/864525 ) indicates that it is always enabled and cannot be disabled.

Are the registers wrong?

0 Kudos