You likely need to configure the pin multiplexing for the pins you wish
to use so they can be controlled by the PRU. This is typically done via
a device-tree overlay, or something like cape-universal and the
config-pin utility if you don't like making device-tree files:
https://github.com/cdsteinkuehler/beaglebone-universal-io
On 5/15/2023 1:18 PM, fogl wrote:
Hello everybody,
I am still trying to run the stepper motor with Machinekit. I configured
the hal and i was expecting some step/dir signal on the output pins, but
nothing happens (i am monitoring with the oscilloscope).
I tried to generate steps by changing the hpg.stepgen.00.position-cmd
signal. I could see the hpg.stepgen.00.position-fb signal that was
folowing. So everything seems fine here.
The problem seems to be in the output pin configuration. I tried different
kind of options:
- to change the pru number from pru=0 to pru=1
- i tried to change the pin location
Can you please suggest what could be the problem,
Regards
Klemen
*my .hal configuration*
loadrt threads name1=base-thread period1=10 fp1=0 name2=servo-thread
period2=100 fp2=1
loadrt hal_bb_gpio user_leds=0,1,2,3
loadrt hal_pru_generic prucode=/usr/lib/linuxcnc/rt-preempt/pru_generic.bin
pru=1 num_stepgens=1 halname=hpg
loadrt siggen num_chan=1
addf bb_gpio.write base-thread
addf bb_gpio.read base-thread
addf siggen.0.updateservo-thread
addf hpg.capture-position servo-thread
addf hpg.update servo-thread
ddf bb_gpio.write base-thread
addf bb_gpio.read base-thread
addf siggen.0.updateservo-thread
addf hpg.capture-position servo-thread
addf hpg.update servo-thread
setp siggen.0.frequency 2
net ledlight siggen.0.clock => bb_gpio.userled3
# stepper timing parameters in nanoseconds
setp hpg.stepgen.00.dirsetup200
setp hpg.stepgen.00.dirhold 200
setp hpg.stepgen.00.steplen 1000
setp hpg.stepgen.00.stepspace 1000
setp hpg.stepgen.00.position-scale 20
setp hpg.stepgen.00.maxvel 200.0
setp hpg.stepgen.00.maxaccel2000.0
#setp hpg.stepgen.00.step_type 0
# P8.12 GPIO1_12 0x4C
# P8.11 GPIO1_13 0x4D
# P8.43 PRU1.out2: 812
# P8.44 PRU1.out4: 813
setp hpg.stepgen.00.steppin 813
setp hpg.stepgen.00.dirpin 812
*halcmd: show pin hpg.*
Component Pins:
Comp Inst Type Dir Value Name
Epsilon Flags linked to:
106s32 OUT 7000 hpg.capture-position.time
106s32 I/O 13083 hpg.capture-position.tmax
106bit OUT FALSE hpg.capture-position.tmax-inc
106bit IN FALSE hpg.stepgen.00.control-type
--l-
106s32 OUT 45653 hpg.stepgen.00.counts
--l-
106float OUT -7707.206 hpg.stepgen.00.dbg_err_at_match
0.10 --l-
106float OUT 0 hpg.stepgen.00.dbg_ff_vel
0.10 --l-
106float OUT -7717.106 hpg.stepgen.00.dbg_pos_minus_prev_cmd
0.10 --l-
106float OUT 0.1 hpg.stepgen.00.dbg_s_to_match
0.10 --l-
106s32 OUT 5368709 hpg.stepgen.00.dbg_step_rate
--l-
106float OUT 200 hpg.stepgen.00.dbg_vel_error
0.10 --l-
106u32 IN 0x00C8 hpg.stepgen.00.dirhold
--l-
106u32 IN 0x032C hpg.stepgen.00.dirpin
--l-
106u32 IN 0x00C8 hpg.stepgen.00.dirsetup
--l-
106bit IN TRUE hpg.stepgen.00.enable
--l-
106float IN 2000 hpg.stepgen.00.maxaccel
0.10 --l-
106float IN200 hpg.stepgen.00.maxvel
0.10 --l-
106float IN 0 hpg.stepgen.00.minvel
0.10 --l-
106float IN 1 hpg.stepgen.00.position-cmd
0.10 --l-
106float OUT 2284.294 hpg.stepgen.00.position-fb
0.10 --l-
106float IN 20 hpg.stepgen.00.position-scale
0.10 --l-
106bit IN FALSE hpg.stepgen.00.stepinvert
--l-
106u32 IN 0x03E8 hpg.stepgen.00.steplen
--l-
106u32 IN 0x032D hpg.stepgen.00.steppin
--l-
106u32 IN 0x03E8 hpg.stepgen.00.stepspace
--l-
106s32 OUT 385815358 hpg.stepgen.00.test1
--l-
106s32 OUT 45697 hpg.stepgen.00.test2
--l-
106s32 OUT-1299849246 hpg.stepgen.00.test3
--l-
106float IN 0 hpg.stepgen.00.velocity-cmd
0.10 --l-
106float OUT 200 hpg.stepgen.00.velocity-fb
0.10 --l-
106s32 OUT 8582 hpg.update.time
106s32 I/O