Using AccelStepper with ESP32C6 SOC (Seeed)

36 views
Skip to first unread message

John Sheets

unread,
Jun 13, 2025, 2:20:24 AMJun 13
to accelstepper

I’m having an issue with using AccelStepper to drive my motor through 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 on the C6 board 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’ve read a workaround for these types of pausing issues is to use one of the built-in modules in the SOC, such as the RTM or MCPWM, however AFAIK AccelStepper doesn't support that approach. 

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 and runs for two seconds, etc.).

Does anyone have and ideas how I might resolve this issue? Thanks!

Jim Larson

unread,
Jun 13, 2025, 2:26:13 PMJun 13
to accelstepper
Seems like the issue is with the ESP32 and Arduino, not with the AccelStepper library (since you don't even use it in your example). Perhaps someone with ESP32 experience can help?

Daniel Tremblay

unread,
Jun 13, 2025, 3:03:13 PMJun 13
to accelstepper
can it be the ESP32C6 board crashing and restarting?
you may setup serial output to monitor the board...


Daniel

gjgsm...@gmail.com

unread,
Jun 13, 2025, 6:48:25 PMJun 13
to accelstepper

Yes, it looks like as intended, you have isolated the issue to hardware and not the library. I don’t have any advice on this but I like Daniel’s suggestion because if it is a crash then the output could be helpful. If so, perhaps you could post it here as a matter of interest.

The Panic Handler will print the full crash output (panic message + registers + backtrace) to the console. You can then extract PC and backtrace addresses, and using addr2line with ELF file, decode addresses to source code lines.

Geoff

John Sheets

unread,
Jun 13, 2025, 6:57:41 PMJun 13
to accelstepper
Thanks all. The board isn't crashing. I'm following up on some other theories (from the Seeed Forum) that are hardware related. 

I should have been clearer in what I was looking for. Basically I'm looking for guidance on use the FUNCTION MotorInterfaceType with AccelStepper so that I can write a (hopefully) lightweight interface for the ESP's MCPWM. I've not been able to find info online about that feature, and the documentation on arspayce.com says it is "internal use only". If that's truly the case, I guess I'm SOL with this board, but I've confirmed another Seeed ESP board (ESP32S3) should work instead.

If anyone can point me to info on use of FUNCTION and the relevant APIs, I'd very much appreciate it!

Thanks,
John
Reply all
Reply to author
Forward
0 new messages