Hi,
As I have observed that vTaskDelay is working on Tick Rate which gives milliseconds delay for application development but I want to prove some microseconds delay in my application.
So is there any other API to provide that type of microseconds of delay?
Till Now, we have used ets_delay_us FreeRTOS API to get microseconds delay but that is not recommend to use.
So is there any other API to provide microseconds delay? We have 10 and 40 microseconds delay requirement for our application development purpose.
Let me know if anyone has any idea for that.
Need API support to provide micro seconds delay
Need API support to provide micro seconds delay
Regards,
Ritesh Prajapati
Ritesh Prajapati
Re: Need API support to provide micro seconds delay
You might want to take a look at gettimeofday(). Apparently (by reading the docs) it returns a time stamp down to the microsecond level. In principle, you could look around using gettimeofday until your interval has elapsed.
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32
Re: Need API support to provide micro seconds delay
Hi,kolban wrote:You might want to take a look at gettimeofday(). Apparently (by reading the docs) it returns a time stamp down to the microsecond level. In principle, you could look around using gettimeofday until your interval has elapsed.
Thanks for quick reply.
But actually it will not work in my case as I need continues 10 and 40 microseconds delay for my application till some duration like 3 to 4 minutes as per requirement.
So, I have tried gettimeofday API with 2 consecutive calls and I was getting difference as 13 to 14 microseconds which was again not fixed. So that way it can not be used as I need accurate 10 and 40 microseconds delay for my application.
Hope you understand my concern.
Regards,
Ritesh Prajapati
Ritesh Prajapati
-
- Posts: 9759
- Joined: Thu Nov 26, 2015 4:08 am
Re: Need API support to provide micro seconds delay
Can I ask what you are using this for? Are you trying to comfirm to some signalling spec or something? Asking because depending on the application, there may be more elegant (I2S, RMT, ...) ways to solve this.
Re: Need API support to provide micro seconds delay
Hi,ESP_Sprite wrote:Can I ask what you are using this for? Are you trying to comfirm to some signalling spec or something? Asking because depending on the application, there may be more elegant (I2S, RMT, ...) ways to solve this.
Actually, we have connected one module over UART with ESP32 chip in our product. So in that module, we need exact delay of 10 and 40 microseconds of delay interval in some interval to update firmware into that module using one wire communication over GPIO pins.
So, Normal communication with that module using ESP32 is UART but to upgrade firmware into that module we need to use one wire communication over GPIO pin toggling connected with ESP32.
That is why to toggle that GPIO with some particular interval, we need 10 and 40 microseconds of interval as per it's Firmware Update architecture.
Let me know if need any other information from my side.
Regards,
Ritesh Prajapati
Ritesh Prajapati
-
- Posts: 9759
- Joined: Thu Nov 26, 2015 4:08 am
Re: Need API support to provide micro seconds delay
Isn't it easier to use the RMT peripheral then? That peripheral is designed to send user-shaped pulse trains with high precision.
Re: Need API support to provide micro seconds delay
Hi,ESP_Sprite wrote:Isn't it easier to use the RMT peripheral then? That peripheral is designed to send user-shaped pulse trains with high precision.
I need to check that RMT interface. Here, we have only one wire GPIO pin to update firmware into connected module.
Please share example of RMT based interface as per my requirements. I will check into ESP32 examples for that as well.
Regards,
Ritesh Prajapati
Ritesh Prajapati
Re: Need API support to provide micro seconds delay
Hi. Did you manage to get it work?
In Nodemcu for esp32 (currently in development stage) they implement OneWire interface for esp32 using RMT. I plan to use it for DS18B20 since I don't like the idea of using delays for communication protocols.
NodeMCU OneWire implementation for esp32 - https://github.com/nodemcu/nodemcu-firm ... /onewire.c
In Nodemcu for esp32 (currently in development stage) they implement OneWire interface for esp32 using RMT. I plan to use it for DS18B20 since I don't like the idea of using delays for communication protocols.
NodeMCU OneWire implementation for esp32 - https://github.com/nodemcu/nodemcu-firm ... /onewire.c
Re: Need API support to provide micro seconds delay
Hi,jakkubu wrote:Hi. Did you manage to get it work?
In Nodemcu for esp32 (currently in development stage) they implement OneWire interface for esp32 using RMT. I plan to use it for DS18B20 since I don't like the idea of using delays for communication protocols.
NodeMCU OneWire implementation for esp32 - https://github.com/nodemcu/nodemcu-firm ... /onewire.c
Sorry for late reply.
Yes. We have ported that stuff using RMT Interface and it works fine without any issue.
Regards,
Ritesh Prajapati
Ritesh Prajapati
Re: Need API support to provide micro seconds delay
Hi, Ritech, could I put an eye on your ported version of onewire.c?Ritesh wrote: Yes. We have ported that stuff using RMT Interface and it works fine without any issue.
Who is online
Users browsing this forum: Google [Bot] and 147 guests