Power Management - Automatic Light Sleep - Issues

chofsass
Posts: 8
Joined: Mon Apr 06, 2020 3:30 pm

Power Management - Automatic Light Sleep - Issues

Postby chofsass » Mon Apr 06, 2020 3:47 pm

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?

ESP_igrr
Posts: 2067
Joined: Tue Dec 01, 2015 8:37 am

Re: Power Management - Automatic Light Sleep - Issues

Postby ESP_igrr » Mon Apr 06, 2020 7:40 pm

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.

Who is online

Users browsing this forum: Baidu [Spider], djixon, steevke and 137 guests