AnsweredAssumed Answered

MK22FX512 FlexCan init problem

Question asked by Pau Vilanova on Jun 13, 2018
Latest reply on Jun 14, 2018 by Mark Butcher


I'm trying to work with the flexcan module of my mk22 using the MCUxpresso drivers provided by nxp, but when I try to initialize the flexcan it gets stuck on the following while:


static inline void FLEXCAN_Enable(CAN_Type *base, bool enable)
    if (enable)
        base->MCR &= ~CAN_MCR_MDIS_MASK;
        /* Wait FlexCAN exit from low-power mode. */
        while (base->MCR & CAN_MCR_LPMACK_MASK)

When enabling CAN, it waits until the lowpowermodule is off, but this bit is never 0. How could that be?

I had CAN working on the KDS so i went to check in there if the driver checks that bit, but it doesn't, enabling can on the kds driver just changes MDIS bit without waiting the lpm to set off.

My mcuxpresso initialization is the following:

    flexcan_config_t flexcanConfig;
    FLEXCAN_Init(FLEXCAN0, &flexcanConfig, 8000000UL);