Basically this issue:
https://github.com/espressif/esp-idf/issues/10055
The ESP32S2 stalls every 2 seconds for 5ms.
This is very annoying when using it for a quadcopter with 2ms cycle time.
ESP32 and ESP8266 do not have that issue.
ESP32S2 stalling 5ms every 2seconds?
-
- Posts: 826
- Joined: Mon Jul 22, 2019 3:20 pm
Re: ESP32S2 stalling 5ms every 2seconds?
Without actual code demonstrating the issue, nobody is going to be able to help you. This is very likely a priority issue. Loop task runs at priority 1. Start a new task at priority 6 and put the led flash in that.
-
- Posts: 20
- Joined: Mon Sep 18, 2023 3:54 am
Re: ESP32S2 stalling 5ms every 2seconds?
The actual code is in the git link. It's:
The same code works glitch-free on the old esp32.
Could this be an internal usb thing?
Edit:
I did test moving it to "task1" at priority 1. No 5ms gaps there.
I do not understand it.
Is there a source where i can see the code calling loop() ?
Code: Select all
void loop() { debug_gpio = !debug_gpio; digitalWrite(MY_GPIO, debug_gpio); }
Could this be an internal usb thing?
Edit:
I did test moving it to "task1" at priority 1. No 5ms gaps there.
I do not understand it.
Is there a source where i can see the code calling loop() ?
-
- Posts: 1696
- Joined: Mon Oct 17, 2022 7:38 pm
- Location: Europe, Germany
Re: ESP32S2 stalling 5ms every 2seconds?
Yes: https://github.com/espressif/arduino-es ... in.cpp#L69PepeTheGreat wrote: ↑Thu Mar 28, 2024 9:02 pmIs there a source where i can see the code calling loop() ?
As you can see, the 'yieldIfNecessary()' is only used on single-core ("UNICORE") ESPs/builds, like the S2.
-
- Posts: 20
- Joined: Mon Sep 18, 2023 3:54 am
Re: ESP32S2 stalling 5ms every 2seconds?
TY
Explains it.
In the main Arduino loop, above loop() function, in the file cores/esp32/main.cpp we see yieldIfNecessary() function. It works on ESP32-S2 for example as it only has one core. Function adds a 5ms delay every two seconds. Under some specific circumstances, this causes problem with loop() execution time.
https://github.com/espressif/arduino-esp32/issues/6119
Edit:
Works perfectly since i moved the code to another priority 1 task.
Explains it.
In the main Arduino loop, above loop() function, in the file cores/esp32/main.cpp we see yieldIfNecessary() function. It works on ESP32-S2 for example as it only has one core. Function adds a 5ms delay every two seconds. Under some specific circumstances, this causes problem with loop() execution time.
https://github.com/espressif/arduino-esp32/issues/6119
Edit:
Works perfectly since i moved the code to another priority 1 task.
Who is online
Users browsing this forum: No registered users and 34 guests