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=100000 fp1=0 name2=servo-thread
period2=1000000 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.update            servo-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.update            servo-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.dirsetup        200
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.maxaccel        2000.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:
    106        s32   OUT          7000  hpg.capture-position.time
     ----
    106        s32   I/O         13083  hpg.capture-position.tmax
     ----
    106        bit   OUT         FALSE  hpg.capture-position.tmax-inc
     ----
    106        bit   IN          FALSE  hpg.stepgen.00.control-type
     --l-
    106        s32   OUT         45653  hpg.stepgen.00.counts
     --l-
    106        float OUT     -7707.206  hpg.stepgen.00.dbg_err_at_match
     0.000010 --l-
    106        float OUT             0  hpg.stepgen.00.dbg_ff_vel
     0.000010 --l-
    106        float OUT     -7717.106  hpg.stepgen.00.dbg_pos_minus_prev_cmd
   0.000010 --l-
    106        float OUT           0.1  hpg.stepgen.00.dbg_s_to_match
     0.000010 --l-
    106        s32   OUT       5368709  hpg.stepgen.00.dbg_step_rate
     --l-
    106        float OUT           200  hpg.stepgen.00.dbg_vel_error
     0.000010 --l-
    106        u32   IN     0x000000C8  hpg.stepgen.00.dirhold
     --l-
    106        u32   IN     0x0000032C  hpg.stepgen.00.dirpin
     --l-
    106        u32   IN     0x000000C8  hpg.stepgen.00.dirsetup
     --l-
    106        bit   IN           TRUE  hpg.stepgen.00.enable
     --l-
    106        float IN           2000  hpg.stepgen.00.maxaccel
     0.000010 --l-
    106        float IN            200  hpg.stepgen.00.maxvel
     0.000010 --l-
    106        float IN              0  hpg.stepgen.00.minvel
     0.000010 --l-
    106        float IN          10000  hpg.stepgen.00.position-cmd
     0.000010 --l-
    106        float OUT      2284.294  hpg.stepgen.00.position-fb
     0.000010 --l-
    106        float IN             20  hpg.stepgen.00.position-scale
     0.000010 --l-
    106        bit   IN          FALSE  hpg.stepgen.00.stepinvert
     --l-
    106        u32   IN     0x000003E8  hpg.stepgen.00.steplen
     --l-
    106        u32   IN     0x0000032D  hpg.stepgen.00.steppin
     --l-
    106        u32   IN     0x000003E8  hpg.stepgen.00.stepspace
     --l-
    106        s32   OUT     385815358  hpg.stepgen.00.test1
     --l-
    106        s32   OUT         45697  hpg.stepgen.00.test2
     --l-
    106        s32   OUT    -1299849246  hpg.stepgen.00.test3
       --l-
    106        float IN              0  hpg.stepgen.00.velocity-cmd
     0.000010 --l-
    106        float OUT           200  hpg.stepgen.00.velocity-fb
     0.000010 --l-

    106        s32   OUT          8582  hpg.update.time
     ----
    106        s32   I/O         54414  hpg.update.tmax
     ----
    106        bit   OUT         FALSE  hpg.update.tmax-inc
     ----


*$ uname -a*
Linux beaglebone 4.19.120-bone-rt-r50 #1stretch PREEMPT RT Fri May 8
22:45:31 UTC 2020 armv7l GNU/Linux

*$ ls /proc/device-tree/chosen/overlays/*
AM335X-PRU-UIO-00A0  BB-ADC-00A0  BB-BONE-eMMC1-01-00A0
  BB-HDMI-TDA998x-00A0  name


--
Charles Steinkuehler
char...@steinkuehler.net

--
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/52c15f26-6ccc-54c6-e89e-08ab3a354178%40steinkuehler.net.

Reply via email to