Page 1 of 1

IO pause every 2 seconds for roughly 5 ms

Posted: Sun Feb 23, 2025 10:42 pm
by lordreas
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 412 times
tmp2.jpg
tmp2.jpg (81.82 KiB) Viewed 412 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

Re: IO pause every 2 seconds for roughly 5 ms

Posted: Mon Feb 24, 2025 3:07 am
by MicroController