问答

汇集网友智慧,解决技术难题

微信13267226716

TA的家园币:804  

  • 小华单片机HC32F460的跑官方例程时会发送不成功

    目前在调试HC32F460时会卡在如下代码:在while(CAN_GetStatus(CAN_UNIT,CAN_FLAG_STB_TX)==RESET){},哪位大佬可以指点一下吗?staticvoidCanTx(void){uint8_ti;staticuint8_tu8Data;for(i=0U;i<CAN_TX_DATA_SIZE;i++){m_stcTx1.au8Data=u8Data++;m_stcTx2.au8Data=u8Data++;m_stcTx3.au8Data=u8Data++;}/*FramewithCAN_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);/*StartPTBTX*/CAN_StartTx(CAN_UNIT,CAN_TX_REQ_PTB);/*Checktransmissionend.*/while(CAN_GetStatus(CAN_UNIT,CAN_FLAG_PTB_TX)==RESET){}CAN_ClearStatus(CAN_UNIT,CAN_FLAG_PTB_TX);/*FramewithCAN_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);/*FramewithCAN_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);/*StartSTBTX*/CAN_StartTx(CAN_UNIT,CAN_TX_REQ_STB_ALL);/*Checktransmissionend.*/while(CAN_GetStatus(CAN_UNIT,CAN_FLAG_STB_TX)==RESET){}CAN_ClearStatus(CAN_UNIT,CAN_FLAG_STB_TX);}

    hc32f460 CAN

    2023-03-02 6