Weird problem with parallel port control

This problem would probably be best addressed by anyone with some experience with low-level hardware control, particularly under Linux.

I've written a small software driver (well, I *think* driver is the correct term here...it talks directly to the hardware via low-level operating system calls) to interface with a hardware driver which connects via parallel port (old, I know, but that's what was on hand) and controls stepper motors. I'm using the method of ioperm(0x378, 3, 1) to get access to the three ports that I need for talking directly to the parallel port, and manually writing out with outb() the bytes needed to instruct the motors. The purpose of the driver is to be a small part of a much larger astronomy project that my dad and I are working on together. I actually have the software pretty much finished, and on *one* version of *one* distribution of Linux, my code controls the stepper motors exactly as it should. That version/distribution is the latest release (10.04) of EMC Linux: http://www.linuxcnc.org/

This "distribution" is really no more than Ubuntu, plus software called "EMC" (Extended Machine Controller), an application used for controlling stepper motors to guide a milling machine (metal cutter), but that's beside the point. In said version/distribution, my code for controlling the motors works perfectly.

However, in every other distribution I've tried, including older version of the *same* distro, as well as Slax, and pure Ubuntu, when I run my code, it behaves, but the motors operate *VERY* slowly. My theory is that the operating system is enforcing a minimum delay between motor pulses -- but even if that's the case, I have no idea how it's doing that, or how I'd attack the problem. The funny thing is, the EMC software works just as it should, even on those other distributions, controlling the motors at full speed. But my code *only* works properly on the newest version of the distribution I linked. I thought it might be a timing issue, and I use quite a few calls to usleep(). But re-compiling my code on the other systems doesn't change a thing. This totally baffles me, why the EMC application should work perfectly everywhere, and my code should work perfectly in one environment but cause the motors to turn much too slowly in other, very similar environments. This is a big problem because the one environment where I *do* have it working correctly is too resource-hungry an environment to accommodate our project.

If anyone can offer any kind of insight on this, I'd greatly appreciate it. Let me know if I can provide any other information that would be helpful :)
Last edited on
On Linux/UNIX drivers are usually linked into the kernal so that the OS can better control the driver for one reason. Perhaps on the version where it works at the proper speed, the kernal is especially tuned for this type of out-of-kernal access. Beyond that, I'm not much help.
Topic archived. No new replies allowed.