Search found 2 matches

by zmlee79
Wed Aug 04, 2021 4:31 am
Forum: General Discussion
Topic: The esp32 timer drifted over half an hour in the course of 10 hours (in deep sleep). Is this normal?
Replies: 3
Views: 6473

Re: The esp32 timer drifted over half an hour in the course of 10 hours (in deep sleep). Is this normal?

In my tests on some devices, after entering the deep-sleep mode, the frequency of RTC_CAL_8MD256 is reduced by about 6%. By calibrating the error between the sleep mode and the actual time, before entering the sleep mode const double clockRate = 1.06; // Each device needs to be calibrated independen...
by zmlee79
Tue Feb 09, 2021 4:18 pm
Forum: ESP-IDF 中文讨论版
Topic: 求助!如何在ESP32上获得一个微妙级延时
Replies: 7
Views: 25097

Re: 求助!如何在ESP32上获得一个微妙级延时

esp32 上有 __rdtsc(), 不用计时器就可用很精确的延时, 特别是关掉中断的时候超级准, 像这样 跑 240M 的时候 delay_clock(240) 就是一微秒, 我经常用这个来延时 0.1 微秒用 。。 static __inline void delay_clock(int ts) { uint32_t start, curr; __asm__ __volatile__("rsr %0, ccount" : "=r"(start)); do __asm__ __volatile__("rsr %0, ccount" : "=r"(curr)); while (curr - ...