XIAO ESP32C2 ~5 ms pause/freeze every 2 seconds

Hmmm, been trying to get FastAccelStepper to work with my C6 and struggling. I tried this trivial example and the behavior is decidedly odd:

#include "FastAccelStepper.h"
#include "pins_arduino.h"
#include "fas_arch/common_esp32.h"
#include "fas_arch/common_esp32_idf5.h"

#define dirPinStepper    D0
#define stepPinStepper   D1

FastAccelStepperEngine engine = FastAccelStepperEngine();
FastAccelStepper *stepper = NULL;

void setup() {
   engine.init();
   stepper = engine.stepperConnectToPin(stepPinStepper);
   if (stepper) {
      stepper->setDirectionPin(dirPinStepper);
      stepper->setAutoEnable(true);

      stepper->setSpeedInHz(500);       // 500 steps/s
      stepper->setAcceleration(100);    // 100 steps/s²
      stepper->move(1000);
   }
}

void loop() {}

The motor starts very slowly, almost immediately chatters forward and backward for maybe a couple hundred ms, then accelerates to a moderate speed, then stops entirely for maybe a hundred ms, then restarts at the previous speed and decelerates at the same rate as the acceleration. ā€œOK, that’s just because it’s going for only 1000 steps,ā€ I thought, so I increased the move from 1000 to 9999 and tried again. The motor just ramped to the same speed as before, then sat there still for a longer period (I didn’t time it, but I’m quite sure it was the time needed to get up to 4999 and then back down), and then restarted and decelerated as before. Like I said, very odd.

I tried specifying the use of the DRIVER_RMT,
stepperMain = engine.stepperConnectToPin(stepPinStepper, DRIVER_RMT); but that fails during compilation with a ā€œā€˜DRIVER_RMT’ was not declared in this scopeā€ error.

Wheels are spinning in sand, but my motor isn’t spinning as intended. :confused:

Ideas welcome, drinking optional.

1 Like

Hi there,

So I’m seeing the RMT isn’t fully supported on the C6 it has different timing, Again S3 is your man on this … LEDc is all that supported now , with PWM on the C6 .try switching BSP’s but I 'm skeptical . the first one may be the only one that works , something about a Macro compatibility

The AI has it this way, Unfortunately…
The user’s example sketch compiles and runs, and the stepper does move… but with weird behavior:

  • Starts slowly
  • Chatters
  • Pauses mid-move
  • Ramps again

This matches known issues when FastAccelStepper is not correctly configured for:

  1. The C6’s timing architecture
  2. Driver backend not being set explicitly
  3. Missing RMT support

:rotating_light: Root Problems

1. ESP32-C6 is not fully supported by FastAccelStepper

  • As of now, the FastAccelStepper library doesn’t have official support for ESP32-C6.
  • The library has backends like DRIVER_RMT and DRIVER_TMC2209_UART, but DRIVER_RMT depends on ESP32’s RMT peripheral — not yet ported or tested on the C6 in this library.

2. The macro DRIVER_RMT is undefined

  • That’s why this fails:
stepperMain = engine.stepperConnectToPin(stepPinStepper, DRIVER_RMT);
  • It fails because on ESP32-C6, the fas_arch layer doesn’t define DRIVER_RMT, nor does it map to the correct timing system (ledc, mcpwm, or rmt).

3. The default fallback step timing engine may glitch

  • When no specific driver is selected, the engine might default to a bit-banged or partially timed loop, which behaves erratically under load or without tight control of FreeRTOS tasks.

:hammer_and_wrench: Recommendations

:white_check_mark: Quick Fix: Try Slower, Simpler Step Timing

Until the C6 is fully supported by FastAccelStepper, consider:

  • Lower setSpeedInHz() to 100–200 Hz
  • Use a delay() between moves
  • Try stepper->runForward(); for continuous movement and test stability

:white_check_mark: Use LEDC Instead of RMT

The ESP32C6 has LEDC PWM but limited RMT channels, and RMT driver usage differs from ESP32/S3. Consider:

  • Switching to LEDC-based PWM using a manual stepper library like AccelStepper (with LEDC under the hood)

:white_check_mark: Migrate to the ESP32-S3

If he needs:

  • RMT support
  • Known working FastAccelStepper
  • Full peripheral support

