assert failed: xQueueSemaphoreTake queue.c:1549 (pxQueue->uxItemSize == 0)

abiaoyihao
Posts: 1
Joined: Thu Feb 01, 2024 3:58 am

assert failed: xQueueSemaphoreTake queue.c:1549 (pxQueue->uxItemSize == 0)

Postby abiaoyihao » Thu Feb 01, 2024 4:07 am

idf版本:4.4
esp版本:esp32-wroom-32
我在使用esp32读取dht11模块的数据,使用mqtt上传到阿里云时发生重启,没有找到问题
  1. assert failed: xQueueSemaphoreTake queue.c:1549 (pxQueue->uxItemSize == 0)
  2.  
  3.  
  4. Backtrace:0x40081a6a:0x3ffcc3000x400884a5:0x3ffcc320 0x4008f0b5:0x3ffcc340 0x40089372:0x3ffcc460 0x40089530:0x3ffcc4a0 0x400da3fe:0x3ffcc4c0 0x400d70d0:0x3ffcc500 0x4008b63d:0x3ffcc5f0
  5. 0x40081a6a: panic_abort at D:/tools/espressif/Espressif/frameworks/esp-idf-v4.4.2/components/esp_system/panic.c:402
  6.  
  7. 0x400884a5: esp_system_abort at D:/tools/espressif/Espressif/frameworks/esp-idf-v4.4.2/components/esp_system/esp_system.c:128
  8.  
  9. 0x4008f0b5: __assert_func at D:/tools/espressif/Espressif/frameworks/esp-idf-v4.4.2/components/newlib/assert.c:85
  10.  
  11. 0x40089372: xQueueSemaphoreTake at D:/tools/espressif/Espressif/frameworks/esp-idf-v4.4.2/components/freertos/queue.c:1549 (discriminator 1)
  12.  
  13. 0x40089530: xQueueTakeMutexRecursive at D:/tools/espressif/Espressif/frameworks/esp-idf-v4.4.2/components/freertos/queue.c:731
  14.  
  15. 0x400da3fe: esp_mqtt_client_publish at D:/tools/espressif/Espressif/frameworks/esp-idf-v4.4.2/components/mqtt/esp-mqtt/mqtt_client.c:1802
  16.  
  17. 0x400d70d0: get_dht11 at D:/tools/espressif/Espressif/frameworks/esp-idf-v4.4.2/MyProject/tcp-V4/main/app_main.c:86
  18.  
  19. 0x4008b63d: vPortTaskWrapper at D:/tools/espressif/Espressif/frameworks/esp-idf-v4.4.2/components/freertos/port/xtensa/port.c:131
  20.  
  21.  
  22. ELF file SHA256: c577a7c13b8387c1
  23.  
  24. Rebooting...

我创建了一个Task任务 get_dht11(),每次执行到esp_mqtt_client_publish这里就报上面的错误
  1. static char my_topic[50] = "/sys/%s/%s/thing/event/property/post";
  2. static char my_topic_publish[150] = "{\"version\": \"1.0\",     \"params\": {       \"temperature\": %.1f,      \"Humidity\": %.1f  },  \"method\": \"thing.event.property.post\" }";
  3.  
  4. void get_dht11(void * pClient){
  5.     int dht11_status;
  6.     float temperature;
  7.     float humidity;
  8.     unsigned int loopTimes = 1;
  9.  
  10.     static char MY_TOPIC_COMPONENTS[64] = {0};
  11.     snprintf(MY_TOPIC_COMPONENTS, sizeof(MY_TOPIC_COMPONENTS),my_topic , EXAMPLE_PRODUCT_KEY,EXAMPLE_DEVICE_NAME);
  12.  
  13.     char MY_TOPIC_PUBLISH_COMPONENTS[200] = {0};
  14.     int msg_id;
  15.     //portMUX_TYPE mmux = portMUX_INITIALIZER_UNLOCKED;
  16.     while (1)
  17.         {
  18.             if(mqtt_link_status == true){
  19.                 dht11_status = DHT11_read();
  20.                 ESP_LOGI(TAG, "loopTimes:%d \n",loopTimes++);
  21.  
  22.                  if(dht11_status == DHT_SUCCESS){
  23.                     temperature = humidity = 0;
  24.                     temperature = get_temperature();
  25.                     humidity = get_humidity();
  26.                     ESP_LOGI(TAG, "temperature:%.1f;    humidity:%.1f   \n",temperature,humidity);
  27.  
  28.                     memset(MY_TOPIC_PUBLISH_COMPONENTS, 0, 200);
  29.                     snprintf(MY_TOPIC_PUBLISH_COMPONENTS, sizeof(MY_TOPIC_PUBLISH_COMPONENTS),my_topic_publish , temperature,humidity);
  30.  
  31.                     ESP_LOGI(TAG, "sendTopic:%s \n",MY_TOPIC_COMPONENTS);
  32.                     ESP_LOGI(TAG, "sendMSG:%s   \n",MY_TOPIC_PUBLISH_COMPONENTS);
  33.                     //taskENTER_CRITICAL(&mmux);
  34.                     msg_id = esp_mqtt_client_publish(*(esp_mqtt_client_handle_t *)pClient, MY_TOPIC_COMPONENTS, MY_TOPIC_PUBLISH_COMPONENTS, 0, 1, 0);
  35.                     //taskEXIT_CRITICAL(&mmux);
  36.                     ESP_LOGI(TAG, "sent publish successful, msg_id=%d", msg_id);
  37.  
  38.                  }else{
  39.                     ESP_LOGI(TAG, "Error: %d", dht11_status);
  40.                  }
  41.             }
  42.             vTaskDelay(DHT11_TASK_DELAY / portTICK_PERIOD_MS);
  43.         }
  44.  
  45. }
Attachments
app_main.c
(9.88 KiB) Downloaded 88 times
aiot_mqtt_sign.h
(251 Bytes) Downloaded 83 times
aiot_mqtt_sign.c
(11.8 KiB) Downloaded 82 times

Who is online

Users browsing this forum: No registered users and 48 guests