Hello,
I have more or less finished the alpha version of the firmware and software.
So far, I have supported the following features on Teensy4.1:
- UDP communication with custom message protocol
- 4 stepgen generators (for steppers) with fixed / controllable pulse widths and frequencies up to several MHz, or alternatively
- 4 PWMs with fixed and controllable frequency and 12 bit PWM resolutions
- 4 H/W high speed quadrature encoders ( A/B )
- 14 GPIO: 7 inputs, 7 outputs (hardcoded)
Since signal generation and encoder readout are done in hardware, Teensy does not have much to do and is mostly waiting in the main loop for a new command to come - plenty of room for future expansions!
I wrote realtime HAL component for communication with Teensy from LinuxCNC. Run from LinuxCNC, I am able to achieve 60us roundtrips with 40byte payload. I have written a simple HAL example for a simple servo loop, and have tested the servo loop on a single axis kinematic stage, equipped with high-precision encoder and a DC motor run by a small H-bridge driver.
I did some serious testing at 1ms servo-threads over several hours with no problems whatsoever.
I was also able to run servo-thread with 150us (6600Hz) without any problems, but I haven't spent much time testing it and don't know how stable it really is at this speeds.
Once I reach the beta-state of the software my goal is to publish the code on GitHub, if there would be enough interest.
There is of course still a lot of stuff left behind. Currently, I am fixing some bugs and adding support for the following:
- 8 channel 16-bit DAC (SPI)
- 4 channel 12-bit internal Teensy's ADCs with DMA.
- counting stepgen cycles for position feedback
In the future, I would like to implement synchronized/distributed clock using PTP (IEEE1588) as supported by Teensy4.1.
Since I am by no means an expert on the topic, any help or advice on PTP and its implementation would be much appreciated.
Regards,
Jaka