On Saturday 19 March 2016 13:23:27 Nicklas Karlsson wrote: > On Sat, 19 Mar 2016 09:52:55 -0700 > > Chris Albertson <[email protected]> wrote: > > On Fri, Mar 18, 2016 at 11:46 AM, Nicklas Karlsson < > > > > [email protected]> wrote: > > > I am planning to use a micro controller for stepper step pulse > > > generation. I have considered to use an inverter card but special > > > purpose stepper circuits are cheap so I use one of these instead. > > > It should be possible to feed timer values then toggle should > > > happen via DMA timer output compare values.
DMA, for those cpu's that have it built in, can be a VERY useful tool. But since LCNC doesn't seem to use it, I have to assume the worst case scenario exists in modern cpu's... In 1978 I needed to generate an academy countdown leader, 9.9 to 1.9 seconds until 1st video, on an RCA 1802 processor, which has built in dma. This thing ran at the smoking clock speed of 1.79 Mhz, but a full processor cycle was 8 clocks. Said another way its speed was 223,750 instructions per second. And I was able to do it on 6 DMA cycles per vertical field, using previously composed data, generating characters big enough they could be read on a 5" monitor from 20' away by operators with reasonably good eyesight. It worked without a hitch even at that slow a machine cycle because any time a DMARQ went down, the next machine cycle serviced it. With more "modern" cpu's, that is not always the case. Some treat dma as needing a full context dump to the stack first. Both RCA and TI got it right the first time, but TI did have to reload the program counter pointer which took a machine cycle. RCA did not as with 16 ea 16 bit registers, they just assigned one of them to be the dma access pointer. IMO you can smell time wasting stacking of the processor state and its recovery when the dma had been serviced 500 yards upwind of a dry lot operation on a below zero February morning. For those of you not raised on a farm, I'll just say its legendary and you'll never forget it. Modern disclaimer: I have no clue what sort of priority is given DMA by todays crop of CPU's. Sure they've gotten faster, but are they better? > > > > > > Can anyone suggest how an ideal step generation curve should look? > > > Constant acceleration up to top speed? Constant deceleration from > > > top speed to zero? Or just stop generating pulses? > > > > So you are NOT using LinuxCNC. You are planning to roll your own? > > No i use Linuxcnc and it currently communicate via Ethernet with a > micro controller so i stick with this solution for now. I discovered > motion planner in Linuxcnc have maximum speed and maximum acceleration > so I have to stick with these to avoid following error at high speed. > I have chosen a micro stepping driver so I guess linuxcnc servo loop > is to slow for the toggling. > > To output a square pulse on micro controller is very little software, > I think DMA transfer of table value to timer comparator registers will > work really well, othewise I could use several timer or software. > > As is now I use the micro controller for DC motors with encoder. For > angle measurement I already have encoder and plan to add resolver. For > motor types I have DC and plan to add BLDC, PMSM and Asyncronous. > Maybe I also add sensorless. There are some software libraries > available at least binaries maybe I use these or write my own. > > > I've done this a few times. My purpose for using CNC is robotics > > and these robots use motors of various type and move not unlike CNC > > machines. All of these motors I always control using some > > microprocessor. (ARM or AVR) > > > > Generally the pulse rate generator is at the lowest "layer" of > > abstraction in your software and gets requests from some high layers > > to do things like move at some rate to some location. Your software > > has to try to do what it is requested but subject to physical > > properties of the motor and mechanical system. You have to program > > this in. Likely maximum acceleration is a function of current > > speed. Likely the range of position is limited and so on. Some > > requests might have speed or acceleration limits embedded in them > > > > After this there is one more important thing that really is done my > > some layer above the pulse generator and that is planning. Say you > > are going to make a U-turn (reverse a motor direction) you might > > need to slow down before. This is called "planning" and it's always > > hard and with robots who work in a changing environment maybe not > > possible. But if you are interpreting G-Code you can always just > > read ahead. > > > > Ok there is one case where the pulse generator CAN and should do > > some planning. If it gets a request to "move to location X" it > > should accelerate to maximum speed, move for some time then > > DECELERATE and stop at "X" using other max > > > > There are some cases where the pulse generator MUST work with more > > then one motor at the same time. What if the request is to "move in > > a circle" or if doing threading on a lathe to move the spindle and > > leadscrew in "lock-step". In my case I want to move a > > caterpillar-tread robot along an arc of given radios so that it > > passes through the center of a doorway. The limiting factor is the > > performance of the "outside" tread motor. In general what running > > multiple motors one of then will hit a performance limit first and > > the others need to have their accelerations limited. > > > > The easiest thing for you to do is use software that others have > > written and get it to work some how on the platform your choose (An > > ARM based SBC like the beagle bored or "Pi") For CNC work LinucCNC > > already does what you need and for robotics look up "ROS". Both of > > these can run on a computer the size of a credit card. > > > > > > > > Now getting to your specific question of wetter to use constant > > acceleration (linearly increasing speed) or some kind of curve. The > > above should have answered this. The pulse generator will try for > > maximum performance which is constant acceleration but may run into > > physical limitation of the motor and mechanics where available > > torque is a function of speed and this will cause acceleration if > > tapper off. On the other hand if the request has an embedded limit > > you may not het mechanical limitations and you can actually do > > constant acceleration up to the commanded speed. > > > > > > > > > > > > > > > > > > > > > > -- > > > > Chris Albertson > > Redondo Beach, California > > -------------------------------------------------------------------- > >---------- Transform Data into Opportunity. > > Accelerate data analysis in your applications with > > Intel Data Analytics Acceleration Library. > > Click to learn more. > > http://pubads.g.doubleclick.net/gampad/clk?id=278785231&iu=/4140 > > _______________________________________________ > > Emc-users mailing list > > [email protected] > > https://lists.sourceforge.net/lists/listinfo/emc-users Cheers, Gene Heskett -- "There are four boxes to be used in defense of liberty: soap, ballot, jury, and ammo. Please use in that order." -Ed Howdershelt (Author) Genes Web page <http://geneslinuxbox.net:6309/gene> ------------------------------------------------------------------------------ Transform Data into Opportunity. Accelerate data analysis in your applications with Intel Data Analytics Acceleration Library. Click to learn more. http://pubads.g.doubleclick.net/gampad/clk?id=278785231&iu=/4140 _______________________________________________ Emc-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/emc-users
