3. Compile the application program, generate firmware and download it into the ESP8266
module.
4. Power off the module, and change it to operation mode; then power on the module and
run the program.
Result:
readdatafrom0x3E000:05000402
3.2.10. How to Use RTC
1. When software restart (system_restart) is executed, the system time will return to zero,
while the RTC timer will continue. However, if the chip is woken up (including being
periodically woken up from Deep-sleep mode) via external hardware (including EXT_RST
pin or CHIP_EN pin), the RTC timer will be restarted.
• external reset (EXT_RST): the RTC memory does not change; the register of the RTC
timer counts from zero.
• watchdog reset: the RTC memory does not change; the register of the RTC timer
does not change.
•
system_restart: the RTC memory does not change; the register of the RTC timer
does not change.
• Power on: the value of the RTC memory is random; the register of the RTC timer
counts from zero.
•
CHIP_EN reset: the value of the RTC memory is random; the register of the RTC
timer counts from zero.
For example, if the returned value of system_get_rtc_time is 10 (indicating 10 RTC
cycles), and the returned value of system_rtc_clock_cali_proc is 5.75 μs (indicating
that the duration of one RTC cycle is 5.75 microseconds), then the real time will be
10x5.75 = 57.5 microseconds.
rtc_t=system_get_rtc_time();
cal=system_rtc_clock_cali_proc();
os_printf("cal:%d.%d\r\n",((cal*1000)>>12)/1000,((cal*1000)>>12)%1000);
Read and write RTC memory. Please note that RTC memory access must be four-byte
aligned.
typedefstruct{
uint64time_acc;
uint32magic;
uint32time_base;
}RTC_TIMER_DEMO;
system_rtc_mem_read(64,&rtc_time,sizeof(rtc_time));
2. Compile the application program, generate firmware and download it into the ESP8266
module.