Open akashpraan opened 1 day ago
@akashpraan Your program is crashing because it tries to dereference a NULL pointer. Please check how to interpret panic output in this section of the docs: https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/api-guides/fatal-errors.html#loadprohibited-storeprohibited
For your case, I would recommend enabling GDB Stub and then waiting for the program to crash. Once the program has crashed it will enter the GDB session and you can inspect the variables to understand what happened.
On a brief look, it does seem like the issue happens due to the fact that you are manipulating LVGL state in display_data function from your task at the same time as LVGL is performing a refresh in its own task. Typically you need to hold the muted while modifying UI state outside of LVGL task.
Hello @igrr I am using LVGL for the first time, what mutex are you talking about?
Sorry to bother with this questions, I tried finding the answer but couldn't.
I am using LVGL for the first time, what mutex are you talking about?
LVGL is not thread safe, you must call this function
Before you call any LVGL function (LVGL functions start with lv_*
). After you are done, call
https://github.com/espressif/esp-bsp/blob/48936a65c8bd5bad95de0582b5ad15e0f35558c3/components/esp_lvgl_port/include/esp_lvgl_port.h#L110
These two functions take/release mutex that protects LVGL internal data while you are modifying the UI
So it should look like this
...
lvgl_port_lock(1000); // Take LVGL lock (implemented as mutex)
lv_*(); // Do what you need with your UI
lvgl_port_unlock(); // Release the lock
...
Here is the related part of the docs, for reference: https://github.com/espressif/esp-bsp/blob/48936a65c8bd5bad95de0582b5ad15e0f35558c3/components/esp_lvgl_port/README.md#lvgl-api-usage
Answers checklist.
IDF version.
5.1.4
Espressif SoC revision.
ESP32 S3 Wroom 1U (16MB Flash)
Operating System used.
Windows
How did you build your project?
VS Code IDE
If you are using Windows, please specify command line type.
None
Development Kit.
Custom Board
Power Supply used.
USB
What is the expected behavior?
I expect the display to get updated properly everytime and not result in a crash after a random number of hours
What is the actual behavior?
The ESP resets after a random number of hours
I want to figure out why there is this failure and why it is affecting my system and getting the ESP to restart after a random amount of hours. The last time I observed it was after 12 hours of leaving the system ON and on 12 or 15th button press this issue was seen.
lvgl/lvgl: “^8.3.0” esp_lvgl_port: “^1” These have been added in dependencies in idf_component.yml
Steps to reproduce.
I am using a Black&White 0.96inch OLED Display to display status of Fan Mode and the sensor values
For one instance I got the error back trace from the ESP such as
Debug Logs.
No response
More Information.
I added multiple checks like to not create an existing label, check if the screen is active.
The function to update the screen display_data() is called by a button Interrupt, MQTT task if there is a command or by Admin Task to update status every 2 minutes.
Is there some status that I need to check like a mutex sort of thing before transitioning between display data functions? I call the display data function like