Then the ESP32-S3 is a better choice. The FastAccelStepper community has confirmed working setups on ESP32 and S3, not C6 (yet).

HTH
GL :slight_smile: PJ :v:

Mailman can’t get there fast enough :grin:

No joke! Seeed claims the S3 shipped today… and to my shock USPS says they have it! We’ll see! I have thumb surgery at the beginning of July and my left thumb will be 100% out of commission for 10 weeks, followed by months of PT. Getting this project done beforehand isn’t critical, but it sure would be nice!

:crossed_fingers::crossed_fingers::crossed_fingers:

@JFSinSF - No need for an S3, the C6 works fine.

The issue is with a piece of code in the Arduino framework that yields if only one core is active.

Just put your stepper code in a separate task on the second core.

RMT works fine on the C6 as well. I use it for a ā€œbeeperā€.

Hi there,

Yea , so I should clarify… buzers etc. sure… the C6 supports the RMT peripheral (it’s just slightly different from S3/ESP32 classic). If configured correctly in the SDK or ESP-IDF layer, it’s usable for waveform generation (buzzers, IR, step pulses, etc).

also further clarification.
The FastAccelStepper library currently has limited or no full support for the ESP32-C6 Arduino platform out of the box.

  • The DRIVER_RMT not being defined is a sign the library wasn’t compiled with proper C6 support macros or files.
  • If the C6 is not explicitly supported in fas_arch, you’ll run into missing defines or incompatible peripheral mappings.

But out of the box, without adjustments or a solid understanding of C6 architecture, the S3 is a more straightforward choice because:

  • It’s better supported by libraries like FastAccelStepper.
  • Dual-core design avoids many Arduino-loop blocking issues.
  • More robust peripheral support (e.g., LEDC, MCPWM, RMT).

You can create a FreeRTOS task to handle stepping*:

  • Absolutely — moving stepper timing logic into a FreeRTOS task (with xTaskCreatePinnedToCore()) avoids interference from the loop() task or BLE/WiFi handlers.

The issue isn’t with the hardware, but rather how the Arduino layer handles loop execution and task scheduling. LOL, it doesn’t :grin:

anyway, may try the first BSP too…the C6 isn’t getting the full effort from espressif IMO.

HTH
GL :slight_smile: PJ :v:

1 Like

some process is definatly running in the background

I had another look at this and found that the AccelStepper and FastAccelStepper both work fine with the XIAO ESP32-C6.

I tried both 2 and 4 wire steppers as well… I don’t have a DRV8825 to test on my motors (I use my own drivers) but I don’t see why they should be different?

I didn’t see the 2 second ā€œglitchā€ and the code that it is caused by doesn’t end up in the compiled project?

I don’t see where that’s mentioned. I do see the C6 is supported however?

BSP’s isn’t an issue, C6 isn’t an issue… perhaps show your project wiring to see if there’s a hardware problem?

I dont understand how you can make such a blanket statement… The Board Support Package and the MCU do many untold configuration changes and setup options that only an AI could unwind… even the timing software or a simple multiplication or division equation can cause a delay… if-then statement… its all over… IMO

While the ESP32C6 is listed as being supported, in my (albeit very limited) experience it doesn’t (fully) work and is also listed as untested. I can’t prove a negative, but the S3 I have on order is scheduled to arrive on Tuesday and I’ll test it and see what happens. I’ll report back. Obviously if there are still problems then I think we can conclude the issues lie elsewhere, not unlikely between my ears.

1 Like

Hi there,

I think what we have here is a weird combo here.
Both could be true, If OP could post his compiler output the first 3 lines and the last 10 or so before the upload. We could check this further and more thorough. First is the BSP. it always is. WHY ? it’s provided by the manufacture (it there hardware). @grobasoz is correct about the arduino core and it’s support also plays the second major part to even build anything with it.
I don’t mean to infer that the issue doesn’t exist in it’s present code, or that it can’t be coded around. i’m saying OUT of the box I’m not convinced so much!
All one needs to do is look at the number of BSP’s for espressif in the boards TAB, LOL They don’t really want to support Arduino_IDE that’s why there core support is WEAK and getting weaker. One does not need to look further than NimBLE for example… What a disaster, but works perfect if you use the ESP_IDF …??
It’s a great area of discussion because each manufacture support is different. we all want all of it NOW :grin:
is it the Silicon? " the C6 " I would say it does make a difference at a minimum in performance it’s Apples and Oranges. IMO
Also is the C6 really Dual-core? some say YES, because of the LP-coprocessor. vs. the S3’s true Dual Extensa cores
" a high-performance (HP) processor with running up to 160 MHz , and a low-power (LP) 32-bit RISC-V processor, which can be clocked up to 20 MHz."
vs.
Xtensa LX7 dual-core, 32-bit processor running up to 240 MHz

