本帖最后由 anka120 于 2018-8-8 18:50 编辑 最近调试//发送两个队列 xResult = xSemaphoreTake(xSemaphore, (TickType_t)1); if(xResult == pdTRUE) { pm_CANcallBack->usLenth = CAN2udp((void *)&g_CAN1RxMsg,pm_CANcallBack->ucData); xResult = xQueueSend(xQCAN12UDP,(void *)&pm_CANcallBack,0); } xResult = xSemaphoreTake(xSemaphore2, (TickType_t)1); if(xResult == pdTRUE) { pm_CANcallBack->usLenth = CAN2udp((void *)&g_CAN2RxMsg,pm_CANcallBack->ucData); xResult = xQueueSend(xQCAN22UDP,(void *)&pm_CANcallBack,0); } //接收两个队列 xResult = xQueueReceive(xQCAN12UDP,(void *) &m_tMsgudp2,(TickType_t)0); if(xResult == pdPASS) sendto(SOCK_UDPS,m_tMsgudp2->ucData,m_tMsgudp2->usLenth, remote_ip, remote_port); xResult = xQueueReceive(xQCAN22UDP,(void *) &m_tMsgudp3,(TickType_t)0); if(xResult == pdPASS) sendto(SOCK_UDPS2,m_tMsgudp3->ucData,m_tMsgudp3->usLenth, remote_ip, remote_port); 接收队列的时候,操作频繁(周期大概40ms),发送错乱的情况:xQCAN12UDP 中有xQCAN22UDP 的数据; 操作不频繁的时候(周期大概400ms),不会发送该情况。 大家有没有遇到这种情况? |
评分
查看全部评分
评分
查看全部评分