AnsweredAssumed Answered

flexcan bug in SDK version RTM2.0.0 and BETA_2.9.0

Question asked by 何纯 陈 on Oct 29, 2018
Latest reply on Oct 31, 2018 by Alexandru Nan

Dear support team:

    I found a bug in flexcan module, it leads to the interrupt can't disable correctly.

 

   Description:

    file: 

   flexcan_hw_access.c

    function:

    void FLEXCAN_SetErrIntCmd(CAN_Type * base, flexcan_int_type_t errType, bool enable)
{
uint32_t temp = (uint32_t)errType;
if (enable)
{
if((errType == FLEXCAN_INT_RX_WARNING) || (errType == FLEXCAN_INT_TX_WARNING))
{
base->MCR = (base->MCR & ~CAN_MCR_WRNEN_MASK) | CAN_MCR_WRNEN(1U);
}
#if FEATURE_CAN_HAS_FD
if (errType == FLEXCAN_INT_ERR)
{
base->CTRL2 = (base->CTRL2 & ~CAN_CTRL2_ERRMSK_FAST_MASK) | CAN_CTRL2_ERRMSK_FAST(1U);
}
#endif
(base->CTRL1) = ((base->CTRL1) | (temp));
}
else
{
if((errType == FLEXCAN_INT_RX_WARNING) || (errType == FLEXCAN_INT_TX_WARNING))
{
base->MCR = (base->MCR & ~CAN_MCR_WRNEN_MASK) | CAN_MCR_WRNEN(0U);
}
#if FEATURE_CAN_HAS_FD
if (errType == FLEXCAN_INT_ERR)
{
base->CTRL2 = (base->CTRL2 & ~CAN_CTRL2_ERRMSK_FAST_MASK) | CAN_CTRL2_ERRMSK_FAST(0U);
}
#endif
(base->CTRL1) = ((base->CTRL1) | ~(temp));     /** here, the '|' should modify to '&' */
}
}

Outcomes