Most if not all Microcontrollers have buitlin hardware on some pin to capture value of counters. It is usually if not always possible to count time but some may be possible to connect to a qudrature encoder. Then counting time resolution is probably around 10ns depending on Micro controller clock frequency while then used for quadrature encoder capture current position value. Nicklas Karlsson
Den Måndag, September 28, 2026 05:51 CEST, skrev Chris Albertson <[email protected]>: > On Sep 27, 2026, at 2:43 PM, Peter Wallace <[email protected]> wrote: > > On Sun, 27 Sep 2026, Chris Albertson wrote: > >> I like the way Klipper solved the communications jitter issue. Kiliiper is a >> lot like LCNC. There is a central Linux computer that reads the G-code file, >> does planning and the math, and then the low-level stuff like generating >> wavforms to drive a stepper motor or whatever is some on microcontrollers >> that can be truely ?hard? real time. >> >> What Klipper does is simple. The microcontroller clocks are synchronized to >> the Linux system. Then the Linux host attaches a ?target time? with each >> movement command. The microcontroller then buffers the command until the >> exact right time. This way, millisecond-level RT jitter in Linux does not >> show up on the motors. >> >> This way, one can get 10-microsecond-level timing without real-time Linux. > > > The difference is that LinuxCNC is an unbuffered system at the motion level. > Buffering removes the real time requirement from the upper level controller > but loses the ability for the upper level controller and therefore motion to > repond to real time inputs. > The way Klipper works for a real-time event like hitting a limit switch is that the microcontroller is interrupted. The controller captures the clock and then invalidates the buffer and sends the captured clock value back to the Linux computer. What makes this work so well is that, unlike Linux, a typical microcontroller can capture a clock or timer value on an interrupt entirely in hardware, without needing software to manually read the timer. We can get nanosecond or microsecond timing even in a buffered system. The other thing that makes this work is the Linux system continuously polls the microcontroller’s clock and maintains a transformation equation that accounts for any difference in phase and rate between the two clocks. I don’t think all real-time events have to clear the buffer. I’m not expert enough on details like that. But because the clocks are tracked, the Linux machine can drive any reasonable number of microcontrollers using CAN bus, serial, USB or whatever. Another advantage is that this system can be very low cost. I can use a $4 rp2040 development board to drive a stepper at one million steps per second. Better microcontrollers do better. No one will implement this. It is too much work. _______________________________________________ Emc-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/emc-users _______________________________________________ Emc-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/emc-users
