Problem using lvgl in custom thread

I'm using an nRF5340DK and an Adafruit 2.8" TFT Touch Shield to implement a touch keyboard on the board. As you can see in the attached project, I would like to use the lvgl functions in a custom thread, but this causes the board to reboot constantly. Any idea what is causing this?

This image shows application output. Boards reboots all the time.

Project:

threads_sample_lvgl.zip

Best regards,
Pablo

Useful information about the project:

- Using nRF5340DK and an Adafruit 2.8" TFT Touch Shield
- Using nRF Connect SDK v2.2.0.
- The project is based on the example: Basic Thread Example

Parents
  • Hello Pablo,

    I have looked at your code. You have defined stack size for each thread is 1024 but in the ta_event_cb() function set buffer size 2048. So, it is most likely stack overflow issue. Large buffers like this should declare either as static or as global. Changing the line char buff [2048] to static char buff[2048] would fix the problem. 

    You can try that and let us know the consequence. 

    Thanks.

    BR

    Kazi

  • Hi Kazi,

    Thanks for your reply. I didn't notice the problem of having a long buffer. Now buff is a global variable. 

    However, the program keeps restarting. In addition, if I comment out the following line, which assigns ta_event_cb to the textArea, the error remains. Also, I deleted buff.

    lv_obj_add_event_cb(ta, ta_event_cb, LV_EVENT_ALL, kb);

    The only way I have found to stop it from restarting is to remove the lv_task_handler function, which obviously causes the screen to display nothing.

    I attach the updated project, in case it's useful to reproduce the problem.

    threads_sample_lvgl_v2.zip

    Best regards,
    Pablo.

Reply
  • Hi Kazi,

    Thanks for your reply. I didn't notice the problem of having a long buffer. Now buff is a global variable. 

    However, the program keeps restarting. In addition, if I comment out the following line, which assigns ta_event_cb to the textArea, the error remains. Also, I deleted buff.

    lv_obj_add_event_cb(ta, ta_event_cb, LV_EVENT_ALL, kb);

    The only way I have found to stop it from restarting is to remove the lv_task_handler function, which obviously causes the screen to display nothing.

    I attach the updated project, in case it's useful to reproduce the problem.

    threads_sample_lvgl_v2.zip

    Best regards,
    Pablo.

Children
Related