
This project implements a UART-controlled servo positioning interface with a built-in sweep mode and inactivity failsafe.
At the default 25 MHz project clock, the design generates a repeating 20 ms frame on uo[0].
Within each frame, the high pulse width selects the servo position:
Feature summary:
The command interface is intentionally simple:
ui[0] receives UART data0 to 9 map to evenly spaced preset positions between minimum and maximumc or C selects the center presetm selects the minimum presetM selects the maximum presets or S enables an automatic sweep mode that steps through the preset range once per frameThe dedicated inputs ui[1], ui[2], and ui[3] force center, minimum, and
maximum output positions. These inputs take precedence over the UART-controlled
target and give a simple hardware override path.
The sweep mode repeatedly walks the target position between minimum and maximum. It is intended for bring-up and bench observation, where a moving output is easier to validate than a static preset.
A watchdog-style failsafe returns the output to center after a programmable number of inactive frames. This keeps the module useful as a practical command interface block rather than only as a waveform generator demo.
The design also exposes internal status on the regular Tiny Tapeout outputs:
uo[1] toggles each time a valid UART command is receiveduo[5:2] shows the currently selected preset codeuo[6] goes high while the failsafe mode is activeuo[7] goes high while the sweep mode is activeDrive the project with a 25 MHz clock and hold rst_n low during reset.
For direct input testing:
ui[1] high to force the center servo positionui[2] high to force the minimum servo positionui[3] high to force the maximum servo positionFor UART testing on ui[0]:
m for minimumM for maximumc or C for center0 to 9 for an intermediate presets or S to enable sweep modeExpected outputs:
uo[0] produces the servo control pulseuo[1] toggles on each accepted commanduo[5:2] reflects the selected preset numberuo[6] goes high when failsafe has forced the output back to centeruo[7] goes high while sweep mode is runningThe repository also includes a feature-oriented cocotb regression rooted at
test/test.py. The detailed coverage plan is documented in verif.md.
Recommended external hardware:
ui[0]uo[0]The servo must be powered externally. The Tiny Tapeout output only provides the control waveform.
| # | Input | Output | Bidirectional |
|---|---|---|---|
| 0 | UART RX | Servo PWM | |
| 1 | Center preset override | Command acknowledge toggle | |
| 2 | Minimum preset override | Preset code bit 0 | |
| 3 | Maximum preset override | Preset code bit 1 | |
| 4 | Preset code bit 2 | ||
| 5 | Preset code bit 3 | ||
| 6 | Failsafe active | ||
| 7 | Sweep mode active |