目前在调试HC32F460时会卡在如下代码:while (CAN_GetStatus(CAN_UNIT, CAN_FLAG_STB_TX) == RESET) { },有人指点一下吗?
static void CanTx(void)
{
uint8_t i;
static uint8_t u8Data;
for (i = 0U; i < CAN_TX_DATA_SIZE; i++) {
m_stcTx1.au8Data[i] = u8Data++;
m_stcTx2.au8Data[i] = u8Data++;
m_stcTx3.au8Data[i] = u8Data++;
}
/* Frame with CAN_ID1 */
m_stcTx1.u32Ctrl = 0x0UL;
m_stcTx1.u32ID = CAN_TX_ID1;
m_stcTx1.IDE = CAN_TX_ID1_IDE;
m_stcTx1.DLC = CAN_TX_DLC;
(void)CAN_FillTxFrame(CAN_UNIT, CAN_TX_BUF_PTB, &m_stcTx1);
/* Start PTB TX */
CAN_StartTx(CAN_UNIT, CAN_TX_REQ_PTB);
/* Check transmission end. */
while (CAN_GetStatus(CAN_UNIT, CAN_FLAG_PTB_TX) == RESET) { }
CAN_ClearStatus(CAN_UNIT, CAN_FLAG_PTB_TX);
/* Frame with CAN_ID2 */
m_stcTx2.u32Ctrl = 0x0UL;
m_stcTx2.u32ID = CAN_TX_ID2;
m_stcTx2.IDE = CAN_TX_ID2_IDE;
m_stcTx2.DLC = CAN_TX_DLC;
(void)CAN_FillTxFrame(CAN_UNIT, CAN_TX_BUF_STB, &m_stcTx2);
/* Frame with CAN_ID3 */
m_stcTx3.u32Ctrl = 0x0UL;
m_stcTx3.u32ID = CAN_TX_ID3;
m_stcTx3.IDE = CAN_TX_ID3_IDE;
m_stcTx3.DLC = CAN_TX_DLC;
(void)CAN_FillTxFrame(CAN_UNIT, CAN_TX_BUF_STB, &m_stcTx3);
/* Start STB TX */
CAN_StartTx(CAN_UNIT, CAN_TX_REQ_STB_ALL);
/* Check transmission end. */
while (CAN_GetStatus(CAN_UNIT, CAN_FLAG_STB_TX) == RESET) { }
CAN_ClearStatus(CAN_UNIT, CAN_FLAG_STB_TX);
}
|