本帖最后由 keyway 于 2024-7-1 00:26 编辑
en-us--M0A21_Series_BSP_CMSIS_V3.02.000
范例 CAN_NormalMode_Tx
传送后NewDat永远不会清除,为什么?
ReleaseIF(tCAN, (uint32_t)u8MsgIfNum); 没使用中断,为什么要 Disable CAN interrupt. ~Enable CAN interrupt.??
/* Disable CAN interrupt */
u32IntMask = tCAN->CON & (CAN_CON_IE_Msk | CAN_CON_SIE_Msk | CAN_CON_EIE_Msk);
tCAN->CON = tCAN->CON & ~(CAN_CON_IE_Msk | CAN_CON_SIE_Msk | CAN_CON_EIE_Msk);
gu8LockCanIf[u32CanNo][u32IfNo] = 0u;
/* Enable CAN interrupt */
tCAN->CON |= u32IntMask;
况且CAN_CON_IE_Msk | CAN_CON_SIE_Msk | CAN_CON_EIE_Msk永远为"0"
第一次传送永远传不出去,必须先运行 CAN_TriggerTxMsg()
/* Send a 11-bit Standard Identifier message */
tMsg.FrameType = CAN_DATA_FRAME;
tMsg.IdType = CAN_STD_ID;
tMsg.Id = 0x7FF;
tMsg.DLC = 2;
tMsg.Data[0] = 7;
tMsg.Data[1] = 0xFF;
|