Linux - HardwareThis forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Hi everybody,
I am going mad with this: I am writing a test program to spin a stepper connected to the parallel port. Being D0=step_pin, D1=dir_pin, C2=enable_pin.
The few c code lines I wrote:
1) get the ioperm(0x378,3,1) that returns no error;
2) enable the stepper with outb(C2,0x37a)
before entering the "for" cycle that sends outb(step+dir,0x378) N (on off) sequences,
the stepper starts humming and spinning always the same way with the same pace (regardless the D1 direction value and the delay value)
It looks like (I verified it with a multimeter) there is always some process sending the 0x378 pins a squared wave of around 100Hz preventing any actions on 0x378.
Control 0x37a works fine and the stepper is easily switched on and of (ie energized).
From Bios I switched to SPP mode and suid(0) in the code but with no success.
Are you checking return values from your calls to check for errors? I would guess you need to send
Code:
outb(D0,0x378);
outb(D0+D1,0x378);
back and forth.
I just check ioperm return code and, as far as I know, it is OK. I'll try and alter the code as you has suggested above even though I am a bit skeptical. I'll turn up soon with the results.
Hi,
the plot thickens!
I wired the stepper to other pins: first to D2(step) D3(dir) C0(enable) and then D4(step) D5(dir) C1(enable) to see if things changed. As a matter of fact this time the stepper rotated consistently with the command given (apart from insensitivenes to usleep interval ....)
There must be something wrong with Pin2 and Pin3 (ie D0 and D1).
Removing modules lp, parport and parport_pc, the stepper does not work at all. Insmoding just parport_pc though, the test program works but not when sending steps through pins 2 and 3. Could perhaps be something related to parport_pc that sends signals through D0 and D1?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.