Page 1 of 1

How to get the tickrate of RTC ?

Posted: Thu May 16, 2019 11:39 am
by dhananjay.sutariya
Hi all,
As i can figure out from make menuconfig that tick rate of ESP is 10 ms .How ever are there any internal RTC api's that give me the tick rate of RTC as i understand that RTC is working on different clock then ESP does.
Also, what does "Number of cycles for RTC_SLOW_CLK" Calibration signify?

Thanks,
Dhananjay Sutariya

Re: How to get the tickrate of RTC ?

Posted: Thu May 16, 2019 2:49 pm
by WiFive
This file has a lot of information in the help sections of the menuconfig options about rtc and timekeeping which you can also view when in menuconfig
https://github.com/espressif/esp-idf/bl ... 32/Kconfig

Re: How to get the tickrate of RTC ?

Posted: Fri May 17, 2019 6:32 am
by dhananjay.sutariya
WiFive wrote:
Thu May 16, 2019 2:49 pm
This file has a lot of information in the help sections of the menuconfig options about rtc and timekeeping which you can also view when in menuconfig
https://github.com/espressif/esp-idf/bl ... 32/Kconfig
Hi wifive,
I' afraid that i still cant get enough information from that file regarding the TICK RATE of rtc.

Thanks,
Dhananjay Sutariya

Re: How to get the tickrate of RTC ?

Posted: Fri May 17, 2019 6:38 am
by WiFive
choice ESP32_RTC_CLOCK_SOURCE
prompt "RTC clock source"
default ESP32_RTC_CLOCK_SOURCE_INTERNAL_RC
help
Choose which clock is used as RTC clock source.

- "Internal 150kHz oscillator" option provides lowest deep sleep current
consumption, and does not require extra external components. However
frequency stability with respect to temperature is poor, so time may
drift in deep/light sleep modes.
- "External 32kHz crystal" provides better frequency stability, at the
expense of slightly higher (1uA) deep sleep current consumption.
- "External 32kHz oscillator" allows using 32kHz clock generated by an
external circuit. In this case, external clock signal must be connected
to 32K_XP pin. Amplitude should be <1.2V in case of sine wave signal,
and <1V in case of square wave signal. Common mode voltage should be
0.1 < Vcm < 0.5Vamp, where Vamp is the signal amplitude.
Additionally, 1nF capacitor must be connected between 32K_XN pin and
ground. 32K_XN pin can not be used as a GPIO in this case.
- "Internal 8.5MHz oscillator divided by 256" option results in higher
deep sleep current (by 5uA) but has better frequency stability than
the internal 150kHz oscillator. It does not require external components.
choice ESP32_TIME_SYSCALL
prompt "Timers used for gettimeofday function"
default ESP32_TIME_SYSCALL_USE_RTC_FRC1
help
This setting defines which hardware timers are used to
implement 'gettimeofday' and 'time' functions in C library.

- If both high-resolution and RTC timers are used, timekeeping will
continue in deep sleep. Time will be reported at 1 microsecond
resolution. This is the default, and the recommended option.
- If only high-resolution timer is used, gettimeofday will
provide time at microsecond resolution.
Time will not be preserved when going into deep sleep mode.
- If only RTC timer is used, timekeeping will continue in
deep sleep, but time will be measured at 6.(6) microsecond
resolution. Also the gettimeofday function itself may take
longer to run.
- If no timers are used, gettimeofday and time functions
return -1 and set errno to ENOSYS.
- When RTC is used for timekeeping, two RTC_STORE registers are
used to keep time in deep sleep mode.

Re: How to get the tickrate of RTC ?

Posted: Fri May 17, 2019 6:45 am
by dhananjay.sutariya
WiFive wrote:
Fri May 17, 2019 6:38 am
choice ESP32_RTC_CLOCK_SOURCE
prompt "RTC clock source"
default ESP32_RTC_CLOCK_SOURCE_INTERNAL_RC
help
Choose which clock is used as RTC clock source.

- "Internal 150kHz oscillator" option provides lowest deep sleep current
consumption, and does not require extra external components. However
frequency stability with respect to temperature is poor, so time may
drift in deep/light sleep modes.
- "External 32kHz crystal" provides better frequency stability, at the
expense of slightly higher (1uA) deep sleep current consumption.
- "External 32kHz oscillator" allows using 32kHz clock generated by an
external circuit. In this case, external clock signal must be connected
to 32K_XP pin. Amplitude should be <1.2V in case of sine wave signal,
and <1V in case of square wave signal. Common mode voltage should be
0.1 < Vcm < 0.5Vamp, where Vamp is the signal amplitude.
Additionally, 1nF capacitor must be connected between 32K_XN pin and
ground. 32K_XN pin can not be used as a GPIO in this case.
- "Internal 8.5MHz oscillator divided by 256" option results in higher
deep sleep current (by 5uA) but has better frequency stability than
the internal 150kHz oscillator. It does not require external components.
choice ESP32_TIME_SYSCALL
prompt "Timers used for gettimeofday function"
default ESP32_TIME_SYSCALL_USE_RTC_FRC1
help
This setting defines which hardware timers are used to
implement 'gettimeofday' and 'time' functions in C library.

- If both high-resolution and RTC timers are used, timekeeping will
continue in deep sleep. Time will be reported at 1 microsecond
resolution. This is the default, and the recommended option.
- If only high-resolution timer is used, gettimeofday will
provide time at microsecond resolution.
Time will not be preserved when going into deep sleep mode.
- If only RTC timer is used, timekeeping will continue in
deep sleep, but time will be measured at 6.(6) microsecond
resolution. Also the gettimeofday function itself may take
longer to run.
- If no timers are used, gettimeofday and time functions
return -1 and set errno to ENOSYS.
- When RTC is used for timekeeping, two RTC_STORE registers are
used to keep time in deep sleep mode.
Hi Wifive,
Apologies, My Bad. Thanks for the help. :D (Y)

Regards,
Dhananjay Sutariya

Re: How to get the tickrate of RTC ?

Posted: Fri May 17, 2019 7:48 am
by dhananjay.sutariya
Hi Wifive,
How about normal Mode .
How does RTC work in Normal mode.
And as i 'm setting my time with mktime i'm realising that my rtc time starts getting deviated after a while.

Thanks,
Dhananjay Sutariya