In the TouchRing_BLE demo I posted you can use either MCU for the build ,with the S3 Very, Very Obvious in the response of the display and TouchScreen and BLE Faster to advertise and scan & connect is insanely fast. the C6 is notably slower in all of the above.
Just the Standalone TouchRing code (no radios, no BLE involved)
is easy to see even with extra ram the C6 is lower performance, just saying. (captain obvious here) :face_with_hand_over_mouth:
other than the onboard antenna, IMO the juice is NOT worth the Squeeze. So why is it the best for Zigbee, thread , and the others… Because why ? Espresso knows why? we can only speculate. What about all that stuff for the S3 too?

Good stuff, for sure.
these are just some personal views of it, I’m certainly no expert. So there’s that :crossed_fingers:

HTH
GL:-) PJ :v:

Since you are in a position to use another device then I agree it’s easier to go that route.

Unfortunately, my XIAO ESP32-C6 projects require the ability to use the ā€œstrangeā€ wireless networks like Zigbee, Openthread and Matter.

So I need to understand what’s causing the problem and either rectify or find a workaround solution.

I’m sure the S3 will be an excellent solution for you. I use them in a number of products and they are very capable!

1 Like

Best of luck with your project! I used an Arduino Nano Matter for a project that needed Thread capability and it was great. (That said, it didn’t have any critical timing requirements.) But for this project, I need something smaller.

1 Like

Hi all,
So as not to bury the lede, the S3 arrived today and works marvelously. With or without interrupts disabled, bit-banged, using AccelStepper, or using FastAccelStepper, everything is as close to flawless as I could hope. I never even pinned the task to one of the cores. It just worked. (There’s more testing to be done, but for now I’m happy to stick with the S3 for this project.)

But in response to the request for the output of the compiler, here it is in all its glory. S3 first, then C6.

ESP32S3 Compiler Output
Sketch uses 318882 bytes (9%) of program storage space. Maximum is 3342336 bytes.
Global variables use 21488 bytes (6%) of dynamic memory, leaving 306192 bytes for local variables. Maximum is 327680 bytes.
esptool.py v4.8.1
Serial port /dev/cu.usbmodem1101
Connecting…
Chip is ESP32-S3 (QFN56) (revision v0.2)
Features: WiFi, BLE, Embedded PSRAM 8MB (AP_3v3)
Crystal is 40MHz
MAC: d8:3b:da:45:56:e4
Uploading stub…
Running stub…
Stub running…
Changing baud rate to 921600
Changed.
Configuring flash size…
Flash will be erased from 0x00000000 to 0x00004fff…
Flash will be erased from 0x00008000 to 0x00008fff…
Flash will be erased from 0x0000e000 to 0x0000ffff…
Flash will be erased from 0x00010000 to 0x0005dfff…
Compressed 20208 bytes to 13058…
Writing at 0x00000000… (100 %)
Wrote 20208 bytes (13058 compressed) at 0x00000000 in 0.3 seconds (effective 569.2 kbit/s)…
Hash of data verified.
Compressed 3072 bytes to 146…
Writing at 0x00008000… (100 %)
Wrote 3072 bytes (146 compressed) at 0x00008000 in 0.1 seconds (effective 464.0 kbit/s)…
Hash of data verified.
Compressed 8192 bytes to 47…
Writing at 0x0000e000… (100 %)
Wrote 8192 bytes (47 compressed) at 0x0000e000 in 0.1 seconds (effective 728.5 kbit/s)…
Hash of data verified.
Compressed 319024 bytes to 172413…
Writing at 0x00010000… (9 %)
Writing at 0x0001bda5… (18 %)
Writing at 0x00028a20… (27 %)
Writing at 0x0002e143… (36 %)
Writing at 0x00033a4d… (45 %)
Writing at 0x00039420… (54 %)
Writing at 0x0003ea37… (63 %)
Writing at 0x000443b2… (72 %)
Writing at 0x00049cfe… (81 %)
Writing at 0x00054a14… (90 %)
Writing at 0x0005ac10… (100 %)
Wrote 319024 bytes (172413 compressed) at 0x00010000 in 2.3 seconds (effective 1132.3 kbit/s)…
Hash of data verified.

