Page 1 of 1

Details of os_delay_us function

Posted: Thu Apr 17, 2025 7:44 am
by dn_1983
Hello.

I am a newbie at ESP.

I can't find verbose information about os_delay_us function.

Could somebody advise me about these questions:

1. Are the interrupts enabled during this function?
2. What is the accuracy of this delay?

Thank you.

Re: Details of os_delay_us function

Posted: Sun Apr 20, 2025 8:35 pm
by username
#include "esp_rom_sys.h"


esp_rom_delay_us(10); // Delay for 10 microseconds

Re: Details of os_delay_us function

Posted: Mon Apr 21, 2025 1:45 am
by Sprite
Also, interrupts are untouched in that routine (as in: if they were enabled before, they stay enabled during) and precision depends on if there is an interrupt or cache behaviour that takes away execution time. If that's not the case, it should be precise within a few CPU clock cycles.

Re: Details of os_delay_us function

Posted: Mon Apr 21, 2025 7:44 am
by dn_1983
Thank you for clarification.