assert failed: xQueueSemaphoreTake queue.c:1549 (pxQueue->uxItemSize == 0)
Posted: Thu Feb 01, 2024 4:07 am
idf版本:4.4
esp版本:esp32-wroom-32
我在使用esp32读取dht11模块的数据,使用mqtt上传到阿里云时发生重启,没有找到问题
我创建了一个Task任务 get_dht11(),每次执行到esp_mqtt_client_publish这里就报上面的错误
esp版本:esp32-wroom-32
我在使用esp32读取dht11模块的数据,使用mqtt上传到阿里云时发生重启,没有找到问题
- assert failed: xQueueSemaphoreTake queue.c:1549 (pxQueue->uxItemSize == 0)
- Backtrace:0x40081a6a:0x3ffcc3000x400884a5:0x3ffcc320 0x4008f0b5:0x3ffcc340 0x40089372:0x3ffcc460 0x40089530:0x3ffcc4a0 0x400da3fe:0x3ffcc4c0 0x400d70d0:0x3ffcc500 0x4008b63d:0x3ffcc5f0
- 0x40081a6a: panic_abort at D:/tools/espressif/Espressif/frameworks/esp-idf-v4.4.2/components/esp_system/panic.c:402
- 0x400884a5: esp_system_abort at D:/tools/espressif/Espressif/frameworks/esp-idf-v4.4.2/components/esp_system/esp_system.c:128
- 0x4008f0b5: __assert_func at D:/tools/espressif/Espressif/frameworks/esp-idf-v4.4.2/components/newlib/assert.c:85
- 0x40089372: xQueueSemaphoreTake at D:/tools/espressif/Espressif/frameworks/esp-idf-v4.4.2/components/freertos/queue.c:1549 (discriminator 1)
- 0x40089530: xQueueTakeMutexRecursive at D:/tools/espressif/Espressif/frameworks/esp-idf-v4.4.2/components/freertos/queue.c:731
- 0x400da3fe: esp_mqtt_client_publish at D:/tools/espressif/Espressif/frameworks/esp-idf-v4.4.2/components/mqtt/esp-mqtt/mqtt_client.c:1802
- 0x400d70d0: get_dht11 at D:/tools/espressif/Espressif/frameworks/esp-idf-v4.4.2/MyProject/tcp-V4/main/app_main.c:86
- 0x4008b63d: vPortTaskWrapper at D:/tools/espressif/Espressif/frameworks/esp-idf-v4.4.2/components/freertos/port/xtensa/port.c:131
- ELF file SHA256: c577a7c13b8387c1
- Rebooting...
我创建了一个Task任务 get_dht11(),每次执行到esp_mqtt_client_publish这里就报上面的错误
- static char my_topic[50] = "/sys/%s/%s/thing/event/property/post";
- static char my_topic_publish[150] = "{\"version\": \"1.0\", \"params\": { \"temperature\": %.1f, \"Humidity\": %.1f }, \"method\": \"thing.event.property.post\" }";
- void get_dht11(void * pClient){
- int dht11_status;
- float temperature;
- float humidity;
- unsigned int loopTimes = 1;
- static char MY_TOPIC_COMPONENTS[64] = {0};
- snprintf(MY_TOPIC_COMPONENTS, sizeof(MY_TOPIC_COMPONENTS),my_topic , EXAMPLE_PRODUCT_KEY,EXAMPLE_DEVICE_NAME);
- char MY_TOPIC_PUBLISH_COMPONENTS[200] = {0};
- int msg_id;
- //portMUX_TYPE mmux = portMUX_INITIALIZER_UNLOCKED;
- while (1)
- {
- if(mqtt_link_status == true){
- dht11_status = DHT11_read();
- ESP_LOGI(TAG, "loopTimes:%d \n",loopTimes++);
- if(dht11_status == DHT_SUCCESS){
- temperature = humidity = 0;
- temperature = get_temperature();
- humidity = get_humidity();
- ESP_LOGI(TAG, "temperature:%.1f; humidity:%.1f \n",temperature,humidity);
- memset(MY_TOPIC_PUBLISH_COMPONENTS, 0, 200);
- snprintf(MY_TOPIC_PUBLISH_COMPONENTS, sizeof(MY_TOPIC_PUBLISH_COMPONENTS),my_topic_publish , temperature,humidity);
- ESP_LOGI(TAG, "sendTopic:%s \n",MY_TOPIC_COMPONENTS);
- ESP_LOGI(TAG, "sendMSG:%s \n",MY_TOPIC_PUBLISH_COMPONENTS);
- //taskENTER_CRITICAL(&mmux);
- msg_id = esp_mqtt_client_publish(*(esp_mqtt_client_handle_t *)pClient, MY_TOPIC_COMPONENTS, MY_TOPIC_PUBLISH_COMPONENTS, 0, 1, 0);
- //taskEXIT_CRITICAL(&mmux);
- ESP_LOGI(TAG, "sent publish successful, msg_id=%d", msg_id);
- }else{
- ESP_LOGI(TAG, "Error: %d", dht11_status);
- }
- }
- vTaskDelay(DHT11_TASK_DELAY / portTICK_PERIOD_MS);
- }
- }