Leaving…
Hard resetting with RTC WDT…
-=-=-=-=-=-=-=-=-

ESP32C6 Compiler Output
Sketch uses 259465 bytes (19%) of program storage space. Maximum is 1310720 bytes.
Global variables use 14268 bytes (4%) of dynamic memory, leaving 313412 bytes for local variables. Maximum is 327680 bytes.
esptool.py v4.8.1
Serial port /dev/cu.usbmodem1101
Connecting…
Chip is ESP32-C6FH4 (QFN32) (revision v0.1)
Features: WiFi 6, BT 5, IEEE802.15.4
Crystal is 40MHz
MAC: e4:b3:23:ff:fe:ae:b2:14
BASE MAC: e4:b3:23:ae:b2:14
MAC_EXT: ff:fe
Uploading stub…
Running stub…
Stub running…
Changing baud rate to 921600
Changed.
Configuring flash size…
Flash will be erased from 0x00000000 to 0x00005fff…
Flash will be erased from 0x00008000 to 0x00008fff…
Flash will be erased from 0x0000e000 to 0x0000ffff…
Flash will be erased from 0x00010000 to 0x0004ffff…
Compressed 20624 bytes to 13135…
Writing at 0x00000000… (100 %)
Wrote 20624 bytes (13135 compressed) at 0x00000000 in 0.3 seconds (effective 486.7 kbit/s)…
Hash of data verified.
Compressed 3072 bytes to 146…
Writing at 0x00008000… (100 %)
Wrote 3072 bytes (146 compressed) at 0x00008000 in 0.1 seconds (effective 439.0 kbit/s)…
Hash of data verified.
Compressed 8192 bytes to 47…
Writing at 0x0000e000… (100 %)
Wrote 8192 bytes (47 compressed) at 0x0000e000 in 0.1 seconds (effective 642.6 kbit/s)…
Hash of data verified.
Compressed 259568 bytes to 146967…
Writing at 0x00010000… (11 %)
Writing at 0x0001bda0… (22 %)
Writing at 0x000231a5… (33 %)
Writing at 0x00029bdc… (44 %)
Writing at 0x000304c9… (55 %)
Writing at 0x000368bc… (66 %)
Writing at 0x0003c937… (77 %)
Writing at 0x00042a4d… (88 %)
Writing at 0x00048aac… (100 %)
Wrote 259568 bytes (146967 compressed) at 0x00010000 in 1.9 seconds (effective 1081.0 kbit/s)…
Hash of data verified.

Leaving…
Hard resetting via RTS pin…
-=-=-=-=-=-=-=-

At any rate, I’m happy. Thank you all for your help. grobasoz, best of luck with your project! I hope you get it all working.

John

1 Like

Thanks John, excellent result. Thanks for the update. Glad you got it working!

1 Like

Hi there,

:grin: Ah’ As I say the S3 never disappoints… Glad it’s working good too.
and just an FYI , Turn on the verbose output in the setting for the compiler and you’ll get some additional info to aid in troubleshooting. :+1:
i.e. the first 3 lines BSP that’s used to compile .

HTH
GL :slight_smile: PJ :v:

Ah, here you go:

ESP32S3:
FQBN: esp32:esp32:XIAO_ESP32S3
Using board ā€˜XIAO_ESP32S3’ from platform in folder: /Users/john_s/Library/Arduino15/packages/esp32/hardware/esp32/3.2.0
Using core ā€˜esp32’ from platform in folder: /Users/john_s/Library/Arduino15/packages/esp32/hardware/esp32/3.2.0

ESP32C6:
FQBN: esp32:esp32:XIAO_ESP32C6
Using board ā€˜XIAO_ESP32C6’ from platform in folder: /Users/john_s/Library/Arduino15/packages/esp32/hardware/esp32/3.2.0
Using core ā€˜esp32’ from platform in folder: /Users/john_s/Library/Arduino15/packages/esp32/hardware/esp32/3.2.0

1 Like