Synthesizing video output with microcontrollers

All off topic discussions go here. Everything from the funny thing your cat did to your favorite tv shows. Non-programming computer questions are ok too.
Post Reply
User avatar
eekee
Member
Member
Posts: 872
Joined: Mon May 22, 2017 5:56 am
Location: Kerbin
Discord: eekee
Contact:

Synthesizing video output with microcontrollers

Post by eekee »

I almost put this in OS development because it's almost a driver issue. How long until we get a hardware subforum? :mrgreen:

Carrying on from another thread:
Octocontrabass wrote:
eekee wrote:Graphics will likely be another microcontroller dynamically generating the video signal.
Are there any microcontrollers fast enough for that? Ordinary 640x480 VGA requires a 25MHz pixel clock!
eekee wrote:The other day, I tried to work out if I could get 1080x1920 with only 16KB video memory.
If you can squeeze 128 pixels in each byte, you're good to go. Perhaps something with tiles like VGA text mode instead of individually-addressable pixels?
bloodline wrote:
Octocontrabass wrote:
eekee wrote:Graphics will likely be another microcontroller dynamically generating the video signal.
Are there any microcontrollers fast enough for that? Ordinary 640x480 VGA requires a 25MHz pixel clock!
I have bit banged a black and white VGA signal using a Teensy 4.0 (600Mhz ARM uC). This only requires three signals (H Sync, V Sync and Video), I couldn’t get the GPIO switching fast enough to change 24 pins per pixel. I did try and even built three resistor ladder DACs on breadboards to tests it :lol:

On the Teensy forums, some members have had more success using the uC’s DMA...
Text does seem to be the way to go for large screens. I'd rather have a text-only large display than low-res graphics.

I'll admit I intentionally put off considering bandwidth. :) Maybe I won't be able to get the resolution I want, but there are some points I'm hopeful about:

A resistor ladder DAC would make things harder. This is particularly the case with breadboard because it has capacitance between adjacent strips. The uC would have to drive that capacitance through the resistors of the DAC, creating unwanted low-pass filters. The same is true for perfboard if you're not careful with the wires. Primarily for this reason, I'm not considering more than 8 colors at most; one digital signal per RGB wire. I also don't want to put the impedance matching resistors into breadboard for the same reason.

There are some success stories, although not at anything like the size I'm dreaming about. :) Actually, while some of them drive VGA, most apparently slow down the pixel clock. Text-only raises the possibility of ex ... simulated.

I might have misunderstood, but I think I heard LCD panels can be run at a much slower frame rate than CRTs or the VGA standard. If true, this could ease bandwidth requirements considerably.

That's all I've got for now. :mrgreen:

Edit: Worst-case scenario is synthesizing a TV signal for lower bandwidth than VGA. 47x29 text on TV and 24x10 on VGA with the same uC.
Kaph — a modular OS intended to be easy and fun to administer and code for.
"May wisdom, fun, and the greater good shine forth in all your work." — Leo Brodie
klange
Member
Member
Posts: 679
Joined: Wed Mar 30, 2011 12:31 am
Libera.chat IRC: klange
Discord: klange

Re: Synthesizing video output with microcontrollers

Post by klange »

Ben Eater did a pair of videos on generating VGA signals with some simple hardware. Worth a watch!

Shelby also just recently published a video on the signalling of VGA, but it's less implementation-focused and more about weird modes and why CRTs were better at VGA than LCDs.
User avatar
eekee
Member
Member
Posts: 872
Joined: Mon May 22, 2017 5:56 am
Location: Kerbin
Discord: eekee
Contact:

Re: Synthesizing video output with microcontrollers

Post by eekee »

Thanks for the links!
Kaph — a modular OS intended to be easy and fun to administer and code for.
"May wisdom, fun, and the greater good shine forth in all your work." — Leo Brodie
User avatar
bloodline
Member
Member
Posts: 264
Joined: Tue Sep 15, 2020 8:07 am
Location: London, UK

Re: Synthesizing video output with microcontrollers

Post by bloodline »

This might interest you:

https://youtu.be/PZsWqOuJFKI

-Edit- my previous uC video projects put out a VGA signal, which was very difficult, as the horizontal frequency is 31Khz... doing NTSC/PAL has a 15Khz horizontal frequency, which might make the whole project far more practical, but I don’t have any time or space for hardware projects right now :cry:
CuriOS: A single address space GUI based operating system built upon a fairly pure Microkernel/Nanokernel. Download latest bootable x86 Disk Image: https://github.com/h5n1xp/CuriOS/blob/main/disk.img.zip
Discord:https://discord.gg/zn2vV2Su
User avatar
eekee
Member
Member
Posts: 872
Joined: Mon May 22, 2017 5:56 am
Location: Kerbin
Discord: eekee
Contact:

Re: Synthesizing video output with microcontrollers

Post by eekee »

bloodline wrote:This might interest you:

https://youtu.be/PZsWqOuJFKI
Yes it does, thanks. :) Neat trick with toggling a pin between input and output to effectively get an open-collector output. I'm also fascinated to see a 6-pin device handling all the input and output! I haven't finished watching it yet, though.

I was amused to hear "ADC" in the context of "Good old days." They were expensive luxuries in my day! :mrgreen:
bloodline wrote:-Edit- my previous uC video projects put out a VGA signal, which was very difficult, as the horizontal frequency is 31Khz... doing NTSC/PAL has a 15Khz horizontal frequency, which might make the whole project far more practical, but I don’t have any time or space for hardware projects right now :cry:
Yeah, it's more practical. I'm hoping to under-clock the VGA signal. Any monitor capable of upscaling must have memory for a few scanlines, so driving the panel doesn't necessarily have to have any relationship with the speed of data coming in.

An external shift register or two would also help tremendously.

I need to buy an oscilloscope, but I don't have the space either. I just missed getting a good desk, it's been out of stock for weeks. :cry:

Edit: Desk in stock; ordered! *happy panda dance* :D
Kaph — a modular OS intended to be easy and fun to administer and code for.
"May wisdom, fun, and the greater good shine forth in all your work." — Leo Brodie
reapersms
Member
Member
Posts: 48
Joined: Fri Oct 04, 2019 10:10 am

Re: Synthesizing video output with microcontrollers

Post by reapersms »

There was, for a time, the XGameStation console that accompanied LaMothe's book about designing your own console. It was largely bitbanging things via a couple of PIC clones (SX52 and an SX35 IIRC), but it was a pretty rough environment. Some portions made the Atari 2600 look luxurious. I recall in particular a decision regarding addressing external memory that was almost certainly done to be different and painful to work around, in the name of chipcount reduction. A serial load shift register for controlling the upper address lines IIRC...

The book and project explore roughly 2600-era tech, and it might have been generating composite video instead of VGA.

The book is probably still available somewhere, but the main website seems to be defunct now. I might have a PDF of it around somewhere, but that probably exceeds the scope of the forums. There was a later edition that ran off a Propellor, and I think provided a bit more assistance with the video signal generation, but I haven't been paying much attention to that thing since 2011 or so.

When dealing with the analog input for an LCD, what the panel can do, and what it will accept can be two very different things. I have an FPGA board here I built a NES core for, and when it came to generating slightly non-standard analog SVGA, I found the panel I was using to be extremely picky about refresh rates. It was certainly quite picky about timing consistency.

Character/tile based graphics are definitely the way to go for getting resolution coverage out of a small memory footprint. When bit-banging it via a microcontroller, it's probably even more of a requirement, given access time and such.
Post Reply