Use of RTC with XTAL and deepsleep



  • I have a few questions regarding use of the RTC (real time clock).

    1. Is there a difference in accuracy and power consumption when using the RTC with XTAL_32KHZ vs. INTERNAL_RC
    2. Will the RTC need to be reinitalized after a deepsleep to make it use XTAL_32KHZ or INTERNAL_RC
    3. Will deep sleep have any affect on the accuracy of the RTC?


  • Hi @jardar

    You will get better accuracy - including timing deepsleep wake, especially if you're having long sleep times - using an external crystal at the expense of slightly higher power consumption. I don't however have quantitative data on this to share and it'll also vary depending on the crystal used.

    On the normal firmware you'll need to tell RTC to enable XTAL_32KHZ every time, because the pycom-esp-idf is compiled with

    CONFIG_ESP32_RTC_CLOCK_SOURCE_INTERNAL_RC=y CONFIG_ESP32_RTC_CLOCK_SOURCE_EXTERNAL_CRYSTAL=

    so this reverts to the internal clock every deepsleep cycle.

    If you're using an external crystal I'd recommend compiling a custom firmware with the external crystal enabled: Component config->ESP32-specific->"Timers used for gettimeofday" and "RTC clock source"


 

Pycom on Twitter