freertos 队列 错乱 问题
本帖最后由 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),不会发送该情况。
大家有没有遇到这种情况?
难道是数据太多导致失效?是否是发送顺序问题呢,是否是40ms时候延迟的原因呢 freertos 发送队列指针,两个队列我发的一个指针:L:L:L:L:L:L:L:L 资源共享访问错误吧
页:
[1]