hal_parport

More
23 Oct 2013 17:41 #40222 by ktrofimov
hal_parport was created by ktrofimov
Can somebody help me with parallel port limit switches?

I had CNC cutter working with Mach3. It works.
Parport in 10 is shared limit switch (all X+, X-, Y+ Y-)
Parport in 11 is X home
Parport in 12 is Y home


CNC configuration made with StepConf wizard
net xstep => parport.0.pin-02-out
setp parport.0.pin-03-out-invert 1
net xdir => parport.0.pin-03-out
net zstep => parport.0.pin-04-out
net zdir => parport.0.pin-05-out
net ystep => parport.0.pin-06-out
setp parport.0.pin-07-out-invert 1
net ydir => parport.0.pin-07-out


net all-limit <= parport.0.pin-10-in-not
net home-x <= parport.0.pin-11-in-not
net home-y <= parport.0.pin-12-in-not

net home-x => axis.0.home-sw-in
net all-limit => axis.0.neg-lim-sw-in
net all-limit => axis.0.pos-lim-sw-in

net home-y => axis.1.home-sw-in
net all-limit => axis.1.neg-lim-sw-in
net all-limit => axis.1.pos-lim-sw-in

I can move tool in all 3 directions, but home position could not be detected.
using HAL test tools (including wiki.linuxcnc.org/cgi-bin/wiki.pl?Parallel_Port_Tester and www.vdwalle.com/Norte/Second%20Parport.htm) I do not see any reaction when I click on any switch.


root@stanok-desktop:/home/stanok# dmesg | grep par
[    0.400791] pci 0000:00:1e.0: transparent bridge
[    9.550005] parport_pc 00:08: reported by Plug and Play ACPI
[    9.550077] parport0: PC-style at 0x378, irq 7 [PCSPP]
[    9.623818] ppdev: user-space parallel port driver
[    9.733022] lp0: using parport0 (interrupt-driven).
stanok# ./ppdiag
S01: parport built as module
 
S02: parport0:
S02:    modes:PCSPP
S02:    ADDR :0x378
S02:    IRQ  :7
S02:    DMA  :no DMA used
 
grep: /etc/modules.conf: Нет такого файла или каталога
S03: no parport parameters
 
S10: ppdev built as module
 
S12: /dev/parport0 exists ...
S12: /dev/parport0 is readable ...
S12: /dev/parport0 is writable ...
S12: do you want to allow any user to access ppdev ? (yes/no)
yes
S12: mode changed ...
 
successfull end ....

show pin is always shows FALSE
stanok# halrun
halcmd: loadrt probe_parport
halcmd: loadrt hal_parport cfg="0x378 out"
halcmd: start
halcmd: show pin
Component Pins:
Owner   Type  Dir         Value  Name
     5  bit   IN          FALSE  parport.0.pin-01-out
     5  bit   IN          FALSE  parport.0.pin-02-out
     5  bit   IN          FALSE  parport.0.pin-03-out
     5  bit   IN          FALSE  parport.0.pin-04-out
     5  bit   IN          FALSE  parport.0.pin-05-out
     5  bit   IN          FALSE  parport.0.pin-06-out
     5  bit   IN          FALSE  parport.0.pin-07-out
     5  bit   IN          FALSE  parport.0.pin-08-out
     5  bit   IN          FALSE  parport.0.pin-09-out
     5  bit   OUT         FALSE  parport.0.pin-10-in
     5  bit   OUT         FALSE  parport.0.pin-10-in-not
     5  bit   OUT         FALSE  parport.0.pin-11-in
     5  bit   OUT         FALSE  parport.0.pin-11-in-not
     5  bit   OUT         FALSE  parport.0.pin-12-in
     5  bit   OUT         FALSE  parport.0.pin-12-in-not
     5  bit   OUT         FALSE  parport.0.pin-13-in
     5  bit   OUT         FALSE  parport.0.pin-13-in-not
     5  bit   IN          FALSE  parport.0.pin-14-out
     5  bit   OUT         FALSE  parport.0.pin-15-in
     5  bit   OUT         FALSE  parport.0.pin-15-in-not
     5  bit   IN          FALSE  parport.0.pin-16-out
     5  bit   IN          FALSE  parport.0.pin-17-out
