HAL Driver for Raspberry PI GPIOs
20 Dec 2020 14:58 #192542
by Markyd
Replied by Markyd on topic HAL Driver for Raspberry PI GPIOs
still no luck, regardless of what syntax i use. I've tried all the variations below without success. I've even tried the xdir pin but the result is the same. Does the hal_pi_gpio accept invert?
#setp hal_pi_gpio.pin-29-invert true
#setp hal_pi_gpio.pin-29-out-invert true
#setp hal_pi_gpio.pin-29.invert true
#setp hal_pi_gpio.pin-29.invert-output true
#setp hal_pi_gpio.pin-29.invert_output true
#setp hal_pi_gpio.pin-29-out.invert-output TRUE
#setp hal_pi_gpio.pin-29-out.invert_output TRUE
net xenable => hal_pi_gpio.pin-29-out
#setp hal_pi_gpio.pin-29-invert true
#setp hal_pi_gpio.pin-29-out-invert true
#setp hal_pi_gpio.pin-29.invert true
#setp hal_pi_gpio.pin-29.invert-output true
#setp hal_pi_gpio.pin-29.invert_output true
#setp hal_pi_gpio.pin-29-out.invert-output TRUE
#setp hal_pi_gpio.pin-29-out.invert_output TRUE
net xenable => hal_pi_gpio.pin-29-out
Please Log in or Create an account to join the conversation.
20 Dec 2020 15:01 #192543
by PCW
Replied by PCW on topic HAL Driver for Raspberry PI GPIOs
Rather than guessing, why don't you look at all available pins/parameters?
halcmd show all hal_pi
halcmd show all hal_pi
Please Log in or Create an account to join the conversation.
20 Dec 2020 15:15 - 20 Dec 2020 15:17 #192546
by Markyd
Replied by Markyd on topic HAL Driver for Raspberry PI GPIOs
I'm new to linuxcnc so the 'obvious' isn't yet obvious to me, so thanks for the suggestion. I get the following, which seems to recognise "hal_pi_gpio.pin-29-out <== xenable" but says Dir is "IN" which i don't understand ??
pi@linuxcnc:~ $ halcmd show all hal_pi
Loaded HAL Components:
ID Type Name PID State
31 RT hal_pi_gpio ready
Component Pins:
Owner Type Dir Value Name
31 bit OUT FALSE hal_pi_gpio.pin-03-in ==> limit-z-switch
31 bit OUT FALSE hal_pi_gpio.pin-11-in
31 bit OUT FALSE hal_pi_gpio.pin-12-in
31 bit OUT FALSE hal_pi_gpio.pin-13-in ==> limit-x-switch
31 bit IN FALSE hal_pi_gpio.pin-15-out
31 bit OUT FALSE hal_pi_gpio.pin-16-in ==> limit-y-switch
31 bit OUT FALSE hal_pi_gpio.pin-18-in ==> not-1-in
31 bit IN FALSE hal_pi_gpio.pin-19-out <== ydir
31 bit IN FALSE hal_pi_gpio.pin-21-out
31 bit IN FALSE hal_pi_gpio.pin-22-out
31 bit IN FALSE hal_pi_gpio.pin-23-out <== ystep
31 bit IN FALSE hal_pi_gpio.pin-24-out <== xdir
31 bit IN FALSE hal_pi_gpio.pin-26-out <== spindle-on
31 bit IN FALSE hal_pi_gpio.pin-29-out <== xenable
31 bit IN FALSE hal_pi_gpio.pin-31-out
31 bit IN FALSE hal_pi_gpio.pin-32-out <== xstep
31 bit IN FALSE hal_pi_gpio.pin-33-out
31 bit IN FALSE hal_pi_gpio.pin-35-out
31 bit IN FALSE hal_pi_gpio.pin-36-out <== zstep
31 bit IN FALSE hal_pi_gpio.pin-37-out
31 bit IN FALSE hal_pi_gpio.pin-38-out
31 bit IN FALSE hal_pi_gpio.pin-40-out <== zdir
31 s32 OUT 1093 hal_pi_gpio.read.time
31 s32 OUT 833 hal_pi_gpio.write.time
pi@linuxcnc:~ $ halcmd show all hal_pi
Loaded HAL Components:
ID Type Name PID State
31 RT hal_pi_gpio ready
Component Pins:
Owner Type Dir Value Name
31 bit OUT FALSE hal_pi_gpio.pin-03-in ==> limit-z-switch
31 bit OUT FALSE hal_pi_gpio.pin-11-in
31 bit OUT FALSE hal_pi_gpio.pin-12-in
31 bit OUT FALSE hal_pi_gpio.pin-13-in ==> limit-x-switch
31 bit IN FALSE hal_pi_gpio.pin-15-out
31 bit OUT FALSE hal_pi_gpio.pin-16-in ==> limit-y-switch
31 bit OUT FALSE hal_pi_gpio.pin-18-in ==> not-1-in
31 bit IN FALSE hal_pi_gpio.pin-19-out <== ydir
31 bit IN FALSE hal_pi_gpio.pin-21-out
31 bit IN FALSE hal_pi_gpio.pin-22-out
31 bit IN FALSE hal_pi_gpio.pin-23-out <== ystep
31 bit IN FALSE hal_pi_gpio.pin-24-out <== xdir
31 bit IN FALSE hal_pi_gpio.pin-26-out <== spindle-on
31 bit IN FALSE hal_pi_gpio.pin-29-out <== xenable
31 bit IN FALSE hal_pi_gpio.pin-31-out
31 bit IN FALSE hal_pi_gpio.pin-32-out <== xstep
31 bit IN FALSE hal_pi_gpio.pin-33-out
31 bit IN FALSE hal_pi_gpio.pin-35-out
31 bit IN FALSE hal_pi_gpio.pin-36-out <== zstep
31 bit IN FALSE hal_pi_gpio.pin-37-out
31 bit IN FALSE hal_pi_gpio.pin-38-out
31 bit IN FALSE hal_pi_gpio.pin-40-out <== zdir
31 s32 OUT 1093 hal_pi_gpio.read.time
31 s32 OUT 833 hal_pi_gpio.write.time
Last edit: 20 Dec 2020 15:17 by Markyd.
Please Log in or Create an account to join the conversation.
20 Dec 2020 15:23 #192547
by Markyd
Replied by Markyd on topic HAL Driver for Raspberry PI GPIOs
There is no mention of the word "Invert" in github.com/LinuxCNC/linuxcnc/blob/master...rivers/hal_pi_gpio.c, is that likely to be significant ?
Please Log in or Create an account to join the conversation.
20 Dec 2020 15:26 - 20 Dec 2020 15:28 #192548
by PCW
Replied by PCW on topic HAL Driver for Raspberry PI GPIOs
Right, so the hal_pi_gpio driver is pretty bare bones
and doesn't have invert capability on inputs or outputs
(the pin/parameter listing would show these if the driver provided them)
You could use the hal "not" component to invert the desired signals
(or bug the hal_pi_gpio writer to add invert capability)
and doesn't have invert capability on inputs or outputs
(the pin/parameter listing would show these if the driver provided them)
You could use the hal "not" component to invert the desired signals
(or bug the hal_pi_gpio writer to add invert capability)
Last edit: 20 Dec 2020 15:28 by PCW.
Please Log in or Create an account to join the conversation.
20 Dec 2020 16:13 #192555
by Markyd
Replied by Markyd on topic HAL Driver for Raspberry PI GPIOs
I think I'm just going to have to unplug the enable pins for now as i've just demonstrated to myself that I don't know what I'm doing with "not" and addf !
Please Log in or Create an account to join the conversation.
20 Dec 2020 17:06 #192556
by jmelson
Replied by jmelson on topic HAL Driver for Raspberry PI GPIOs
still no luck, regardless of what syntax i use. I've tried all the variations below without success. I've even tried the xdir pin but the result is the same. Does the hal_pi_gpio accept invert?
#setp hal_pi_gpio.pin-29-invert true
The # at the beginning makes the line a comment. Did you actually have the # as the first character on the line?
If so, try without the #.
Jon
Please Log in or Create an account to join the conversation.
20 Dec 2020 17:46 #192559
by Markyd
Replied by Markyd on topic HAL Driver for Raspberry PI GPIOs
I'd been commenting them in and out as i tried them in turn
Please Log in or Create an account to join the conversation.
03 Jan 2021 08:17 - 03 Jan 2021 14:26 #193932
by nion
Replied by nion on topic HAL Driver for Raspberry PI GPIOs
Hello
I'm using RPI4 with 7i92 for the moment but I want to add one encoder for feed override using the RPI GPIO driver.
This is what I added to my hal file but I don't get reading on Hal Meter hal_pi_gpio.pin-03-in and hal_pi_gpio.pin-05-in. I also tried different pins with no success.
Can someone please point me what I'm doing wrong
loadrt hal_pi_gpio dir=67108860 exclude=0
loadrt encoder num_chan=1
addf encoder.capture-position servo-thread
addf encoder.update-counters servo-thread
setp halui.feed-override.scale .005
net feedcount halui.feed-override.counts <= encoder.0.counts
net feedup encoder.0.phase-A <= hal_pi_gpio.pin-03-in
net feeddown encoder.0.phase-B <= hal_pi_gpio.pin-05-in
_______________________________________________________
pi@linuxcnc:~ $ halcmd show all hal_pi
Component Pins:
Owner Type Dir Value Name
29 bit OUT FALSE hal_pi_gpio.pin-03-in ==> feedup
29 bit OUT FALSE hal_pi_gpio.pin-05-in ==> feeddown
29 bit IN FALSE hal_pi_gpio.pin-07-out
29 bit IN FALSE hal_pi_gpio.pin-08-out
29 bit IN FALSE hal_pi_gpio.pin-10-out
29 bit IN FALSE hal_pi_gpio.pin-11-out
29 bit IN FALSE hal_pi_gpio.pin-12-out
29 bit IN FALSE hal_pi_gpio.pin-13-out
29 bit IN FALSE hal_pi_gpio.pin-15-out
29 bit IN FALSE hal_pi_gpio.pin-16-out
29 bit IN FALSE hal_pi_gpio.pin-18-out
29 bit IN FALSE hal_pi_gpio.pin-19-out
29 bit IN FALSE hal_pi_gpio.pin-21-out
29 bit IN FALSE hal_pi_gpio.pin-22-out
29 bit IN FALSE hal_pi_gpio.pin-23-out
29 bit IN FALSE hal_pi_gpio.pin-24-out
29 bit IN FALSE hal_pi_gpio.pin-26-out
29 bit IN FALSE hal_pi_gpio.pin-29-out
29 bit IN FALSE hal_pi_gpio.pin-31-out
29 bit IN FALSE hal_pi_gpio.pin-32-out
29 bit IN FALSE hal_pi_gpio.pin-33-out
29 bit IN FALSE hal_pi_gpio.pin-35-out
29 bit IN FALSE hal_pi_gpio.pin-36-out
29 bit IN FALSE hal_pi_gpio.pin-37-out
29 bit IN FALSE hal_pi_gpio.pin-38-out
29 bit IN FALSE hal_pi_gpio.pin-40-out
29 s32 OUT 0 hal_pi_gpio.read.time
29 s32 OUT 0 hal_pi_gpio.write.time
_______________________________________________________
I'm using RPI4 with 7i92 for the moment but I want to add one encoder for feed override using the RPI GPIO driver.
This is what I added to my hal file but I don't get reading on Hal Meter hal_pi_gpio.pin-03-in and hal_pi_gpio.pin-05-in. I also tried different pins with no success.
Can someone please point me what I'm doing wrong
loadrt hal_pi_gpio dir=67108860 exclude=0
loadrt encoder num_chan=1
addf encoder.capture-position servo-thread
addf encoder.update-counters servo-thread
setp halui.feed-override.scale .005
net feedcount halui.feed-override.counts <= encoder.0.counts
net feedup encoder.0.phase-A <= hal_pi_gpio.pin-03-in
net feeddown encoder.0.phase-B <= hal_pi_gpio.pin-05-in
_______________________________________________________
pi@linuxcnc:~ $ halcmd show all hal_pi
Component Pins:
Owner Type Dir Value Name
29 bit OUT FALSE hal_pi_gpio.pin-03-in ==> feedup
29 bit OUT FALSE hal_pi_gpio.pin-05-in ==> feeddown
29 bit IN FALSE hal_pi_gpio.pin-07-out
29 bit IN FALSE hal_pi_gpio.pin-08-out
29 bit IN FALSE hal_pi_gpio.pin-10-out
29 bit IN FALSE hal_pi_gpio.pin-11-out
29 bit IN FALSE hal_pi_gpio.pin-12-out
29 bit IN FALSE hal_pi_gpio.pin-13-out
29 bit IN FALSE hal_pi_gpio.pin-15-out
29 bit IN FALSE hal_pi_gpio.pin-16-out
29 bit IN FALSE hal_pi_gpio.pin-18-out
29 bit IN FALSE hal_pi_gpio.pin-19-out
29 bit IN FALSE hal_pi_gpio.pin-21-out
29 bit IN FALSE hal_pi_gpio.pin-22-out
29 bit IN FALSE hal_pi_gpio.pin-23-out
29 bit IN FALSE hal_pi_gpio.pin-24-out
29 bit IN FALSE hal_pi_gpio.pin-26-out
29 bit IN FALSE hal_pi_gpio.pin-29-out
29 bit IN FALSE hal_pi_gpio.pin-31-out
29 bit IN FALSE hal_pi_gpio.pin-32-out
29 bit IN FALSE hal_pi_gpio.pin-33-out
29 bit IN FALSE hal_pi_gpio.pin-35-out
29 bit IN FALSE hal_pi_gpio.pin-36-out
29 bit IN FALSE hal_pi_gpio.pin-37-out
29 bit IN FALSE hal_pi_gpio.pin-38-out
29 bit IN FALSE hal_pi_gpio.pin-40-out
29 s32 OUT 0 hal_pi_gpio.read.time
29 s32 OUT 0 hal_pi_gpio.write.time
_______________________________________________________
Last edit: 03 Jan 2021 14:26 by nion. Reason: Incomplete question
Please Log in or Create an account to join the conversation.
- tommylight
- Away
- Moderator
Less
More
- Posts: 19209
- Thank you received: 6438
03 Jan 2021 13:35 #193952
by tommylight
Replied by tommylight on topic HAL Driver for Raspberry PI GPIOs
Is the encoder wired to 7i92 or RPI?
Please Log in or Create an account to join the conversation.
Time to create page: 0.097 seconds