esp32s2关于同时使用wifi和lvgl出错重启是什么原因
Posted: Sat Mar 05, 2022 3:42 am
我尝试在用lvgl做一组wifi扫描连接界面,但加入wifi扫描后,esp32s2就不断重启,使用的版本是release4.4,vscode c开发。具体我也去查过,也有人遇到这个问题,他用的是arduino,说是lvgl调用的系统计时和freertos任务调用wifi时起了冲突,但说的很笼统,不太熟悉freertos,头秃搞不明白,有什么办法能解决吗。代码和出错信息如下:
错误信息:
- /*****界面任务*****/
- static void gui_task(void *arg)
- {
- xGuiSemaphore = xSemaphoreCreateMutex();
- lv_init(); //lvgl内核初始化
- lvgl_driver_init(); //lvgl显示接口初始化
- static lv_disp_draw_buf_t draw_buf;
- lv_color_t *buf1 = heap_caps_malloc(LV_HOR_RES_MAX * LV_VER_RES_MAX * sizeof(lv_color_t), MALLOC_CAP_DMA);
- lv_color_t *buf2 = heap_caps_malloc(LV_HOR_RES_MAX * LV_VER_RES_MAX * sizeof(lv_color_t), MALLOC_CAP_DMA);
- lv_disp_draw_buf_init(&draw_buf, buf1, buf2, LV_HOR_RES_MAX * LV_VER_RES_MAX); /*Initialize the display buffer*/
- static lv_disp_drv_t disp_drv; /*A variable to hold the drivers. Must be static or global.*/
- lv_disp_drv_init(&disp_drv); /*Basic initialization*/
- disp_drv.draw_buf = &draw_buf; /*Set an initialized buffer*/
- disp_drv.flush_cb = disp_driver_flush; /*Set a flush callback to draw to the display*/
- disp_drv.hor_res = 240; /*Set the horizontal resolution in pixels*/
- disp_drv.ver_res = 240; /*Set the vertical resolution in pixels*/
- lv_disp_drv_register(&disp_drv); /*Register the driver and save the created display objects*/
- esp_register_freertos_tick_hook(lv_tick_task);
- lvgl_test();
- uint32_t count = 0;
- while (1)
- {
- /* Delay 1 tick (assumes FreeRTOS tick is 10ms */
- vTaskDelay(pdMS_TO_TICKS(10));
- count++;
- if(count == 300){
- testExit();
- lvgl1_test();
- }else if(count == 600){
- count = 0;
- testExit();
- lvgl_test();
- }
- /* Try to take the semaphore, call lvgl related function on success */
- if (pdTRUE == xSemaphoreTake(xGuiSemaphore, portMAX_DELAY))
- {
- lv_timer_handler();
- xSemaphoreGive(xGuiSemaphore);
- }
- }
- /******WIFI任务********/
- void wifi_task(void *arg)
- {
- ESP_LOGI(TAG, "APP Start......");
- esp_err_t ret = nvs_flash_init();
- if (ret == ESP_ERR_NVS_NO_FREE_PAGES || ret == ESP_ERR_NVS_NEW_VERSION_FOUND) {
- ESP_ERROR_CHECK(nvs_flash_erase());
- ret = nvs_flash_init();
- }
- ESP_ERROR_CHECK( ret );
- while(1){
- wifi_scan();
- vTaskDelay(20000 / portTICK_RATE_MS);
- }
- vTaskDelete(NULL);
- }
- /*****主函数*****/
- void app_main(void)
- {
- xTaskCreatePinnedToCore(gui_task, "gui task", 1024 * 3, NULL, 0, NULL, 0);
- xTaskCreatePinnedToCore(wifi_task, "wifi_task", 1024 * 4, NULL, 2, NULL, 0);
- while(1){
- vTaskDelay(1);
- }
- }
错误信息:
- Guru Meditation Error: Core 0 panic'ed (StoreProhibited). Exception was unhandled.
- Core 0 register dump:
- PC : 0x40112304 PS : 0x00060530 A0 : 0x80096c1c A1 : 0x3ffd4430
- 0x40112304: lv_color_fill at /home/esp32/esp-idf/esp32_lvgl/blink/build/../components/lvgl/src/misc/lv_color.c:50
- A2 : 0x00000000 A3 : 0x00000000 A4 : 0x000000f0 A5 : 0x0000000f
- A6 : 0x00000000 A7 : 0x00000000 A8 : 0x00000000 A9 : 0x00000010
- A10 : 0x00000000 A11 : 0x3ffcbbc0 A12 : 0x3ffcb040 A13 : 0x00000000
- A14 : 0x00000000 A15 : 0x00000000 SAR : 0x0000001a EXCCAUSE: 0x0000001d
- EXCVADDR: 0x00000000 LBEG : 0x3ffcb040 LEND : 0x00000000 LCOUNT : 0x4002477d
- 0x4002477d: _xt_user_exc at /home/esp32/esp-idf/components/freertos/port/xtensa/xtensa_vectors.S:633
- Backtrace:0x40112301:0x3ffd44300x40096c19:0x3ffd4450 0x400980d5:0x3ffd44f0 0x40097f62:0x3ffd4540 0x4009a885:0x3ffd4570 0x4009b4da:0x3ffd4610 0x40112003:0x3ffd4630 0x4008839f:0x3ffd4650 0x40088dfe:0x3ffd4700 0x4011176d:0x3ffd4730 0x40087cba:0x3ffd4750 0x40087d99:0x3ffd4770 0x4008e00e:0x3ffd47b0 0x4008e0d1:0x3ffd47f0 0x4008e282:0x3ffd4810 0x4008e404:0x3ffd4880 0x4008e4fd:0x3ffd48c0 0x4008e69c:0x3ffd48e0 0x40093c15:0x3ffd4910 0x40093cc6:0x3ffd4930 0x40086bd7:0x3ffd4950 0x4002d7a1:0x3ffd4970
- 0x40112301: lv_color_fill at /home/esp32/esp-idf/esp32_lvgl/blink/build/../components/lvgl/src/misc/lv_color.c:49
- 0x40096c19: fill_normal at /home/esp32/esp-idf/esp32_lvgl/blink/build/../components/lvgl/src/draw/sw/lv_draw_sw_blend.c:229 (discriminator 3)
- 0x400980d5: lv_draw_sw_blend_basic at /home/esp32/esp-idf/esp32_lvgl/blink/build/../components/lvgl/src/draw/sw/lv_draw_sw_blend.c:159
- 0x40097f62: lv_draw_sw_blend at /home/esp32/esp-idf/esp32_lvgl/blink/build/../components/lvgl/src/draw/sw/lv_draw_sw_blend.c:105
- 0x4009a885: draw_bg at /home/esp32/esp-idf/esp32_lvgl/blink/build/../components/lvgl/src/draw/sw/lv_draw_sw_rect.c:132
- 0x4009b4da: lv_draw_sw_rect at /home/esp32/esp-idf/esp32_lvgl/blink/build/../components/lvgl/src/draw/sw/lv_draw_sw_rect.c:75
- 0x40112003: lv_draw_rect at /home/esp32/esp-idf/esp32_lvgl/blink/build/../components/lvgl/src/draw/lv_draw_rect.c:66
- 0x4008839f: lv_obj_draw at /home/esp32/esp-idf/esp32_lvgl/blink/build/../components/lvgl/src/core/lv_obj.c:544
- 0x40088dfe: lv_obj_event at /home/esp32/esp-idf/esp32_lvgl/blink/build/../components/lvgl/src/core/lv_obj.c:854
- 0x4011176d: lv_obj_event_base at /home/esp32/esp-idf/esp32_lvgl/blink/build/../components/lvgl/src/core/lv_event.c:98
- 0x40087cba: event_send_core at /home/esp32/esp-idf/esp32_lvgl/blink/build/../components/lvgl/src/core/lv_event.c:458
- 0x40087d99: lv_event_send at /home/esp32/esp-idf/esp32_lvgl/blink/build/../components/lvgl/src/core/lv_event.c:75
- 0x4008e00e: lv_refr_obj at /home/esp32/esp-idf/esp32_lvgl/blink/build/../components/lvgl/src/core/lv_refr.c:148
- 0x4008e0d1: lv_refr_obj_and_children at /home/esp32/esp-idf/esp32_lvgl/blink/build/../components/lvgl/src/core/lv_refr.c:738
- 0x4008e282: lv_refr_area_part at /home/esp32/esp-idf/esp32_lvgl/blink/build/../components/lvgl/src/core/lv_refr.c:670
- 0x4008e404: lv_refr_area at /home/esp32/esp-idf/esp32_lvgl/blink/build/../components/lvgl/src/core/lv_refr.c:589 (discriminator 2)
- 0x4008e4fd: lv_refr_areas at /home/esp32/esp-idf/esp32_lvgl/blink/build/../components/lvgl/src/core/lv_refr.c:529
- 0x4008e69c: _lv_disp_refr_timer at /home/esp32/esp-idf/esp32_lvgl/blink/build/../components/lvgl/src/core/lv_refr.c:324
- 0x40093c15: lv_timer_exec at /home/esp32/esp-idf/esp32_lvgl/blink/build/../components/lvgl/src/misc/lv_timer.c:313 (discriminator 2)
- 0x40093cc6: lv_timer_handler at /home/esp32/esp-idf/esp32_lvgl/blink/build/../components/lvgl/src/misc/lv_timer.c:109
- 0x40086bd7: gui_task at /home/esp32/esp-idf/esp32_lvgl/blink/build/../main/iDutMain.c:70
- 0x4002d7a1: vPortTaskWrapper at /home/esp32/esp-idf/components/freertos/port/xtensa/port.c:131
- ELF file SHA256: 3d57903203e8cb7e
- Rebooting...
- ESP-ROM:esp32s2-rc4-20191025
- Build:Oct 25 2019
- rst:0x3 (RTC_SW_SYS_RST),boot:0x8 (SPI_FAST_FLASH_BOOT)
- Saved PC:0x40023435
- 0x40023435: esp_restart_noos_dig at /home/esp32/esp-idf/components/esp_system/esp_system.c:44 (discriminator 1)