LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 06-27-2006, 11:49 AM   #1
Pier
Member
 
Registered: Oct 2005
Location: Italy
Distribution: Gentoo
Posts: 83

Rep: Reputation: 17
Writing to parallel port 0x37a works, 0x378 don't


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.

Could anyone helpme to get this sorted out?

I even modprobe -r (lp, parport and parport_pc)

Thanks a lot,
Pier

PS
The stepper works fine with a C (dos) program.

Slack 10.2 Ker. 2.4.31
 
Old 06-27-2006, 01:43 PM   #2
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
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.
 
Old 06-27-2006, 02:04 PM   #3
Pier
Member
 
Registered: Oct 2005
Location: Italy
Distribution: Gentoo
Posts: 83

Original Poster
Rep: Reputation: 17
Quote:
Originally Posted by Matir
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.

Thanks,
Pier
 
Old 06-27-2006, 04:51 PM   #4
Pier
Member
 
Registered: Oct 2005
Location: Italy
Distribution: Gentoo
Posts: 83

Original Poster
Rep: Reputation: 17
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?

Thanks for any help,
Pier
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
parallel port mehro Linux - Hardware 5 01-31-2006 06:43 AM
Where is the parallel port? kwyjibo99 Linux - Hardware 5 07-20-2005 05:47 PM
Parallel port scanner works, almost. netcrawl Linux - Hardware 4 08-27-2004 05:46 PM
What's using my parallel port?! DiBosco Linux - Hardware 10 06-20-2004 10:18 AM
Parallel Port Crashed_Again Linux - Hardware 1 01-20-2003 08:52 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 02:18 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration