Hi, It look like a "PRU hunting" issue. When the stepgen try to reach "position-cmd", due to internal calculation with float variables, it is common that the stepgen algo. cannot reach a stable state at 0 speed. It sort oscillate between fraction of +/-0.0...1 "step" and trigger a direction change every period of the servo loop. A "minvel" parameters has been added to the stepgen to avoid that, to try it add the line: setp hpg.stepgen.00.minvel 0.001 This will "stop" the stepgen to generate step&direction change when the velocity goes bellow 0.001 (in practice it means a null velocity - motor stopped). Try with higher values (0.01, 0.1) if you still see the problem. To find a "good" value, you can decrease this value until the problem appear again, and multiply by a factor 10 that limit value.
Another more proper way is to use the halscope and look at the signal "hpg.stepgen.00.velocity-fb", you will probably see this value going a little positive and negative at "0" speed, you need to set "hpg.stepgen.00.minvel" above the maximum/minimum value "hpg.stepgen.00.velocity-fb" at 0 speed, do x2 or x3 on this value for some margin and use that for minvel. Hope this will solve your problem. /Damien On Friday, 31 January 2020 05:26:46 UTC+1, jgnoss wrote: > > > > I'm playing around with hal_pru_generic and it's stepgen. > > here the config > > loadusr -w ./setup.sh > loadusr -w config-pin -f ./pru_stepgen.bbio > > loadrt threads name1=fast period1=100000 > # loadrt hal_bb_gpio input_pins=817 output_pins=912,817,818,923 > loadrt hal_bb_gpio output_pins=912,923 > loadrt hal_pru_generic > prucode=/usr/lib/linuxcnc/rt-preempt/pru_generic.bin pru=1 halname=hpg > num_stepgens=1 pru_period=2500 > loadrt hal_arm335xQEP encoders=eQEP0 > > > setp eQEP0.position-scale 13.33333 > > net enable bb_gpio.p9.out-12 => hpg.stepgen.00.enable > net pulse eQEP0.position => hpg.stepgen.00.position-cmd > > setp hpg.stepgen.00.dirpin 817 > setp hpg.stepgen.00.steppin 818 > setp hpg.stepgen.00.stepinvert 1 > setp hpg.stepgen.00.steplen 500 > setp hpg.stepgen.00.stepspace 500 > setp hpg.stepgen.00.dirsetup 500 > setp hpg.stepgen.00.maxvel 10000 > setp hpg.stepgen.00.maxaccel 15000 > setp hpg.stepgen.00.position-scale 8.88888 > > addf bb_gpio.read fast > addf eqep.update fast > addf hpg.capture-position fast > addf bb_gpio.write fast > addf hpg.update fast > > and .bbio > > overlay cape-universal > overlay cape-bone-iio > #overlay cape-univ-emmc > > > P9_12 low #enable > P8_17 low #dir > P8_18 low #step > P9_23 low #Machine Power > P8_26 high #Estop out > > You might see, idea of that test is, to move the step motor as the encoder > turns > > The motor doesn't turn, he just sits there wiggling and making strange > noise. > > going behind that, I see a strange behavior on the dir signal, see > pictures. > > Any idea why is that? > > ju > -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/machinekit/4b02cb74-24d9-4bdc-9da2-1510d7fc7c46%40googlegroups.com.
