Skip to content

NTSC Video Out

Kurt Kiefer edited this page Feb 27, 2016 · 11 revisions

Notes before starting

Boards from Get round 1 (green boards) and round 2 (blue boards, also store orders before Mar 2016) have the wrong resistor values to support video out. Additionally, round 2 boards have the uFL connector on upside-down. Round 3 (closing beginning of Mar 2016) will be ready for video.

More info to follow regarding the necessary modifications to your board if you wish to support this feature.

Performance

Composite video-out on PT1 is performed by a basic 4-bit DAC. Currently the output is only grayscale, so the luminance resolution is somewhat poor. See this PT1 example video output.

The 14.318182 MHz system clock provides the clocks that make color technically possible (it was prototyped with a test pattern), and that should go a long way to improving the resolution visually on this system. However, it will require some more development work to realize this. If you feel like working on this feature, pull requests are very welcome ;)

Cabling

The PureThermal 1 board has a Hirose u.FL connector on the back that is hooked up through adder circuitry to timers on the STM32, and this can be used to generate NTSC video.

To adapt this signal to an RCA video cable, we suggest a u.FL to SMA pigtail, and then an SMA to BNC and BNC to RCA, or direct SMA to RCA adapter.

Code

See branch analog-video-dma-gpio

Methodology

A single timer (TIM1) runs at 30x the NTSC color carrier rate (30x 3.57955 MHz, or 107.386 MHz). Its auto-reload register (ARR) is set to 14, so it generates a timer update event at 7.15909 MHz, which in turn is hooked up to a DMA controller that outputs to the GPIO Port B value register. GPIO Port B consists of 4 outputs that are wired through resistors in parallel to the video connector, which forms a rudimentary 4-bit DAC.

We can generate an output waveform by creating a series of values that get sent out to the 4-bit DAC with DMA. In general, this is done one line at a time. The beginning of the line contains the embedded horizontal sync. After the sync, the voltage amplitude of the DAC basically controls the brightness level you see for each pixel on the screen as you scan from left to right.

A square wave on this waveform can approximate the color carrier on the composite video signal, and then changing the value of the TIM1 auto-reload register (ARR) by small amounts allows us to shift the waveform left or right to realize color.

Clone this wiki locally