Hi,
I am using esp-idf v3.3.1. I have setup automatic light sleep and I have 2 issues. The first issue is that the tick counter is shifting by about 10 milliseconds of a one second period. The second is that the printf() function which is using the UART doesn't appear to be sleep safe (the UART is dropping characters).
Are there some configurations in menuconfig that I should be using or are these bugs that I should create on github?
Power Management - Automatic Light Sleep - Issues
Re: Power Management - Automatic Light Sleep - Issues
Hi chofsass,
The tick count will indeed drift in the automatic light sleep scenario. Please use esp_timer or gettimeofday for time keeping. These might still drift, depending on the RTC clock source, but much slower (within 1%, https://github.com/espressif/esp-idf/issues/4856).
As for printf, UART output will stop when the chip enters light sleep. If you want to make sure the output gets printed (at the expense of lower sleep time) you may call fsync(fileno(stdout)) — this will block until the UART TX buffer is flushed.
The tick count will indeed drift in the automatic light sleep scenario. Please use esp_timer or gettimeofday for time keeping. These might still drift, depending on the RTC clock source, but much slower (within 1%, https://github.com/espressif/esp-idf/issues/4856).
As for printf, UART output will stop when the chip enters light sleep. If you want to make sure the output gets printed (at the expense of lower sleep time) you may call fsync(fileno(stdout)) — this will block until the UART TX buffer is flushed.
Who is online
Users browsing this forum: Baidu [Spider] and 121 guests