Is it viable to control a stepper motor driectly from a jetson nano

I’m looking to control 2 stepper motors for a robotic application.
And I was wondering if the jetson nano is up to the task of outputting the required stepping frenquency directly.

The freqeuncy I need is 32Khz (though more is better).
this is of course too much for the python GPIO lib.

But i saw a couple threads on relevant topics mentioning that:
PREMMPT-RT is now possible to install.
The GPIO clock freq is 0.33MHz (though i saw it in reference to the TX2)

So the question is, Can a timer-based real-time C/C++ program provide this frequency?
Or there is no escaping interfacing with something like an arduino (or other MCU) for this?


When you say “directly”, what do you mean? I’d think that the Nano could easily provide step and direction signals to a stepper driver like an 4988, 8825, one one of the TMCs but it really depends on your application. For instance how long of an uninterrupted pulse train do you need?

If you’re talking about wiring the stepper directly to the Nano, then no. The Nano can’t provide the current or voltage required and the back EMF generated by the stepper would destroy the Nano.

I should’ve elborated more on that, yes, by ‘directly’ i mean through an adequte driver such as ‎A4988 connected to the motor, not from the GPIO pins.
just providing an adequte pulse train for the step signal (and direction).
I’m concerened about the pulse jitter and achieveable frequency (I need at least 32Khz).

I have used a linux CNC solution before, on a Beaglebone, but the beaglebone has 2 PRUs (2 small co-processors)
providing the stepping frequency. but the Jetson doesn’t have anything simliar, so the stepping program I presume would have trouble keeping up with the frequency with all the other things linux does in the background.

So, I was wondering if people have any advice on that…

Ah gotcha. I don’t have any direct experience with what you’re trying to do but you may be able to co-opt one of the SPI controllers to drive the pulse train OR use an SPI compatible stepper driver instead of a step/direction driver.

Yes, that’s what I’m thinking as well, linux is most likely unable to drive something at this rate,
and getting even close will be a major headache.
and that would require also writing the stepping logic, I think i will opt for a bit more expensive SPI driver, something like TMC5160 or TMC429, a few more dollars but much less trouble.

I’d be interested in how it works out for you. I currently use Nanos to drive 3D printers but via Duet3 boards that do all the motion control.

Hi FlashN,

can you share your connection structure? I have jetson nano and 3 DM556 drivers but I’m not sure how to wire them.

Beginners problems…


You can use various boards to connect to jetson via UART, SPI or I2C and to the stepper motor. Even an ESP32 or other microcontroller can connect to the stepper with a motor driver or connect through serial to a Arduino. Lots of ways, I would pay attention to the responsiveness you are looking for and the ability to cancel a signal action once it is sent, for that I use ROS 2.