From owner-freebsd-hackers Sun Sep 30 17:46:39 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from bogslab.ucdavis.edu (bogslab.ucdavis.edu [169.237.68.34]) by hub.freebsd.org (Postfix) with ESMTP id 5F82F37B409 for ; Sun, 30 Sep 2001 17:46:36 -0700 (PDT) Received: from thistle.bogs.org (thistle.bogs.org [198.137.203.61]) by bogslab.ucdavis.edu (8.9.3/8.9.3) with ESMTP id RAA85051 for ; Sun, 30 Sep 2001 17:46:30 -0700 (PDT) (envelope-from greg@bogslab.ucdavis.edu) Received: from thistle.bogs.org (localhost [127.0.0.1]) by thistle.bogs.org (8.11.3/8.11.3) with ESMTP id f910j1A47144 for ; Sun, 30 Sep 2001 17:45:02 -0700 (PDT) (envelope-from greg@thistle.bogs.org) Message-Id: <200110010045.f910j1A47144@thistle.bogs.org> To: hackers@FreeBSD.ORG X-To: Bart Kus X-Sender: owner-freebsd-hackers@FreeBSD.ORG Subject: Re: precise timing In-reply-to: Your message of "Sun, 30 Sep 2001 13:23:08 CDT." <200109301318.44290@EO> Reply-To: gkshenaut@ucdavis.edu Date: Sun, 30 Sep 2001 17:45:01 -0700 From: Greg Shenaut Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG In message <200109301318.44290@EO>, Bart Kus cleopede: >On Sunday 30 September 2001 12:47, Greg Shenaut wrote: >> Well, setitimer has a maximum rate of 100 Hz, with a slop factor >> sometimes much greater than 10 ms. This was the result of some >> recent testing on a lightly-loaded standard 4.3 system. > > That's not good enough. :/ > >> How many stepper motors are you driving? If it's only one at a time, then >> maybe the speaker port on the motherboard (a programmable counter-timer) >> would be more reliable. > > I like the speaker port idea. Can one program the speaker port to generate >an int/signal/un-block using bsd's kernel API? I do not think that there is hardware support for interrupts from the speaker port, but it seems to me that since it just sits there putting out a square wave at whatever frequency was most recently programmed into it, all one of the (relatively infrequent) less-than 10 ms timing glitches would do is to slow down the ramp sometimes, which would never harm the stepper motor (but would slow down the process a little bit). >> Another idea is to use a fifo'ed UART's data out >> line and fiddle with the baud rate to vary the speed of the pulses. > > I don't think this will provide the "smoothness" I want. Going from >2400->4800 steps/sec for example would be a huge jerk. Need SMOOTH >transition (constant-acceleration). I was thinking in terms of changing the baud rate in smaller increments than that--the timing hardware inside the standard PC UART is just a 16-bit programmable divider. But a MCU is still probably your best bet. (I remember writing a stepper-motor driver on a TI 9900 back in the 70's.) Greg Shenaut To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message