A Heavy Overclock Pushes PAL-Standard Video From a Raspberry Pi RP2040's PIO Blocks

With a minimum of additional components and a hevty overclock to 312MHz, this project offers color imagery on a PAL-standard TV.

Gareth Halfacree
1 year agoRetro Tech / HW101

Semi-pseudonymous maker "Fred," also known as "guruofthree," has pushed a Raspberry Pi RP2040 microcontroller to its absolute limit in order to generate a compliant PAL-standard composite video signal with no additional hardware bar a simple resistor ladder as a digital-to-analog converter — though warns the project isn't for the faint of heart.

"[I've been] trying to get the Raspberry Pi RP2040 chip's PIO [Programmable Input/Output blocks] to generate a colour PAL composite video signal, using only a resistor ladder digital-to-analogue converter (DAC)," Fred writes of the project. "Due to the technical limitations of RAM and DAC timings, the best I was able to get displayed was either a 'high resolution' 164×125 image, or a 'horizontal doubled' anamorphic image, stretched back out to 328×125. I have a lot more appreciation for the engineers of the 80s that did better than this with a chip running 1/200th the speed!"

The PAL standard uses phase-alternating line encoding to put color information into analog television signals — equivalent to NTSC in the US or SECAM in France. Luminance and chrominance are bundled together into a single signal, transmitted in this case down a single wire to a compatible TV's RCA jack — providing a full-color image at the receiving end.

Getting a composite video output from a microcontroller is pretty easy, if you're not too fussy about it being in black and white. Adding color can be more of a challenge, as Fred's work shows — and doing it using the PIO blocks of the RP2040, which allow the user to create state machines that run independently of the microcontrollers two Arm cores, is hard work, which is why Fred found the project dead in the water until the microcontroller was overclocked to an impressive 241 percent of its stock clock.

"I believe I have partially broken at least one RP2040 working on this," Fred admits. "It no longer registers when plugged into some computers and the GPIO [General-Purpose Input/Output pins] seems to have 5V coming out. As for my specific hardware, I've used both a Pimoroni Tiny2040 and a regular [Raspberry Pi] Pico, [and] I've built two different simple (read: less precise) resistor DACs.

"I'm super pleased with the whole thing. It feels like it's been a personal tour de force of a dozen things, not limited to the PIO, DMA, memory layout, PAL, timings, and pointers…"

Anyone looking to follow in Fred's footsteps, and with a PAL-compatible display device, can find the source code and demos on GitHub under the permissive MIT license.

Gareth Halfacree
Freelance journalist, technical author, hacker, tinkerer, erstwhile sysadmin. For hire: freelance@halfacree.co.uk.
Latest articles
Sponsored articles
Related articles
Latest articles
Read more
Related articles