UBB pattern generator
werner at almesberger.net
Wed Jan 16 10:42:06 EST 2013
Let's make more interesting things with UBB, for example a pattern
generator. This uses the MMC controller and DMA to obtain precise
- four digital channels
- pattern rate 41 kHz to 56 MHz (142 different rates selectable)
- maximum pattern length 8128 nibbles
- optional external trigger with sequence triggering, debouncing,
and trigger delay (the implementation of the trigger is not very
aggressive and the trigger can lag in the millisecond range)
- can also generate a continuous clock signal (instead of the
arbitrary but finite pattern)
The code lives here:
There's quite a lot of options. They're described in
The external hardware is very simple. The only external circuit
the pattern generator needs is a resistor that pulls down CMD to
fake a response from the device.
Schematics and a sheet with cut-out labels are here:
The following picture shows the pattern generator at work:
The Ben on the right runs the pattern generator. It is set to
output a pattern corresponding to the string "Hi!\r" in RS232
format. The pattern rate is set to nominally 115 kHz for which
ubb-patget selects a 114.13 kHz clock.
Channel 0 (DAT0) is connected to the Ben on the left that runs
TRIG/CLK is pulled up (by previously running "ubbctl clk=r")
and a button to ground is connected externally. The trigger is
set to "0" with 100 us debouncing.
The oscilloscope shows TRIG/CLK on top and DAT0 at the bottom.
One horizontal division is 100 us.
Here is a cheat sheet with the available clock frequencies:
More information about the discussion