|
|
|
|
|
by jws
2275 days ago
|
|
You can't really bang bits like you can with carefully cycle counted code on something like an Arduino, but you can put all your bits into a good sized buffer and use DMA to push them out a stable, hardware clocked rate. You still have to be able ping pong your buffers fast enough and that isn't really guaranteed, but for large enough buffers can be made to work, mostly, probably, well… except when… This technique doesn't work when you need to respond to inputs rapidly, but is fine for driving steppers. I see he appears to have gone with servos and encoders, so that would be a bit of a problem since there are inputs to be read. |
|
Sure, time-honored technique for audio. Very on the mark.
But it doesn't really fix the "latency is forever" problem. Buffer too much and your control will lag. Too little and buffers can bottom-out. Best is to over-spec the metal and then be the only code on it so you don't need to buffer at all.
(Worst is, you didn't get to spec the metal, and there's a whole OS full of someone else's Bright Ideas between you and that 200us-or-the-reactor-goes-blooie control loop. Good luck, you're gonna need it).