Tuesday 12 November 2019

More work on HDMI video output

Ok. So in the last post I described how I had manged to get to the point where using code from Mike Field, I was able to get the ADV7511 HDMI driver chip to actually produce a 576p PAL 50Hz image.

Now the challenge is to get it ready for integrating with the MEGA65 target.  There are a few things to do here:

1. Switch from Mike's vga_generator to my pixel_driver for the actual VGA frame generation.

2. Tell HDMI controller the video is 4:3 aspect ratio.

3. Switch from DVI to HDMI encoding, so that we can include audio and other information in the stream.

4. Implement HDMI device identification, so that you can see "MEGA65 Computer" on the list of inputs if you have a fancy TV.

5. Implement audio frames, so that we can do audio over the HDMI link.

We'll work on the first one first.  This should just be a fairly simple. Indeed, this didn't take too much effort.  The second and third ones were also fairly easy, and after only an hour or two, I had the following display, now showing a 4:3 aspect ratio display via HDMI:






The fourth required some adapting the i2c_sender so that it can be told to write to registers of I2C devices with different addresses, since the 7511 has multiple I2C addresses, and the HDMI device identifier, which TVs etc should display as the source name,  are accessed via a different I2C device identifier ($70) to the main registers ($7A).

I've implemented this, but so far see no indication on any of the three HDMI monitors and TVs I have here, that they actually display this, or alternatively, that it is being properly sent.  What is clear from plugging it into our main TV, is that the TV thinks the HDMI link has stereo audio (which is how we configured things), and that it is 4:3 (even if I had to change the TV's default from "always 16:9" to "original aspect ratio of source").

So in theory, we are all set to start thinking about including the audio frames, which I'll get to next.  But for now, as all the other preliminary steps have been taken, I have merged the HDMi driver into the MGA65r2 FPGA target, and am synthesising this.  Hopefully, this will result in nice HDMI video output... And after the usual jiggery-pokery of working through small bugs, it did. First image is NTSC, second is PAL:



The X and Y positions of the text/graphics area within the borders is not quite right. I'm working on this right now.  It shouldn't be too hard to fix. It only got disturbed, because I had to re-work the zero point for X within raster lines, and the general rework to 576p/480p video modes for HDMI.  It's just a case of fine-tuning the positioning constants, and resynthesising between each attempt, to try to refine the position.

What's also nice is that the HDMI video is displayed faster than the VGA video, as the HDMI signalling format includes information about the pixel clock, which makes it easier for a monitor to determine the video mode.

So, that just leaves the fifth item: audio over HDMI.  Here I was hoping to use the same I2S audio transport that I have been using in the MEGAphone to talk to various components, as the ADV7511 also supports it. However, the MEGA65 Rev2 PCB has only the SPDIF signal connected. 

Fortunately Mike Field has once again implemented most of what I need, in the form of an SPDIF transmitter.  It's currently only mono, but that's okay. I can stereo-ise it later. However, it's nearly midnight again, so I'll stop for today, and have a think about the HDMI audio again when I get the chance.

3 comments:

  1. Hello,

    congrats for this great achievement.
    Just a question:
    was the c65 capable of higher resolution?

    Kind regards

    ReplyDelete
    Replies
    1. Yes, the C65 could do 1280 horizontal resolution, with considerable limitations. As no known software ever used that mode (1280x400 or 1280x200 with 2 or 4 colours doesn't really make a great deal of sense for anything much), we haven't felt that it is vital to find a solution for this. Supporting it would really break many more things, as the PAL/NTSC EDTV modes are the only modes that are broadly supported, that will allow us to get fairly well matched frame cycle timing to the original VIC-II/III.

      Delete