Thursday, February 08, 2007


Explanation of Stepping Motor Sync

I spent a few hours poring through the firmware code trying to figure out how the stepper sync mechanism works, and think I've got a rough idea now, and post it here if others are having trouble.

Having the devices in a chain means that there's some delay as commands are repeated from device 1 to device 2 and such; this means if you tell controller A to move the head left and controller B to move the head back, A will start moving before B. To get them moving together, they have another bus that's connected directly instead of through serial repeaters.

The computer can send commands to the controllers that, instead of being executed immediately, will be stored for later. It can:
Bringing the SYNCA line low will cause all devices to wait while it's low, then execute the stored command once the SYNCA line is brought high again. The step-forward and step-backward signals can be triggered repeatedly.

Any corrections or comments? Is this mechanism actually used by the java control software?

Now I'm having my own ideas. Consider this code snippet:
#include <stdio.h>

const unsigned int numer=7, denom=16;
int pos=0;

int syncline()

int main()
int n;
for(n=0; n<denom; n++)
printf(" %d\n", syncline());
It prints this output:
$ ./a.out
0 1 0 1 0 1 0 0 1 0 1 0 1 0 1 0
This is a well-known line-drawing algorithm from back when computers were more like our PICs, and drove printers not unlike our axis systems. Consider numer and denom as a fraction telling the X axis controller to take precisely 7 out of 16 steps. Used in sync with the Y axis controller, it could follow an arbitrary line without needing go/stop/stop/go/stop commands from the controlling PC before every sync pulse -- just give it a destination, a fractional speed, and go to town.


That's more or less how it works at the moment. The algorithm you describe is due to Bressenham, and the PICs implement it independently of the host PC using the sync line.

At some point before the release of RepRap 1.0 "Darwin" we really must document the code...
Post a Comment

Links to this post:

Create a Link

<< Home

This page is powered by Blogger. Isn't yours?

Subscribe to
Posts [Atom]