суббота, 28 ноября 2015 г.

OSD Shenanigans, Part 1 - Back to the VHS

So, my dad and I are building a quadcopter with FPV.
minimOSD freaking out over nothing.

Using MAX7456 seems to be the most common way of doing OSD these days. So I've ordered ourselves a minimOSD board from some chinese seller on eBay. The board arrived, and it worked fine.
For the most part.


This board worked really well hooked up to a video output of my old Sony miniDV camcorder, but it misbehaved with the camera module that I wanted to use on the quadcopter.
It would overlay over one video field just fine, and then completely miss the other one, resulting in OSD rapidly and annoingly flashing (if video was deinterlaced for smoothness), or just missing half of its lines. Also, no matter what, there was that snow that scrolled across the screen occasionally.
I've heard from people on forums that MAX7456 doesn't like some cameras sync levels, or that some cameras are too high resolution for this chip to handle (I don't know how that supposed to work though; I've always thought that there's a constant amount of 625/525 lines in a PAL/NTSC video frame, and pixels don't really exist in the realm of analog video signal). I've also heard that fake chinese MAX7456 chips are cheap and can misbehave in a variety of ways, and that Maxim's genuine chips cost almost the same as the chinese minimOSD board itself.

So, after I've fried this OSD board by accidentally plugging it into 12v instead of 5 while trying to address this issue, I've decided that I want to roll my own OSD that would play nicely with any standard video source that I would throw at it. And maybe have some real graphics as well.

While thinking about what would play nicely with any video signal, I remembered that I have some parts left from Sony SLV-X37 VCR that I dismantled a long time ago. Later that day, I had its mainboard on my hands, and for sure, there was an OSD chip on that board that I could reuse. It turned out to be NEC's D6450GT (and here's the datasheet). 

In terms of a capabilities, D6450GT is somewhat weaker than MAX7456. Here I've pointed out main features and differences between those two:
  • D6450 only has 12 lines and 24 columns, while MAX7456 has 16 lines and 30 columns; 
  • Both D6450 and MAX7456 have a character size of 12 by 18 pixels; However, D6450 is only capable of having 127 different characters, while MAX7456 is capable of 256;
  • To make matters worse, D6450 has its font stored in mask ROM, meaning that it cannot be redefined at all, while MAX7456 has its font in EEPROM, and it can be user-defined;
  • MAX7456 is a one-chip solution; it has almost everything it needs to superimpose an OSD on a video signal, just throw in an oscillator and some passive components. On the other hand, D6450 requires a couple of oscillators and more active circuitry to buffer the video signal and strip its sync signals, atleast according to the reference design in the datasheet. Both chips, however, have SPI-like serial microprocessor buses, so both are easy to interface to whatever microcontroller you want.
But even knowing all those ugly sides of NEC chip, I decided to give it a try anyway, because why not?
So I came up with a prototype that I hooked up to an Arduino to have a quick play around:
The prototype.

The 4-pin cable on the top has 2 RCA female connectors for video in and out, and the rest of the circuitry is basically just a reference design. I actually added LM1881 sync separator later on, because at first I didn't even realise that it was required to feed separate sync signals into D6450 in order for it to do the trick. Without sync, it would produce entire video signal on it's own (with solid, even colorful background, unlike MAX7456, which is completely monochrome), but it wouldn't overlay anything and just pass the present video source through. That had me stumped for a while.

Then I threw together a small, very simplistic C library to use this chip, and tried to come up with the layout for my future OSD. And well, there's some screenshots of that:
(Nevermind those faint vertical lines between characters: it was just me being extremely lazy with bypass caps :))



Here's the entire character set of this chip. Brings back memories, isn't it?
This chip's full model is D6450GT-606, and as you can probably notice, its character set differs from the one described in the datasheet.
And now, the most exciting part for me was... the fact that this thing worked with any camera or video source I threw at it!
It still has its share of problems, though. Despite being a slightly more bulkier solution (atleast 3 chips instead of 2), it also slightly distorts source video signal (I took a couple of screenshots with and without OSD and noticed that picture with OSD turned out to be slighly dimmer), and the OSD's brightness slightly drifts depending on source video amplitude due to the lack of proper DC restoration circuit (which MAX7456, by the way, has built in).
For further explanation of why this happens, I'd like to point you, for example, at this old application note from Intersil. It does a good job explaining all the background info on this subject. I would've gladly used the chip proposed in this appnote, but I have no reasonable way to acquire it nowadays :)

So away goes this short and goofy iteration of my OSD prototype.
My next implementation will probably involve LM1881, a CMOS 405x analog mux, and some small STM32 microcontroller, that, having both ADCs and DACs built-in, would also (I hope, and have some thoughts on implementation already) handle exactly this issue in completely digital manner :)

The mystery remains uncovered though: why the MAX7456 didn't work with that camera? I don't know, maybe it was just damaged or counterfeit chip, but here I've certainly made stable and functional OSD barely even trying, go figure :)

1 комментарий:

  1. Great post. Thanks for detailed information. I would like to reproduce something similar but even simpler with the lm1881. I will like to know how can I send a single dot or two dots to differentiate one video source from another. Mi final goal is to be able to identify/differentiate 20 video signals.
    Patty

    ОтветитьУдалить