0

m0 Interrupt timer stepper control?
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

m0 Interrupt timer stepper control?

by AndyJar on Tue May 15, 2018 2:03 pm

Hey all! I'm wondering if it's possible to control a stepper driver (such as a StepStick or equivalent, which require STEP pulses) with the onboard timers of the m0 chip.

I ask because I'm trying to both write to an SPI OLED screen (via HW SPI) and drive a stepper at the same time--and I believe the timing of both is messing each other up. I can't get the stepper to behave either at all, or properly, and I'm thinking this may help.

Open to any and all suggestions!

AndyJar
 
Posts: 4
Joined: Wed Feb 03, 2016 2:30 pm

Re: m0 Interrupt timer stepper control?

by adafruit_support_mike on Wed May 16, 2018 12:24 am

The microcontroller can definitely handle the job.. it has three Timer/Counter for Control peripheral instances specifically designed for it.

Those features don't have wrappers in the Arduino libraries though. You'll need to dig into the datasheets and low-level code to find the registers that you need to set for the kind of output you want to produce.

The SAMD21 datasheet is here:

https://www.adafruit.com/images/product ... asheet.pdf

and the best place to start looking in the code will be the file wiring_analog.c from the board support package:

https://github.com/adafruit/ArduinoCore ... g_analog.c

adafruit_support_mike
 
Posts: 53119
Joined: Thu Feb 11, 2010 2:51 pm

Please be positive and constructive with your questions and comments.