Open courtens opened 3 years ago
I replaced defined(ARDUINO_ARCH_AVR)
with defined(ARDUINO_ARCH_AVR) || defined(ARDUINO_ARCH_SAMD)
.
Now I am getting:
error: 'MAX_STEPPER' was not declared in this scope
FastAccelStepper* _stepper[MAX_STEPPER];
MAX_STEPPER is defined in FastAccelStepper\src\RampGenerator.h as:
#if defined(TEST)
#define MAX_STEPPER 2
#define TICKS_PER_S 16000000L
#elif defined(ARDUINO_ARCH_AVR) || defined(ARDUINO_ARCH_SAMD)
#if defined(__AVR_ATmega328P__)
#define MAX_STEPPER 2
#elif defined(__AVR_ATmega2560__)
#define MAX_STEPPER 3
#endif
#define TICKS_PER_S F_CPU
#elif defined(ARDUINO_ARCH_ESP32)
#define MAX_STEPPER 6
#define TICKS_PER_S 16000000L
#else
#define MAX_STEPPER 6
#define TICKS_PER_S 16000000L
#endif
so I also I replaced defined(__AVR_ATmega2560__)
with defined(__AVR_ATmega2560__) || defined(ARDUINO_ARCH_SAMD)
.
and also tried defined(__AVR_ATmega328P__)
with defined(__AVR_ATmega328P__) || defined(ARDUINO_ARCH_SAMD)
instead --- but got stuck. I don't know enough about Timers.
The Seeeduino runs at 48MHz
From the datasheet the Seeduino Xiao could drive three steppers:
Three 24-bit Timer/Counters for Control (TCC), with extended functions: • Up to four compare channels with optional complementary output • Generation of synchronized pulse width modulation (PWM) pattern across port pins
But it is quite an effort to implement. If there are a couple of comments wanting this chip to be supported, then I will look into it. So I keep it open, for others to register their wish. A patch (MIT licensed) would be welcomed, too
Thank you -- very much appreciated!
I would need to drive just one stepper (... if that helps.)
I am still new to the github concept and I am not sure what this would entail: "A patch (MIT licensed) would be welcomed, too"; I plan on using it privately, and found FlexyStepper to do the job for now. It would be nice if I could run it faster so I can use 1/8 or 1/16 steps.
You are in so much luck....I'm not sure what the seeduino xiao is, (duh, its in your title) but I'm still not sure how much it is like the DUE/SAM8x3e. Might have to change the ifdefs a bit to exclude certain ARDUINO_ARCH_SAM boards..., but I'm pretty close to forking/committing/pull-requesting Due support. You're addition of ARDUINO_ARCH_SAM makes me wonder.
I didn't look too closely at the full line. My code is using the PWM generator peripheral, not synchronous, to generate up to 8 channels...but not all pins are easily accessible, and some share functions with other pins you're likely to want. I arbitrarily capped it at 6. gin66 is correct, this was a non-trivial effort. It probably would have been easier for him, and I suspect he will need to "fix" some of my code (or tell me what to fix).
I chose NOT to use the timers because I need them to read servo PWM signals. It looks like those timers have a rise time capture, as well as a fall time capture, so no ISR delay on pulses that are synchronous and end within a few microseconds of one another. I'm working pretty hard to get this committed tonight....as evident by the fact I just registered a github account (I havent had need/want to contribute/collaborate until very recently). Anyhow, off to fork...
You can give my fork a shot and see if it works...I didn't look at the datasheet for the SAMD21G18, so I honestly have no idea. https://github.com/clazarowitz/FastAccelStepper
So, I did just have a look at the data sheet for the SAMD21G18. Sorry, my fork will definatly not work. The M0 and M3 from atmel are just too different. Looks like my #defines will need to be updated. ARDUINO_ARCH_SAM is far too broad.
Is this library compatible with my Seeeduino XIAO? It is a SAMD21G18 Cortex-M0+ chip.
This is what I get trying to run
UsageExample.ino
: