- Posts: 5
- Thank you received: 0
EMC2 running on Raspberry Pi?
mozmck wrote: Can you leave the pulse width static and vary the frequency easily and over a wide range with a DMA driven PWM?
Yes you can, with various techniques, although within limits. One limit is if you need too many DMA control blocks (if the increment granularity is very small (1us) and the frequency low (eg. 10Hz, because you need so long to jump back to the initial control block in the linked list). I will be testing the limits a bit over the weekend.
@PCW: The DMA driven stepgen idea sounds interesting.
Please Log in or Create an account to join the conversation.
So say I want a 5 usec pulse on the output, I have this data in the memory:
...
0000000
0000001
0000001
0000001
0000001
0000001
0000000
0000000
...
By varying the spacing of pulses in the memory record I can generate any step rate I want
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
PCW wrote: No PWM involved, all the DMA does is copy from an array in memory to the GPIO port (1 word per usec for example) By arranging things properly I can DMA data from memory continously
So say I want a 5 usec pulse on the output, I have this data in the memory:
...
0000000
0000001
0000001
0000001
0000001
0000001
0000000
0000000
...
By varying the spacing of pulses in the memory record I can generate any step rate I want
We still use the PWM/PCM hardware for the DMA timings (set to 10MHz in here: github.com/metachris/RPIO/blob/master/source/c_pwm/pwm.c#L599 ), and the DMA writes our memory to the GPIOs. Apps using this would need to write the memory pretty well timed, in order to avoid duplicate step instructions. We could possibly program the DMA part so it does not repeat steps once they were executed (lets hope we do not need this). How exactly can we time the writes in LinuxCNC?
If this runs at 1MHz, that requires the app to write 1M of control instructions every second, and we'd have a million possible step instructions per second. What is typically needed by steppers with LinuxCNC or achieved by hardware drivers?
Please Log in or Create an account to join the conversation.
- mhaberler
- New Member
-
- Thank you received: 0
the standard 'servo cycle' - the rate by which target positions are updated - is 1 kHz, but some people run this at higher rates up to maybe 10 kHz max; that would also be the rate by which stepper speed gets adjusted
PCW probably can fill in better as what maximum realistic step rates are but lets assume worst-case with fine microstepping:
I wouldnt assume step rates would exceed 100kHz
so as a ballpark figure per servo cycle you'd have maximum 100 steps per servo cycle
maybe a viable method is to use a dual-buffer scheme and switch the DMA between sample buffers at servo rate to avoid sync problems
- Michael
Please Log in or Create an account to join the conversation.