Hi again
I finally wrote a quick and dirty code to test micros() versus HighPrecTimer.
It performs 10000 calls to micros() and same thing to HPrecTimer.
Here is the result :slight_smile:
micros() has a 50ns overhead compared to High Precision Timer call. It is only a delay not a jitter or a lack… Answer from freedom2000 on community.simplefoc.com
GitHub
github.com › peufeu2 › ESP32FastMillis
GitHub - peufeu2/ESP32FastMillis: Faster millis() and micros() for ESP32 and AceRoutine · GitHub
The fix is simple: ESP32 has timers with hardware predividers, so this small piece of code just sets up TIMG0_T0 to run on 1 MHz, dividing APB clock by 80. Then, micros() is just two instructions to read the 32-bit micros value from the timer.
Author peufeu2
SimpleFOC Community
community.simplefoc.com › t › possible-bug-with-esp32-micros-function › 122
Possible "bug" with ESP32 micros() function - SimpleFOC Community
September 16, 2020 - Hi all, Being aware of the following bug with micros() function in ESP32 arduino, I have jumped into the FOCutils.cpp file and seen that the bug is probably called ☹ The bug is explained here: https://github.com/espressif/arduino-esp32/issues/1168 Trust me micros() is not reliable with ESP32.
micros() & delayMicroseconds() not good enough
There was an error while loading. Please reload this page · Calling micros() twice is in a row, takes nearly 50uS More on github.com
Measuring pulse duration more accurately with ESP32
Hi everyone, I would like to measure a pulse duration of 32us (4 clock cycles at 125kHz). Therefor I set an interrupt on the according pin. The interrupt is triggered with the rising and falling edge and store the start & endtime with the funktion micros() in two diffrent variables. More on forum.arduino.cc
ESP32 micros() bug
On ESP32, micros() takes about 150 cycles. More on github.com
Troubles using micros()/millis() form esp-idf
Hardware: Board: ESP32 DEVKITV1 Core Installation/update date: 25/apr/2018 IDE name: Arduino IDE/IDF component Flash Frequency: 80Mhz Upload Speed: 115200 Description: micros() returns strange valu... More on github.com
Videos
Read and write text files on microSD with ESP32
12:01
ESP32 Da Zero a Robot - Modulo 1 Lezione 1 - YouTube
18:27
How to start develop micro-ROS on ESP32 quickly! - YouTube
Micros - ESP32 MicroPython framework for web frontend and ...
11:26
MicroROS Implementation with ESP32 Publisher: Arduino IDE Tutorial ...
SparkFun Electronics
sparkfun.com › sparkfun pro micro - esp32-c3
SparkFun Pro Micro - ESP32-C3 - SparkFun Electronics
SparkFun Pro Micro - ESP32-C3
This SparkFun Pro Micro crams the powerful ESP32-C3, a single-core RISC-V powerhouse with 400KB of SRAM, into a compact 1.3in. x 0.7in. board.
Price $10.25
GitHub
github.com › espressif › arduino-esp32 › issues › 282
micros() & delayMicroseconds() not good enough · Issue #282 · espressif/arduino-esp32
March 23, 2017 - Calling micros() twice is in a row, takes nearly 50uS. Something line: uint32_t t0 = micros(); uint32_t t1 = micros(); uint32_t delta_t = t1 - t0; printf( "Delta = %u\n", delta_t ); // this prints around 51 on my system. Looking at the i...
Author espressif
Hi again
I finally wrote a quick and dirty code to test micros() versus HighPrecTimer.
It performs 10000 calls to micros() and same thing to HPrecTimer.
Here is the result :slight_smile:
micros() has a 50ns overhead compared to High Precision Timer call. It is only a delay not a jitter or a lack… Answer from freedom2000 on community.simplefoc.com
ESP32 Forum
esp32.com › viewtopic.php
how to SET esp_timer_get_time() ? - ESP32 Forum
unsigned long IRAM_ATTR micros() { return (unsigned long) (esp_timer_get_time()); } How can i solve this, without hacking the library? Is there a way to add an offset by app to esp_timer_get_time()? - Perhaps by using a wake stub, which adds a sleep time offset immediately after wake up? - Or is there a way to overwite the micros() function of arduino-esp32 with a customized version?
Wikipedia
en.wikipedia.org › wiki › ESP32
ESP32 - Wikipedia
4 days ago - These chips feature a variety of processing options, including the Tensilica Xtensa LX6 microprocessor available in both dual-core and single-core variants, the Xtensa LX7 dual-core processor, or a RISC-V microprocessor. In addition, the ESP32 incorporates components essential for wireless ...
Arduino Forum
forum.arduino.cc › projects › programming
Measuring pulse duration more accurately with ESP32 - Programming - Arduino Forum
May 31, 2022 - Hi everyone, I would like to measure a pulse duration of 32us (4 clock cycles at 125kHz). Therefor I set an interrupt on the according pin. The interrupt is triggered with the rising and falling edge and store the start & endtime with the funktion micros() in two diffrent variables.
YouTube
youtube.com › hollanda academy
Mastering Time Control on ESP32: millis and micros Explained | Arduino IDE Tutorial - YouTube
Description:🚀 Unlock the power of time control in your ESP32 projects! In this comprehensive tutorial, I walk you through the usage of Time Delay, millis(),...
Published October 10, 2021 Views 887
Mechatronics LAB
mechatronicslab.net › home › lessons › esp32 arduino programming handbook › chapter 12: timers, delays & interrupts › using micros() for esp32 arduino programming
Using micros() for ESP32 Arduino Programming - Mechatronics LAB
What Is micros() and Why Use It? The micros() function tells you how many microseconds have passed since the ESP32 started running. It’s like having an ultra-fast stopwatch in your program.
GitHub
github.com › pstolarz › OneWireNg › issues › 38
ESP32 micros() bug · Issue #38 · pstolarz/OneWireNg
March 12, 2022 - On ESP32, micros() takes about 150 cycles. I'm using 80MHz CPU clock to avoid wasting power, delayMicroseconds() calls micros() at least twice. This means delayMicroseconds() takes at least 330 cycles, corresponding to a delay of more th...
Author pstolarz
ESP32 Forum
esp32.com › viewtopic.php
Wait microsecond - ESP32 Forum
Hi All, Please let me know if anyone has achieved this type of micro seconds delay support in application firmware. I need 10 and 40 microseconds delay support as per request. ... The arduino-esp32 core achieves this using the following code for the delayMicroseconds() func.
GitHub
github.com › espressif › arduino-esp32 › issues › 1357
Troubles using micros()/millis() form esp-idf · Issue #1357 · espressif/arduino-esp32
April 26, 2018 - Board: ESP32 DEVKITV1 Core Installation/update date: 25/apr/2018 IDE name: Arduino IDE/IDF component Flash Frequency: 80Mhz Upload Speed: 115200 · micros() returns strange values when using arduino-esp32 as component of esp-idf, millis() returns ...
Author espressif
Hackster
hackster.io › news › sparkfun-s-pro-micro-range-gets-a-little-riscier-with-the-new-pro-micro-esp32-c3-risc-v-dev-board-054dd5983dd1
SparkFun's Pro Micro Range Gets a Little RISCier with the New Pro Micro ESP32-C3 RISC-V Dev Board - Hackster.io
March 20, 2026 - As you'd expect from an ESP32, there's wireless connectivity: single-band IEEE 802.11b/g/n Wi-Fi plus Bluetooth 5 Low Energy (BLE) with Bluetooth Mesh support, the radios for both of which share a single on-board antenna. The module's various features are then brought out to castellated pin headers in the Pro Micro format, with 22 user-accessible general-purpose input/output (GPIO) pins and SPI, UART, I2C, I2S buses, a TWAI controller compatible with CAN 2.0, and pulse-width modulation (PWM) plus analog to digital converter (ADC) pins.
Reddit
reddit.com › r/arduino › sub microsecond delays on esp32
r/arduino on Reddit: Sub microsecond delays on esp32
December 18, 2021 -
Do I have to write instructions in assembly? Im using Arduino IDE and im trying to sample a signal at 44.1khz. I come from a PIC Micro background where I would just use a TMR. Whats the play here in Arduino Land?
Top answer 1 of 2
2
I have several ESP's and haven't used them due to my confusion about Timer hardware. I would want a Timer Interrupt for the task you describe. This discussion on sub-microsecond ESP timing seems well worth reading FYI If ESP Timers prove problematic, then I like your assembler-delay idea. It should be something you could tweak for the desired result -- if you have a way to write and load assembler to the ESP. hth, gl
2 of 2
2
Hmm I just did a search for "ESP32 asm code blocks" hoping that youmight be able to just place an __asm { blah } code block in the C/C++ but did not find it. But I did see people saying that just finding good docs on the assembly instructions themselves was difficult. One person I saw in this thread did have an Arduino project using asm for the Xtensa but it looks like it's less than straightforward. Most optimized C is hard to optimize much further without really knowing the ins and outs of the instructions, which seems difficult to ascertain? ripred edit: This guy has some serious digital audio chops and has created some seriously cool walkie talkies just out of ESP32's and I think making use of DMA. I just looked at it and I know he is getting 44kHz mono for his SD card audio recorder . I wouldn't be surprised if he's improved it to stereo. That might be close to what you're looking for?
Arduino
docs.arduino.cc › language-reference › en › functions › time › micros
micros() | Arduino Documentation
June 5, 2025 - This function returns the number of microseconds since the Arduino board began running the current program.
Top answer 1 of 7
2
Hi again
I finally wrote a quick and dirty code to test micros() versus HighPrecTimer.
It performs 10000 calls to micros() and same thing to HPrecTimer.
Here is the result :slight_smile:
micros() has a 50ns overhead compared to High Precision Timer call. It is only a delay not a jitter or a lack…
2 of 7
0
That bug was fixed a few years ago. I’ve not seen any strangeness.
SparkFun Electronics
sparkfun.com › sparkfun thing plus - esp32 wroom (micro-b)
SparkFun Thing Plus - ESP32 WROOM (Micro-B) - SparkFun Electronics
SparkFun Thing Plus - ESP32 WROOM (Micro-B)
This Feather-compatible ESP32 board features dual-core processing, WiFi, Bluetooth, a micro-B USB port, and a plug-and-play Qwiic connector.
Price $24.95