The upper end is no problem, it come by itself then DMA was used to feed values but the lower end I had to twiddle with a bit to get frequency down.
Synchronization is not by itself a problem but values are received from Linuxcnc with quite large jitter. I could add a little bit of lag and even out periods but it may screw up feedback. I guess I have to read source for the stepper driver/protocol and figure out myself. On Mon, 4 Apr 2016 14:20:36 -0700 "John Dammeyer" <[email protected]> wrote: > I'm sure you are going to have lots of fun with this. I suspect you might > be over simplifying it too. > > It's not really that important that you can generate 1 Mhz stepping > frequencies using the hardware timer on the micro-processor. Nowadays > that's probably a first or second year college lab assignment -- rather > trivial really. I'd be more concerned about dealing with synchronizing > steps between motors or a spindle. > > For example. Say you have a spindle turning 100 RPM. That's > 1.6666666666666666... revolutions per second (RPS). You want to cut a > thread pitch that matches the lead screw pitch so the lead screw has to turn > the same RPM as the spindle or also 1.66666666... RPS. > > Assuming you are using a stepper drive with 8 MicroSteps/step onto a 200 > step per rev motor. That's 1600 steps per revolution. So your step > frequency is 2,666.666666... Hz. (1600 steps per revolution x RPS) Nowhere > near that 1Mhz top end. > > Now if your counter circuit has a 2MHz input frequency it's pretty easy. > Divide by 750 to get that frequency. Simple so far. Right? > > Now your spindle drops to 99 RPM which is 1.65 RPS so let's make the stepper > turn 1.65 RPS which is a step rate of 2640 Hz. Now all you have to do is > program your counter to divide by 757.575757575757... Oh wait a sec. It's > probably an integer divider. So you will be out by 0.57575757575 Hz. Not a > big deal I guess. Only about 0.08%. Or maybe it is. I wouldn't accept > it. > > Now use that same approach trying to move three motors to move a tool on a > curve through 3D space and since each motor will run various speeds through > this path you will find all sorts of rounding and truncating errors. > > And I haven't even touched on accelerating/deceerating from a stopped > position and maintaining synchronization. > > John Dammeyer > > > -----Original Message----- > > From: Nicklas Karlsson [mailto:[email protected]] > > Sent: April-04-16 12:22 PM > > To: [email protected] > > Subject: [Emc-users] Stepper generator > > > > > > I am currently implementing a stepper generator on micro controller which > > may output square waves with clock frequency accuracy with use of built in > > timer peripheral. It may generate square wave probably up to at least in > the > > MHz range and be extended downwards as far as needed by some > > adjustment in software. It seems to work great and it should only be > > finnished off. I currently use relatively expensive micro controller but > cheap > > available for around $1 in large quantity should also work just as fine > since it > > have the same peripheral I used. > > > > It no problem to output a sequence of square pulses or with a certain > > frequency. Linuxcnc seems to output step velocity and read back > > accumulated number of steps generated. > > > > What puzzle me is period may vary. As is now I start to use values as soon > as > > they are received via Ethernet. I have used other networks like CAN before > > there everything is synchronized with "broad casted" with a high priority > > sync message. Do anybody have a clue how synchronization should be done > > for mesa Hostmot cards via Ethernet? Or more generally in Linuxcnc? > > > > > > Nicklas Karlsson > > > > > ---------------------------------------------------------------------------- > -- > > _______________________________________________ > > Emc-users mailing list > > [email protected] > > https://lists.sourceforge.net/lists/listinfo/emc-users > > > ------------------------------------------------------------------------------ > _______________________________________________ > Emc-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/emc-users ------------------------------------------------------------------------------ _______________________________________________ Emc-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/emc-users
