CAN 接收,每次都是到红色语句地方,在往下一步就会硬件错误,我看了寄存器,接收的数据是对的,有什么解决的方法没,是我的接收方式不对么? static HAL_StatusTypeDef CAN_Receive_IT(CAN_HandleTypeDef* hcan, uint8_t FIFONumber) { uint32_t tmp1 = 0U; CanRxMsgTypeDef* pRxMsg = NULL; /* Set RxMsg pointer */ if(FIFONumber == CAN_FIFO0) { pRxMsg = hcan->pRxMsg; } else /* FIFONumber == CAN_FIFO1 */ { pRxMsg = hcan->pRx1Msg; } /* Get the Id */ pRxMsg->IDE = (uint8_t)0x04U & ((uint8_t)(hcan->Instance->sFIFOMailBox[FIFONumber].RIR)); if (pRxMsg->IDE == CAN_ID_STD) { // pRxMsg->StdId = 0x000007FFU & (hcan->Instance->sFIFOMailBox[FIFONumber].RIR >> 21U); pRxMsg->StdId = 0x000007FFU & (pRxMsg->IDE >> 21U); } else { // pRxMsg->ExtId = 0x1FFFFFFFU & (hcan->Instance->sFIFOMailBox[FIFONumber].RIR >> 3U); pRxMsg->ExtId = 0x000007FFU & (pRxMsg->IDE >> 3U); } |
点评
评分
查看全部评分
评分
查看全部评分