I'm  working on commercial  drive much more complex than what your doing but 
jog is a use case. we use  rtos not Linux but concept is the same.
While loops in interrupts bad practice might be causing problem and won't work 
in multithreaded environment.
We have a high speed periodic servo thread calculating next  command looking at 
desired speed etc. In a real  drive this requires a PID and some control theory 
that you wont need right now for your simple use case
 you also need a state machine the  start state is  fed by button pressed  
Interrupt Then you poll the button after press is first  detected for release 
you  need to communicate the release to the servo loop
A periodic task can be driven by software timers in a barebones  system 
The details  of implementing  this in Linux I can't help with
Good luck
Sent from Yahoo Mail on Android 
 
  On Fri, Dec 22, 2017 at 9:13 AM, Hugh Frater<[email protected]> wrote:   
I have a mechatronic device which has a couple of 'jog' buttons, these are 
working nicely on a interrupt. The interrupt code fires on level change then 
checks the value - corresponding code sections send a command to the PRU via 
/dev/rpmsg_pru31.
Part of the command sent is a numeric value representing the frequency of the 
pru_ecap PWM generation (this connects to an AC servo motor 'step' input)...
As you can now see, press the button, the motor moves, release the button & the 
frequency command sent is reduced to '0' and the PRU code stops the pwm 
generation.
What I've been playing around with today is making this a ramped (accelerated) 
jog. I can put a loop inside the interrupt code that increases the value of the 
numeric value, works fine, but I would like to delay the loop so the 
acceleration is more gradual. I've played around with a setTimeout function 
inside the loop, doesn't work.
I've moved this delayed loop to a separate function outside of the ISR. Inside 
the ISR I just loop in a do->while until the ramp generation code has 
incremented the value to a maximum, I then cancel the interval timer - this 
doesn't work either.
Is there a better way to do this that I've overlooked?



-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" 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/beagleboard/e2c31a95-5479-45b6-bc25-3082e485c772%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
  

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" 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/beagleboard/1943150257.2788628.1513972666463%40mail.yahoo.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to