Hi PJ, I’m having a similar issue with bit-banging stepper motor control to a DRV8825 driver using an ESP32C6 Seeed board. Every two seconds the motor pauses for a very short period and then runs again. I suspect it could be due to servicing of the radios except that a) the radios aren’t enabled in my code and b) the C6 is supposed to have two cores such that that sort of servicing can be handled without interrupting the application flow. I’d prefer to not have to resort to using the LEDC, RTM, or MCPWM since they won’t work with the library I hope to use (AccelStepper), so I’m hoping I can figure out why I’m seeing this problem.
To make sure the problem doesn’t stem from the library, I tried a trivially simple loop to run the motor at constant speed forever:
#include "pins_arduino.h"
// Define stepper motor connections and steps per revolution:
#define dirPin D0
#define stepPin D1
#define stepsPerRevolution 200
void setup() {
// Declare pins as output:
pinMode(stepPin, OUTPUT);
pinMode(dirPin, OUTPUT);
}
void loop() {
// Set the spinning direction clockwise:
digitalWrite(dirPin, HIGH);
// run
digitalWrite(stepPin, HIGH);
delayMicroseconds(1000);
digitalWrite(stepPin, LOW);
delayMicroseconds(1000);
}
This code still results in the every-two-seconds glitch (motor pauses momentarily and then restarts).
Do you have any thoughts to what might be the cause and how to fix it without resorting to the modules I mention above? Thanks!