Page 1 of 2

Need API support to provide micro seconds delay

Posted: Tue Jun 20, 2017 5:48 pm
by Ritesh
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.

Re: Need API support to provide micro seconds delay

Posted: Tue Jun 20, 2017 9:59 pm
by kolban
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.

Re: Need API support to provide micro seconds delay

Posted: Wed Jun 21, 2017 12:56 am
by Ritesh
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.
Hi,

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.

Re: Need API support to provide micro seconds delay

Posted: Wed Jun 21, 2017 1:36 am
by ESP_Sprite
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

Posted: Wed Jun 21, 2017 2:00 am
by Ritesh
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.
Hi,

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.

Re: Need API support to provide micro seconds delay

Posted: Wed Jun 21, 2017 2:09 am
by ESP_Sprite
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

Posted: Wed Jun 21, 2017 2:40 am
by Ritesh
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.
Hi,

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.

Re: Need API support to provide micro seconds delay

Posted: Thu Jul 13, 2017 12:39 pm
by jakkubu
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

Re: Need API support to provide micro seconds delay

Posted: Wed Aug 09, 2017 3:56 am
by Ritesh
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
Hi,

Sorry for late reply.

Yes. We have ported that stuff using RMT Interface and it works fine without any issue.

Re: Need API support to provide micro seconds delay

Posted: Mon Aug 21, 2017 8:23 pm
by kearins
Ritesh wrote: Yes. We have ported that stuff using RMT Interface and it works fine without any issue.
Hi, Ritech, could I put an eye on your ported version of onewire.c?