Glad it's working!
To use the config-pin utility you also have to load one of the universal
cape overlays (which will create the pinmux files in /sys/). It sounds
like you're making your own device-tree so you're fine. The universal
overlay files are for those who don't want to (or can't) create their
own device tree files.
On 5/16/2023 3:28 PM, fogl wrote:
Thank you for your reply. I modified the device PinMux to Mode5:
$cat /sys/kernel/debug/pinctrl/44e10800.pinmux-pinctrl-single/pins | grep
8a8
pin 42 (PIN42) 44e108a8 0000000d pinctrl-single
$cat /sys/kernel/debug/pinctrl/44e10800.pinmux-pinctrl-single/pins | grep
8ac
pin 43 (PIN43) 44e108ac 0000000d pinctrl-single
Now everything works fine, hank you :)
BTW, i did try to $ sudo config-pin P8.43 pruout, but it returned:
P8_43 pinmux file not found!
bash: /sys/devices/platform/ocp/ocp*P8_43_pinmux/state: No such file or
directory
Cannot write pinmux file: /sys/devices/platform/ocp/ocp*P8_43_pinmux/state
..but i did not investigate any further.
Regards
Klemen
On Tuesday, 16 May 2023 at 18:49:21 UTC+2 cha...@steinkuehler.net wrote:
The mode pr1_pru1_pru_r31_* is for PRU input (R31 is the direct input
register). Use the pr_pru_pru_r30 option (R30 is the PRU direct output
register) or something like the config-pin utility and universal overlay
which makes this simple for you, eg:
config-pin P8.43 pruout
On 5/16/2023 9:45 AM, fogl wrote:
Thank you for your reply.
Now i generated the device tree overlay to configured the P8_43 to Mode6
(pr1_pru1_pru_r31_2) and P8_44 to Mode6 (pr1_pru1_pru_r31_3). This was
successful:
$cat /sys/kernel/debug/pinctrl/44e10800.pinmux-pinctrl-single/pins | grep
8a8
pin 42 (PIN42) 44e108a8 00000016 pinctrl-single
$cat /sys/kernel/debug/pinctrl/44e10800.pinmux-pinctrl-single/pins | grep
8ac
pin 43 (PIN43) 44e108ac 00000016 pinctrl-single
i changed my .hal file to use pru1 and set the pins according to
numbering
scheme:
loadrt hal_pru_generic
prucode=/usr/lib/linuxcnc/rt-preempt/pru_generic.bin
pru=1 num_stepgens=1 halname=hpg
setp hpg.stepgen.00.steppin 1843
setp hpg.stepgen.00.dirpin 1844
...but i still see no output on the pins.
I noticed there is also Mode5 PinMux option with the pr_pru_pru_r30
available. Should i use this mode?
Regards
Klemen
On Tuesday, 16 May 2023 at 00:42:15 UTC+2 cha...@steinkuehler.net wrote:
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
cha...@steinkuehler.net
--
Charles Steinkuehler
cha...@steinkuehler.net
--
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/14aaa34c-128a-4b4d-3a55-0ee97d5c8fc6%40steinkuehler.net.