IO pause every 2 seconds for roughly 5 ms

lordreas
Posts: 2
Joined: Tue Mar 14, 2023 11:35 pm

IO pause every 2 seconds for roughly 5 ms

Postby lordreas » Sun Feb 23, 2025 10:42 pm

Hi there,

I'm experiencing weird behavior in my step / dir signal generation code that I'm running on an ESP32 S2 (Adafruit feather).
For a minimum reproducible example, I generate constant velocity signals in a very simple loop:

Code: Select all

#define DIR_PIN 5
#define EN_PIN 6
#define STEP_PIN 9
void setup() {
  pinMode(DIR_PIN, OUTPUT);
  pinMode(EN_PIN, OUTPUT);
  pinMode(STEP_PIN, OUTPUT);
  digitalWrite(EN_PIN, LOW);
  digitalWrite(DIR_PIN, HIGH);
}

void loop() {
  digitalWrite(STEP_PIN, HIGH);
  delayMicroseconds(400);
  digitalWrite(STEP_PIN, LOW);
  delayMicroseconds(933);
}
tmp.jpg
tmp.jpg (42.31 KiB) Viewed 410 times
tmp2.jpg
tmp2.jpg (81.82 KiB) Viewed 410 times
But every 2 seconds, the output freezes for roughly 5 ms, leading to stuttering in the motor movement (see logic analyzer graph).
Interestingly, other users have reported similar issues on different ESP models and different projects:
https://forum.seeedstudio.com/t/xiao-es ... s/267707/7

I have also tried another S2, same problem. As this problem persists across chip models and projects of independent developers, I suspect a bug somewhere in the handling of the IO in the esp API. Does anyone have a clue what could be going on?

Any help is greatly appreciated!
Cheers,
lordreas

MicroController
Posts: 2661
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: IO pause every 2 seconds for roughly 5 ms

Postby MicroController » Mon Feb 24, 2025 3:07 am


Who is online

Users browsing this forum: ChatGPT-User and 7 guests