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_ControlGate(CCM, ccmCcgrGateCan1, ccmClockNeededAll);
What may be causing the system to hang on the LPM_ACK bit when trying to disable the module?