Hi,
I need to set high a GPIO (digital out) for 25 microseconds and then put it down for 975 microseconds. It is microseconds and not milliseconds.
Could you give a example of code in (RTOS) C for ESP32 using the right lib?
I saw the blinky example, but it's based on milliseconds, and on callback functions for os_timer functions. Should we use "delay()" as we don't want the 25 microseconds to be interrupted. The 975 microseconds can be interrupted .
Thanks in advance,
Timer management with and without interrupt
-
- Posts: 9709
- Joined: Thu Nov 26, 2015 4:08 am
Re: Timer management with and without interrupt
What is the specific purpose of this? Do you need this single-shot or do you need to generate a continuous stream with these values? Either way, I think you may be best served by a peripheral; either the LED PWM generator or the RMT peripheral: they can both generate these signals independently of any interrupts.
Re: Timer management with and without interrupt
Hi Sprite_tm,
That will be streams of those logical high signals to control an Infra-red LED. I need microseconds level of high level.
PWM won't do the effect as the low state following the high logical state is very very long compared to 40 microseconds of high state.
Does "delay()" function work? Who can I make it in microseconds?
Cheers,
That will be streams of those logical high signals to control an Infra-red LED. I need microseconds level of high level.
PWM won't do the effect as the low state following the high logical state is very very long compared to 40 microseconds of high state.
Does "delay()" function work? Who can I make it in microseconds?
Cheers,
-
- Posts: 9709
- Joined: Thu Nov 26, 2015 4:08 am
Re: Timer management with and without interrupt
Hmm, we actually have a dedicated peripheral for exactly that purpose (the RMT peripheral). Unfortunately, there's not really any example code or documentation public for that... if you can wait until the ESP32 documentation is out, you can solve the problem in a really nice way.
You can try the esp_delay_us() function, but it will be imprecise because of interrupts etc; maybe it's good enough for this purpose.
You can try the esp_delay_us() function, but it will be imprecise because of interrupts etc; maybe it's good enough for this purpose.
Who is online
Users browsing this forum: No registered users and 162 guests