Skip to content

Hang/Freeze with VSync #24

@macardoso

Description

@macardoso

Hi Vindar,

Have been working with this library for several weeks and ran into an integration issue when pairing this library with LVGL and FreeRTOS. I was able to create a very reproduceable hang/block/freeze on the processor when LVGL lv_task_handler() calls the ILI9341_T4 flush. Very interestingly, the hang/block/freeze was always exactly 7.1583 seconds (as close as I could measure on my oscilloscope) which works out to 2^32 (32 bit register) divided by 600,000,000 (600MHz clock). There is something going on (and I have yet to pinpoint exactly where the issue lies) with VSync and what appears to be a ARM cycle counter rollover handler. The running time between hangs is random (between 0.25 and 20 seconds), but the frequency increases with the framerate being pushed to the screen. The length of the hang never changes.

Workaround for me: tft.setVSyncSpacing(0);

If tft.setVSyncSpacing(1); the hangs begin again.

I'm continuing to debug exactly what is happening here, but a couple of quick questions. Do you use a 32 bit register to increment cycle counts or another value that increments at the clock frequency? I could not find any calls to ARM_DWT_CYCCNT in your source code, but I could be missing something. Do you use the processor's PIT (periodic interval timer) for any timing related functions? Are there known conflicts with IntervalTimer or Arduino_FreeRTOS?

Thanks, I'll share any additional findings.

Versions:
LVGL 9.2.2
Arduino_FreeRTOS 11.2.0-3
ILI9341_T4 1.6.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions