In the Arduino IDE I know you can select two different pin numbering schemes:
'By Arduino Pin (default)'
'By GPIO number (legacy)'
I found that if I defined the step pin as the GPIO number and the dir and CS pins as the Nano pin numbers I could move the motors individually with the default pin numbering scheme. I could add more motors and move them together however when I added one of the motor definitions nothing would work. It was like I was overwriting the other pin definitions but that couldn't have been the case as they had different pin definitions.
I then tried it in Platformio as the latest version of the library is not available from the Arduino Library manager for some reason. All of the motors would work if I added the DRIVER_RMT setting to each stepper's definition: engine.stepperConnectToPin(STEP_X_PIN, DRIVER_RMT). I don't really know what this setting does but at least it seemed to be working.
This was with defining the direction pin as the Arduino Nano pin number not the ESP32 chip's pin number however - not what the library requires.
What is going on here? I just want to be able to reliably define my pins. It is so frustrating.
The "working" pin definitions are below. The Z motor was the motor that would apparently 'overwrite' the other motor definitions.
never used that lib before but looking into the source, it's using pinMode and digitalWrite on the dir pin, so i'm not so sure about that info you got..
The owner of the library told me on a Github issue I raised that "FastAccelStepper assumes, the pin numbers for step and dir to be the gpio-values as espressif32 is using it".
I can only get it to work if I define the dir and CS pins as the Arduino Nano pin numbers and the step pin as the ESP32 GPIO pin number. I also had to add this driver setting to each stepper's definition as mentioned in the original post: engine.stepperConnectToPin(STEP_X_PIN, DRIVER_RMT). I had to switch over to Platformio as the Arduino Library Manager doesn't have the latest versions of the library and I couldn't add this driver setting on older versions of the library.
It is confusing that it only works with a mix of pin numbering schemes. I couldn't get it to work by defining all pins as the Nano pin numbers (with the default pin numbering scheme) or defining all pins as the ESP32 GPIO pin numbers (and using the GPIO legacy pin numbering scheme).
What is going on in the background? How does the Arduino IDE or Platformio know which pin numbering to use?
so yeah, looks like it's using gpio numbers..
I think they were rather rude to you, sorry about that..
you can still use Arduino, pretty easy to manually install a lib..
would take a dive into the core to see..
i'll look in a little bit, let you know what I find..
Sorry for the late reply @hama7 . I see you have researched this a lot, but still, please try the following setup and let me know if this solves the issue:
Use the latest Arduino IDE (2.x)
Make sure to choose the Arduino ESP32 Boards package by Arduino in the Boards Manager, not the one by Espressif Systems
In the IDE, select Tools -> Pin Numbering -> By GPIO number (legacy)
In your sketch, use pin labels and not numbers everywhere. For example,
#define DIR_X_PIN D18 // Nano pin number
#define CS_X_PIN D8 // Nano pin number
(note the extra D). To be clear, these labels refer to the Nano pinout and your board PCB markings.
This should make the library work without issues. Let us know your results!