Bitbanged DVI On A Raspberry Pi RP2040 Microcontroller

When we first saw the Raspberry Pi Pico and its RP2040 microcontroller last month it was obvious that to be more than just yet another ARM chip it needed something special, and that appeared to be present in the form of its onboard PIO peripherals. We were eagerly awaiting how the community might use them to push the RP2040 capabilities beyond their advertised limits. Now [Luke Wren] provides us with an example, as he pushes an RP2040 to produce a DVI signal suitable to drive an HDMI monitor.

It shouldn’t be a surprise that the chip can be overclocked, however it’s impressive to find that it can reach the 252 MHz necessary to generate the DVI timing. With appropriate terminations it proved possible for the GPIO lines to mimic the differential signalling required by the spec. A PCB with the RP2040 and an HDMI socket was created, also providing a couple of PMOD connectors for expansion. All code and software can be found in a GitHub repository.

The result is a usable DVI output which though it is a relatively low resolution 640×480 pixels at 60 Hz is still a major advance over the usual composite video provided by microcontroller projects. With composite support on monitors becoming a legacy item it’s a welcome sight to see an accessible path to an HDMI or DVI output without using an FPGA.

Thanks [BaldPower] for the tip.

66 thoughts on “Bitbanged DVI On A Raspberry Pi RP2040 Microcontroller

        1. You’re shopping on the wrong sites. Go to the Raspberry Pi foundation’s site and from there go to their recommended suppliers for your country. Amazon is not your friend here.

          1. Definitely this – for small, cheap electronics like this its like amazon has a minimum price almost. You probably won’t get it as fast, but it will be cheap and you’ll be supporing RPi

      1. Tell that to Mattel. If you’re qualified to issue 100ku POs, they’ll fulfill them.

        And there are many products for which the market would saturate far below 100 ku. Very large diesel engines for supertankers and advanced semiconductor photolithography projectors both come to mind…

        If, however, you’re trying to denigrate this microcontroller by labeling it a ‘toy’… perhaps you’re merely outside Hackaday’s marketing demographic?

    1. RS are selling reels of 480 due for dispatch at the start of March. I probably don’t have the right price showing as it’s more expensive per unit for the bare RP2040 than other retailers sell the retail board for.

  1. Seems like you could make an MDA/Hercules->SVGA adapter from this. If it can run 640x480xRGB565, then it should be able to run 720x348x1. It might even be able to run it at 800x600xRGB332, if you could bring the clock could up to about 315MHz, and if there’s a little ram left. That could make a nice adapter to convert old videocard’s RGBI to SVGA.

        1. Nope, it’s a dual-core Cortex @ 133 MHz.

          Just insanely capable. I mean, I’ll be *shocked* if the actual microcontroller’s $4 when it’s available, but what with the ESPxxx being obscenely cheap my entire idea of what’s possible in the under-$5 space is just broken nowadays (if *only* it had the possibility for higher-speed USB…).

          1. Yeah, the processing power you can get for less than $10 is mind blowing. Desktop CPUs are better value, but they are also expensive so it seems less impressive.
            And the ESP32 Wrover chips with 8MB of RAM are $4.50 CANADIAN. It’s nuts.
            And the Pi0 for $7.50 CAD is also damn impressive.

          2. Depending on what you need or want, a dedicated USB 3 peripheral chip might suffice. The RP2040 can almost certainly supply the desired device functionality.

  2. Every time I look at the RP2040’s specs, I just want to cry. High speed core: awesome. Programmable interfaces: super-great. On board USB? Fantas… wait, what? Full-speed USB? Like… “slower than a decent UART” USB?

    I just imagine it (and the PSoC 6) like hooking up a supercomputer cluster to a freaking dial-up modem.

    Literally! Gigabit data output through the PIOs… and an 11 Mbps (half-duplex!) interface to a computer. *bangs head on desk*

      1. I know, I know. The problem is that there’s such a massive jump from USB full speed to high speed throughput. Theoretically it’s nearly a freaking factor of 100 in throughput difference.

        And pretty much the only player in the “~10 MB/s throughput to nearly arbitrary interface + smarts” space is like, the Cypress FX2, and it’s expensive, quirky as hell, and has huge reliability issues (enough so that I won’t use them again).

        I mean, an FT2232 + low-cost FPGA with a softcore running on it is actually a good option, but then you’ve got to convince people “no, it’s fine, instead of using a nice simple IDE it’s OK to use a cooked-up SoC with documentation I wrote over the weekend.” So I usually end up with an FT2232HQ, an onboard microcontroller for the smarts, and a larger FPGA for the interface. Which is just… a mess.

        1. ST has some parts with integrated HS PHY, and many more where you can connect one via ULPI. A HS PHY has very large driver transistors that take significant die space. Probably not too many non-bridge (USB to ethernet, USB to sata, USB audio, …) applications need the speed to make that worthwhile. The FX2 is also mostly a USB fifo…

          For fpga I just attach an external phy to it. It costs 1 euro… There are many USB cores on the internet that work well.

          1. “ST has some parts with integrated HS PHY”

            Yes… but no programmable IO. Those chips have the *opposite* problem – a firehose of a connection and only limited ways to generate that data (I mean, kindof. Obviously they’ve got a slew of comms interfaces, but they really might as well be tinkertoys compared to the PIOs).

            “For fpga I just attach an external phy to it. It costs 1 euro… There are many USB cores on the internet that work well.”

            Yes, but USB inside the FPGA means you can’t program/debug it via USB. I mean… you *kinda* can, indirectly, if you have like a golden image/etc. thing. But an FT2232HQ’s just a few bucks and you’ve instantly got combination high data throughput + no need for a debugger/programmer.

    1. Even full speed USB is 12Mbit/sec, I’d love to know where you can find a UART running at that speed. It’s part of a 4$ microcontroller dev board. You want faster than that? Buy a Pi Zero instead, for a whole extra $. Ye gods, the entitlement of some folks.

      1. “I’d love to know where you can find a UART running at that speed.”

        Uh… every single FT2232HQ on my desk? And it’s full duplex! Halfway decent microcontrollers should have at least 4 Mbaud as well, and even 4 Mbaud full duplex with only 25% overhead-ish should easily challenge USB’s overhead.

        “You want faster than that? Buy a Pi Zero instead, for a whole extra $.”

        Wait, the Pi Zero has programmable I/Os capable of doing 100+ Mbit/s input/output? How have I missed this?

    2. It’s meant to be a microcontroller, not a computer. It’s supposed to flash some LEDs, read some sensors and maybe even turn some motors on and off. What are you going to do with faster USB?

        1. Its not got enough memory of any sort on board to take noticeable to human scale time to empty or write it all (and you probably have to wait on the storage device not the usb link)…

          And saturating that USB link with sensor output (or any other meaningful output the chip could create) would be really quite challenging.. Certainly possible, but seriously its not the point of the chip!

          1. Wait, you think it’d be hard to saturate a link that maxes out at ~1 MB/s total throughput with a 133 MHz processor and 200+ kB of RAM? I could’ve done that 20 years ago with a processor 1/4 the speed!

            Or did you mean you wouldn’t be able to saturate a high-speed link? Sure, obviously not. But there’s a factor of 100 gap between USB full speed and high speed, and the PIOs generate and consume data at or beyond USB full speed.

            “Certainly possible, but seriously its not the point of the chip!”

            It’s not the point of a microcontroller to be able to interface with devices and output that data efficiently?

            Really, I get that it’s first silicon, and obviously it’s $4. But it’s essentially “cheaper/better PSoC” – USB 2.0 (even as a higher device option – which please please please let it be coming) would turn it into “OK never think about a PSoC again.”

          2. Absolutely not the point of the chip. Pat what exactly do you think the use case is here for needing a gigabit connection out of this chip? And yeah of course you CAN saturate it but that doesn’t mean it is likely. This is a chip meant for running little led displays and shit, not for collecting and and transmitting huge swaths of data. You wouldn’t buy a Ferrari then complain it can’t pull a trailer even though it technically has the horsepower for it.

          3. “Absolutely not the point of the chip. Pat what exactly do you think the use case is here for needing a gigabit connection out of this chip?”

            Who said anything about a gigabit connection?! It’s got a *12 Mbit connection*. Of *course* you can saturate that!

            Fundamentally, the chip’s very similar to a PSoC, which *also* only has USB full speed, and people (obv. including me) have been crowing about wanting a PSoC with USB high speed for *years*.

            “This is a chip meant for running little led displays and shit, not for collecting and and transmitting huge swaths of data.”

            Great! So you don’t think I can max out a 12 Mbit/s link for a giant LED array? Of *course* you can!

            Yes, of course you can glom on additional hardware to get higher throughput. Duh. It’s just a shame that there’s a nice USB controller sitting there that’s chained to a tin can on a string, when there are these high-speed programmable IOs that could’ve been leveraged.

          4. “Who said anything about a gigabit connection?! It’s got a *12 Mbit connection*. Of *course* you can saturate that!”

            You’re the one who brought up gigabit speeds in the first place…

            “Literally! Gigabit data output through the PIOs… and an 11 Mbps (half-duplex!) interface to a computer. *bangs head on desk*”

            “Great! So you don’t think I can max out a 12 Mbit/s link for a giant LED array? Of *course* you can!”

            No, I said LED array. Not “giant” LED array. Why would I use a $4 Pi for a giant array? I wouldn’t. Here’s a question, can you complain pointlessly about how a board is not capable of doing things it was not designed to do? Of *course* you can!

            At the end of the day this is $4 pi is a technological marvel that drastically exceeds the requirements it aims to meet for hobbyists looking for a cheap powerful board for small projects. That’s all the damn thing is stop pretending it’s for industrial applications needing high speed IO. If there’s a better chip for YOUR application you should use that. Some of us are overjoyed at the Pico’s abilities.

          5. Alright, certainly I was less clear than I’d hope by your response Pat.. I figured it was kinda obvious I meant useful/meaningful use for a pico that needs more USB speed..

            Sure you can do it, but its challenging to find a use-case for which the pico is at all the right choice that needs faster USB connection.

      1. You can flash LEDs, read sensors and control motors (and even bit-bang low-speed USB) using a 12 MHz chip if you’re not wasteful with your programming environment. Possibly even less, but those cheaper low-performance chips are hard enough to obtain and work with that chasing them doesn’t seem to make sense for a hobby project.

        This thing, on the other hand, can run something like a hobby logic analyzer or oscilloscope; an MP3 player or a GSM feature phone is not out of the question either—and these are all nominally microcontroller applications. Hell, it seems powerful enough computation-wise to make a decent SysV or Win95 machine (though I think the lack of an efficient external memory interface means you couldn’t actually use it for this class of problems).

    3. Well, using the PIO you could easily (if you are an assembler programmer, that’s it) obtain a 40Mbit/s UART (with three sampling points) and parallel 8 of them to have a custom 40MB/s channel (that would be monodirectional and about 18MB/s bidirectional, impressive enought, I’d say.
      Ah, and more than that can be obtained if the chip will be overclocked.

      1. Or just use 16 pins and make simple parallel 16bit interface. I’m working on using that for making simple 60fps game console with some tft lcd screens. That pio peripherial is just unreal. Maybe someone will actually interface a real gigabit ethernet phy to this.Or use usb3300 usb2 phy. It only needs 60mhz clock, 8 data lines and 4 control lines.

        1. “Or use usb3300 usb2 phy. It only needs 60mhz clock, 8 data lines and 4 control lines.”

          Yeah, that’s the same thing I was thinking when I first saw the full-speed limitation. I really do get “first silicon” but it would’ve been *really* nice to have something like the TM4C1294 has: an internal full-speed PHY with a ULPI interface option.

          Maybe with the PIOs you can do something similar. Not sure. If you could that’d be super-cool.

        1. You are right but forget to take in consideration that not all computers are PC. For example that would be doable for a Beaglebone, so that you will obtain a desktop pc with an high speed Pi interface.
          Look, I am not saying that you are wrong but that the bottleneck is more on the PC side of things. Obviously, if your only interface is USB 2.0 you want it on the processor but there are many solutions aside of having it on the micro, the first that comes to mind is the FT313H – Hi-Speed Host Controller; using it will give a 18MHz 16-bit R/W interface with just the USB line and a few passives and small enough to fit in the USB cable itself, that should be a pinch to implement using the PIOs.
          Also, the usb3300 seems worth more than a look, I have enough toys but who knows…

          1. “Look, I am not saying that you are wrong but that the bottleneck is more on the PC side of things.”

            Why yes, the fact that modern PCs essentially only have USB is a bottleneck of sorts, but it’s also a massive convenience that the entire computer industry’s settled on.

            “FT313H – Hi-Speed Host Controller; using it will give a 18MHz 16-bit R/W interface”

            The FT313H’s a *host* controller, not *device* side. But yeah, I *can* do it. Any FTDI chip would work fine, you can push 30 MB/s through those trivially. But now the USB descriptors/etc. are set for you, and you can’t do things dynamically with the microcontroller like you could if it’s all onboard. And plus you’d likely need to implement some sort of bootloader on your own as well. And a PHY-only chip like the USB3300’s definitely doable but of course it requires the USB stuff in software, which doesn’t exist as far as I can tell.

            Again I’m not saying you can’t *get* a firehose of data out of the thing. Obviously you can – but given that they already have so much of the USB interface *on* the chip it’s just a bit sad that it wasn’t more fully integrated with a higher-speed output, even if it needed to be off-chip through a PHY.

            It’s really, really easy to understand the frustration looking at similar performance (not price) chips: the 120+ MHz Cortex-M4 scale chips (STM32s, Tiva C, etc.). They *frequently* have USB high speed via an external ULPI interface. Obviously these are a fair amount cheaper and have the *really* interesting PIO interface. Which is why they would’ve been market-breakers with that interface.

Leave a Reply to SweeneyCancel reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.