Attachments:

Please Log in or Create an account to join the conversation.

More
23 Oct 2013 19:00 - 23 Oct 2013 19:03 #40224 by ArcEye
Replied by ArcEye on topic hal_parport
Hi

root@stanok-desktop:/home/stanok# dmesg | grep par
[ 0.400791] pci 0000:00:1e.0: transparent bridge
[ 9.550005] parport_pc 00:08: reported by Plug and Play ACPI
[ 9.550077] parport0: PC-style at 0x378, irq 7 [PCSPP]
[ 9.623818] ppdev: user-space parallel port driver
[ 9.733022] lp0: using parport0 (interrupt-driven).


Your problem is probably that you have parport_pc, ppdev and lp loaded

hal_parport will not work properly if they have already claimed the parport
I am surprised it works at all

Either comment out the lp line in /etc/modules or blacklist lp in /etc/modules.d or just rmmod the 3 drivers

regards
Last edit: 23 Oct 2013 19:03 by ArcEye.

Please Log in or Create an account to join the conversation.

More
23 Oct 2013 20:11 #40226 by ktrofimov
Replied by ktrofimov on topic hal_parport
rmmod did not help :(

Here are modules loaded during CNC session:
There is no parport_pc, ppdev and lp
root@stanok-desktop:/etc# lsmod
Module                  Size  Used by
stepgen                 8036  0
hal_parport             6912  0
probe_parport           1480  0
motmod                142174  0
trivkins                1274  1 motmod
hal_lib                30517  5 stepgen,hal_parport,probe_parport,motmod,trivkins
rtapi                  30079  5 stepgen,hal_parport,probe_parport,motmod,hal_lib
rtai_math              21406  1 rtapi
rtai_sem               21551  1 rtapi
rtai_fifos             20988  1 rtapi
rtai_sched            156719  3 rtapi,rtai_sem,rtai_fifos
rtai_hal              186236  4 rtapi,rtai_sem,rtai_fifos,rtai_sched
binfmt_misc             6587  1
dm_crypt               11363  0
snd_hda_codec_realtek   203166  1
snd_hda_intel          21723  2
snd_hda_codec          69517  2 snd_hda_codec_realtek,snd_hda_intel
snd_hwdep               5372  1 snd_hda_codec
snd_pcm_oss            35244  0
snd_mixer_oss          13695  1 snd_pcm_oss
snd_pcm                67036  3 snd_hda_intel,snd_hda_codec,snd_pcm_oss
snd_seq_dummy           1338  0
snd_seq_oss            26726  0
snd_seq_midi            4557  0
snd_rawmidi            17955  1 snd_seq_midi
snd_seq_midi_event      5572  2 snd_seq_oss,snd_seq_midi
snd_seq                46527  6 snd_seq_dummy,snd_seq_oss,snd_seq_midi,snd_seq_midi_event
snd_timer              18138  2 snd_pcm,snd_seq
snd_seq_device          5355  5 snd_seq_dummy,snd_seq_oss,snd_seq_midi,snd_rawmidi,snd_seq
psmouse                63213  0
joydev                  8644  0
parport                30764  1 hal_parport
serio_raw               3978  0
snd                    51043  16 snd_hda_codec_realtek,snd_hda_intel,snd_hda_codec,snd_hwdep,snd_pcm_oss,snd_mixer_oss,snd_pcm,snd_seq_oss,snd_rawmidi,snd_seq,snd_timer,snd_seq_device
soundcore               6016  1 snd
snd_page_alloc          6717  2 snd_hda_intel,snd_pcm
dm_raid45              81157  0
xor                    14673  1 dm_raid45
usbhid                 35772  0
hid                    65804  1 usbhid
fbcon                  35102  71
tileblit                1987  1 fbcon
font                    7406  1 fbcon
bitblit                 4664  1 fbcon
softcursor              1151  1 bitblit
vga16fb                11161  0
vgastate                8760  1 vga16fb
i915                  282703  4
drm_kms_helper         27748  1 i915
drm                   154120  5 i915,drm_kms_helper
intel_agp              24133  2 i915
r8169                  33788  0
i2c_algo_bit            4903  1 i915
mii                     4006  1 r8169
video                  17089  1 i915
output                  1773  1 video
agpgart                29292  2 drm,intel_agp

Forgot to mention: LinuxCNC installed using latest official Ubuntu TLS CD-ROM

Please Log in or Create an account to join the conversation.

More
23 Oct 2013 21:23 #40227 by ArcEye
Replied by ArcEye on topic hal_parport

Here are modules loaded during CNC session:
There is no parport_pc, ppdev and lp


OK, as you posted a printout showing that they were loaded, you can see my confusion.

I would test the input pins and viewing the results in Machine>Hal Configuration in Axis.
The parport tester does not test the pins as such, you have to either read a voltage from an output or ground an input for the test to mean anything.

net home-x <= parport.0.pin-11-in-not


I note you have inverted pins, hopefully that is because you have an opto-isolated BOB which inverts signals

regards

Please Log in or Create an account to join the conversation.

More
24 Oct 2013 15:23 - 24 Oct 2013 15:35 #40240 by ktrofimov
Replied by ktrofimov on topic hal_parport
I did check parport values using sourceforge.net/projects/parashell/

In manual mode (using short wires)
Output on pins 2-9 - outb( 0x378, 0xFF) - is 3.3v
Input on pins 10-13 - inb( 0x379 ) is:
127 (0111 1111) if all pins free
63 (0011 1111) if pin10 shortened to GND
255 (1111 1111) if pin11 shortened to GND
95 (0101 1111) if pin12 shortened to GND
111 (0110 1111) if pin13 shortened to GND

With controller connected:
input pins are always 127 (even when I manually click on the limit switch)
measuring voltage on pins 10 to 13 is always 4.8v

Measuring voltage on controller (without connection to PC) shows pin10=4.8v when limit switch is free and =1.7v when I hold limit switch down.

It looks like my controller does not like 3.3v parallel port
Last edit: 24 Oct 2013 15:35 by ktrofimov. Reason: Wrong voltage measured

Please Log in or Create an account to join the conversation.

More
24 Oct 2013 16:10 #40241 by cncbasher
Replied by cncbasher on topic hal_parport
it could be that your breakout board does not require the inputs to be inverted , what breakout board are you using ?
if the stepgens are working then i would resonably presume that the parrell port is working correctly , and this then becomes a configuration problem
usualy inverting the inputs solves this , depending if the inputs have pullups of course , or inverted if using opto's

Please Log in or Create an account to join the conversation.

More
24 Oct 2013 16:41 #40242 by ktrofimov
Replied by ktrofimov on topic hal_parport
I checked my board - before optoisolators were resistors 2K2 - too much for LED
I replaced them by 470R (according to datasheet it could be down to 100R) and now I see limit switches from LinuxCNC

Can you advice how limits and homes should be set in the right way?
When tool is at any limit I have logical 0 at pin 10.
When X at home then pin 11 is at logical 0
When Y at home then pin 12 is at logical 0
During work all three pins at logical 1

Please Log in or Create an account to join the conversation.

More
24 Oct 2013 17:28 #40244 by ArcEye
Replied by ArcEye on topic hal_parport
Hi

Sounds like you are getting there

The limits should be be TRUE(1) until they are tripped, this enables them to be chained in series and when one trips the whole lot go FALSE

The home switches should be FALSE (0) until activated

Sounds like the home pins need the -not removing, but if I am reading you correctly, the limits are correct, showing FALSE when the axis is tripping any one of them

regards
The following user(s) said Thank You: ktrofimov

Please Log in or Create an account to join the conversation.

Time to create page: 0.090 seconds
Powered by Kunena Forum