I got it working. At least with X axis. I have to do some pid and servo 
tuning, but at least the position feedback is working.

In the .ini file I have:
CONFIG=pru=0 num_stepgens=3 num_encoders=3 disabled=0

and in .hal file:
setp hpg.encoder.00.chan.00.A-pin 7
setp hpg.encoder.00.chan.00.B-pin 5
setp hpg.encoder.00.chan.00.scale [AXIS_0]ENCODER_SCALE

net motor.00.pos-fb <= hpg.encoder.00.chan.00.position axis.0.motor-pos-fb 
pid.0.feedback

And I didn't understand at first where I can get the number (A-pin 7 and 
B-pin 5).  They can be found in the pinmux.ods file 
(https://github.com/cdsteinkuehler/beaglebone-black-pinmux/blob/hal_pru_generic/pinmux.ods)
 
from column K
A P9:25 -> pr1_pru0_pru_r31_1 -> 1
B P9:27 -> pr1_pru0_pru_r31_5 -> 5

lauantai 18. marraskuuta 2023 klo 17.37.50 UTC+2 cdstein...@gmail.com 
kirjoitti:

> By default, the step/dir pins use GPIO access which is valid for either 
> PRU core. The encoder signals, however, need to be direct PRU inputs, so 
> the pins chosen and the pinmux setup will need to be valid for the specific 
> PRU core you choose to run the driver. You setup the pin multiplexing 
> outside of Machinekit/HAL, typically with a device-tree overlay, or the 
> universal pinmux overlay and config-pin utility.
>
> Some details on pin selection can be found in the PRU driver man page:
>
> https://www.machinekit.io/docs/man/man9/hal_pru_generic/  
>
> On Friday, November 17, 2023 at 3:25:37 AM UTC-6 Antti wrote:
>
>> Hello
>>
>> I have made my DIY CNC milling machine with BBB and DIY cape. I used 
>> ARM.BeagleBone.Xylotex setup as base and modified that to work with my 
>> machine. 
>> I used old Omron servo drivers and motors with DIR and STEP signals. It 
>> kinda works but now I'd like to add feedback signals from servos to BBB 
>> (2048 pls/rev).
>>
>> So there is quadrature signals from X, Y and Z. I'm planning to use these 
>> pins P9:25, P9:27, P9:28, P9:29, P9:30, P9:31
>> I have understood that these pins are in PRU0 and first I have to config 
>> the those as "pruin" in setup.sh file?
>>
>> Then the ini-file now:
>> [PRUCONF]
>> DRIVER=hal_pru_generic
>> CONFIG=pru=1 num_stepgens=3
>> PRUBIN=xenomai/pru_generic.bin
>>
>> so can I change it to:
>> CONFIG=pru=0 num_stepgens=3 num_encoders=3
>>
>> And how to I do the HAL wiring?
>>
>> Here is the pins that are in use now:
>> P8.07 out # gpio2.2 Enable System
>> P8.10 in # gpio2.4 XLIM
>> P8.11 out # gpio1.13 X_Dir
>> P8.12 out # gpio1.12 X_Step
>> P8.13 out # gpio0.23 PWM0/SPINDLE
>> P8.14 in # gpio0.26 YLIM
>> P8.15 out # gpio1.15 Y_Dir
>> P8.16 out # gpio1.14 Y_Step
>> P8.18 in # gpio2.1 ZLIM
>> P9.15 out # gpio1.16 Z_Step
>> P9.23 out # gpio1.17 Z_Dir
>> P8.09 in # gpio2.5 STOPin
>> Are these step/dir signals used by PRU 1? Or can I use these with PRU 0?
>>
>>

-- 
website: http://www.machinekit.io blog: http://blog.machinekit.io github: 
https://github.com/machinekit
--- 
You received this message because you are subscribed to the Google Groups 
"Machinekit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to machinekit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/machinekit/99a5241c-0209-41d5-b809-63f6a27c60fbn%40googlegroups.com.

Reply via email to