Hello everyone, in a simple project with delay ms, when I only try to use delay between 1ms and 9ms the delay is wrong. However if I use delay us and delay s, no problem.
Only is for information of issue.
Thanks.
Wrong delay when use "delay ms" ESP32
-
- Posts: 10
- http://meble-kuchenne.info.pl
- Joined: Sat Dec 05, 2020 6:34 pm
-
- Valued Contributor
- Posts: 457
- Joined: Mon Dec 07, 2020 1:00 pm
- Has thanked: 82 times
- Been thanked: 246 times
Re: Wrong delay when use "delay ms" ESP32
This is due to the fact that the delay_mS resolution is limited by the RTOS tick period.
(RTOS has some advantages, some disadvantages
delay_uS does not allow other tasks to run, it just consumes CPU cycles
(RTOS has some advantages, some disadvantages

delay_uS does not allow other tasks to run, it just consumes CPU cycles
-
- Posts: 10
- Joined: Sat Dec 05, 2020 6:34 pm
Re: Wrong delay when use "delay ms" ESP32
Please, look this picture, there you can see what happen with delay_ms wrong between 1ms and 9 ms.
Thanks.
Thanks.
- Attachments
-
- SIMPLY PROJECT DELAY FC9 ESP32
- DELAYS FC9 ESP32.JPG (78.35 KiB) Viewed 13132 times
-
- Matrix Staff
- Posts: 1936
- Joined: Mon Dec 07, 2020 10:06 am
- Has thanked: 506 times
- Been thanked: 688 times
Re: Wrong delay when use "delay ms" ESP32
Hello,
Many thanks for reporting this. Are millisecond delays of 10ms and over ok?
I'll see if there is an easy way for us to fix this in the code.
Many thanks for reporting this. Are millisecond delays of 10ms and over ok?
I'll see if there is an easy way for us to fix this in the code.
Regards Ben Rowland - MatrixTSL
Flowcode Online Code Viewer (Beta) - Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel
Flowcode Online Code Viewer (Beta) - Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel
-
- Posts: 10
- Joined: Sat Dec 05, 2020 6:34 pm
-
- Matrix Staff
- Posts: 1936
- Joined: Mon Dec 07, 2020 10:06 am
- Has thanked: 506 times
- Been thanked: 688 times
Re: Wrong delay when use "delay ms" ESP32
Aha thanks I've now made a change via the update system that hopefully will help.
Let us know how you get on.
Let us know how you get on.
Regards Ben Rowland - MatrixTSL
Flowcode Online Code Viewer (Beta) - Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel
Flowcode Online Code Viewer (Beta) - Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel
-
- Posts: 10
- Joined: Sat Dec 05, 2020 6:34 pm
-
- Posts: 797
- Joined: Thu Dec 03, 2020 8:25 pm
- Location: Denmark
- Has thanked: 686 times
- Been thanked: 177 times
Re: Wrong delay when use "delay ms" ESP32
Hi ben (hope it´s ok I ask now flowmaria?)
Seem that timing is ok now. But now I am even not possible to program the chip. And it´s the same program as first used.
Seem that timing is ok now. But now I am even not possible to program the chip. And it´s the same program as first used.
- Attachments
-
- IliEsp).fcfx
- (13 KiB) Downloaded 776 times
-
- IliEsp).msg.txt
- (4.29 KiB) Downloaded 751 times
-
- Posts: 797
- Joined: Thu Dec 03, 2020 8:25 pm
- Location: Denmark
- Has thanked: 686 times
- Been thanked: 177 times
Re: Wrong delay when use "delay ms" ESP32
Me again!
I tryed to make a new project..............................
And yes, now Ili9341 work with ESP32
I work, but when I compare the speed of update with other Arduino project, it´s a little low, but ok. I though the ESP32 processor is very fast.
But finally, succes.
Br jorgen
I tryed to make a new project..............................


I work, but when I compare the speed of update with other Arduino project, it´s a little low, but ok. I though the ESP32 processor is very fast.
But finally, succes.

Br jorgen
-
- Matrix Staff
- Posts: 1936
- Joined: Mon Dec 07, 2020 10:06 am
- Has thanked: 506 times
- Been thanked: 688 times
Re: Wrong delay when use "delay ms" ESP32
Hi Jorgen,
Great news
Here is a similar topic on Espressif forums. We will keep looking for optimisations but it could be that raw IO bit toggling is just not very efficient on ESP devices.
https://www.esp32.com/viewtopic.php?t=1595
I have a plan to implement the RMT peripherals on the device which should allow for hardware driven fast comms. This will help to allow things like WS2812B and 1-Wire components to function but may also be useful for GLCDs. Hardware SPI might also be a good option.
Great news

The ESP processor is very fast but it seems the IO is not. I have done a bit of hacking away at the ESP IDF toolchain already to strip away some layers and this sped up the IO a fair bit but it's still a bit slow when compared to other MCUs.I work, but when I compare the speed of update with other Arduino project, it´s a little low, but ok. I though the ESP32 processor is very fast.
Here is a similar topic on Espressif forums. We will keep looking for optimisations but it could be that raw IO bit toggling is just not very efficient on ESP devices.
https://www.esp32.com/viewtopic.php?t=1595
I have a plan to implement the RMT peripherals on the device which should allow for hardware driven fast comms. This will help to allow things like WS2812B and 1-Wire components to function but may also be useful for GLCDs. Hardware SPI might also be a good option.
Regards Ben Rowland - MatrixTSL
Flowcode Online Code Viewer (Beta) - Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel
Flowcode Online Code Viewer (Beta) - Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel