RGB to HDMI using a Pi Zero and a small CPLD

for bbc micro/electron hardware, peripherals & programming issues (NOT emulators!)
User avatar
danielj
Posts: 7692
Joined: Thu Oct 02, 2008 4:51 pm
Location: Manchester
Contact:

Re: RGB to HDMI using a Pi Zero and a small CPLD

Post by danielj » Mon Aug 05, 2019 6:52 am

I think I might have a couple knocking around. This is strictly DIY though, you'll have to source parts and build yourself. Let me know if you want one and I'll have a look and see what I have :)

d.

User avatar
tricky
Posts: 3868
Joined: Tue Jun 21, 2011 8:25 am
Contact:

Re: RGB to HDMI using a Pi Zero and a small CPLD

Post by tricky » Mon Aug 05, 2019 7:53 am

Did anyone look into getting them prebuilt?
I'm not sure I would be asking for the right thing.

User avatar
Elminster
Posts: 3979
Joined: Wed Jun 20, 2012 8:09 am
Location: Essex, UK
Contact:

Re: RGB to HDMI using a Pi Zero and a small CPLD

Post by Elminster » Mon Aug 05, 2019 8:22 am

I think I am with Dave's post above. The hardest bit of RGBHDMI is the cable. Building two cable at the moment and the flipping wires keep breaking as I put them into the Molex connectors. Possibly dodgy CCTV wire, or maybe Molex crimp tool is putting to much pressure on.

With Hindsight I would do what Ian did and solder directly onto board.
Last edited by Elminster on Mon Aug 05, 2019 8:23 am, edited 1 time in total.

cmorley
Posts: 1123
Joined: Sat Jul 30, 2016 7:11 pm
Location: Oxford
Contact:

Re: RGB to HDMI using a Pi Zero and a small CPLD

Post by cmorley » Mon Aug 05, 2019 8:36 am

tricky wrote:
Mon Aug 05, 2019 7:53 am
Did anyone look into getting them prebuilt?
I'm not sure I would be asking for the right thing.
I was going to, hence the brief discussion I had with hoglet about using a cheaper CPLD. If you assemble your own the £1 or £4 for a CPLD doesn't make much of a difference but when you are assembling and selling that extra £3 x2.5 would add £7.50 to the price for that one part. Retail sub £20 would be nice... if they are £30-40 assembled (+ Pi on top) then I think that is too much.

The reengineering would take time and effort which is probably not worth it. Max V for example are cheap but they are FPGA (LUT + registers) not CPLD (product terms + registers) so development and testing would be required too. So I shelved the idea of me doing it.

User avatar
BigEd
Posts: 2750
Joined: Sun Jan 24, 2010 10:24 am
Location: West
Contact:

Re: RGB to HDMI using a Pi Zero and a small CPLD

Post by BigEd » Mon Aug 05, 2019 10:23 am

I'm not volunteering to do the production, but I'd guess that even at £50 they'd sell really well - it's such a great picture and such a neat solution!

User avatar
danielj
Posts: 7692
Joined: Thu Oct 02, 2008 4:51 pm
Location: Manchester
Contact:

Re: RGB to HDMI using a Pi Zero and a small CPLD

Post by danielj » Mon Aug 05, 2019 10:32 am

Once I've finished with these MIDI thingies I might have a look at doing a limited run of these... But I'm not committing to it, and certainly not committing to any timescales!

d.
Last edited by danielj on Mon Aug 05, 2019 10:32 am, edited 1 time in total.

Muddyfunster
Posts: 21
Joined: Tue Apr 16, 2019 8:36 pm
Contact:

Re: RGB to HDMI using a Pi Zero and a small CPLD

Post by Muddyfunster » Mon Aug 05, 2019 6:38 pm

I'd be very interested even at £50. =P~

User avatar
Elminster
Posts: 3979
Joined: Wed Jun 20, 2012 8:09 am
Location: Essex, UK
Contact:

Re: RGB to HDMI using a Pi Zero and a small CPLD

Post by Elminster » Sun Aug 11, 2019 8:11 pm

IanB wrote:
Fri May 17, 2019 2:56 pm


Here is a drilling template pdf from kicad:
Drilling template.pdf


Print and cut it out, push pinholes through the centre points and place face down on the inside of the case. It should just fit in the narrow direction with little or no slack but you will have to centre it in the long direction. The holes should be closest to the side with the hdmi and usb connectors and you should push the template towards that side if there is any slack as the board is mounted slightly off centre in the narrow direction. (You have to make pinholes because the printing is face down on the inside of the case.) As the cases are so cheap, it's worth getting an extra one in case of drilling mistakes.
Worked a treat. 3 RGBHDMIs all boxed up now, and only a little filing the holes. My also has extra cut out at the sides as I didnt solder cable to the board.

One RGBHDMI board (the one hooked to the Electron) has the no programmer mod done, as above. The Master is going via the scart to HDMI convertor as it has videonula. I have one for when I get one of my boxed machines down, and a spare. No more unplugging cables from machines and monitor. Well less anyway.

Tick this off the todo list.

User avatar
IanB
Posts: 421
Joined: Sun Sep 04, 2011 7:28 pm
Location: South Wales
Contact:

Re: RGB to HDMI using a Pi Zero and a small CPLD

Post by IanB » Fri Oct 18, 2019 9:42 pm

Well I finally learned how to use Kicad and this is my first attempt at a 6 bit version of the PCB using a 5x2 IDC connector.

rgb-to-hdmi.jpg

The signals on the header are 2 bits each for RGB, Sync, Vsync, +5v & 0v. All 8 inputs are now pulled low by resistor packs so there will be no floating inputs if only some of the signals are used and I changed the LEDs to through hole so they can stick through the case

I also added the in system programming connections which are wired using pre-linked solder pads (JP1-4) so they can be cut and a JTAG connector added in case of a bricked system.

I had to remove the 74LS08 buffer although it wasn't needed on my unbuffered electron anyway. I also had to remove the debug header but it's possible that can be added back in by the reset switch. (A header can be soldered onto pins 6, 8 & 10 in any case if needed)

Using the IDC header means that PC style cables for MDA / CGA / EGA can be made using IDC ribbon cables and even BBC style cables can be made with IDC at one end.

One possible future option would be to make adapter PCBs for other source types that could be plugged into the 5x2 header. (e.g. my monochrome adapter level slicer or an electron buffer if needed)
Last edited by IanB on Fri Oct 18, 2019 9:47 pm, edited 1 time in total.

User avatar
-B-
Posts: 148
Joined: Wed Nov 26, 2014 11:54 am
Location: Noordwijk ZH (NL) / Durham (UK)
Contact:

Re: RGB to HDMI using a Pi Zero and a small CPLD

Post by -B- » Fri Oct 18, 2019 9:46 pm

Nice work =D>
Atom | BBC Model A | BBC Model B | Electron | Olivetti PC128S.

User avatar
IanB
Posts: 421
Joined: Sun Sep 04, 2011 7:28 pm
Location: South Wales
Contact:

Re: RGB to HDMI using a Pi Zero and a small CPLD

Post by IanB » Wed Nov 06, 2019 6:44 pm

I received my new six bit PCBs from JLC today:
boards.jpg

I built one up and it worked first time including self programming of the CPLD by the PI so no programmer was needed:
(Shown with a PC lead for MDA, CGA and EGA)
assembled.jpg

This shows the underside with the new IDC header to mount the cable:
underside.jpg

As you can see the IDC connector is a tight fit, sandwiched between the 40 way header on one side and the switch pins on the other:
pc lead.jpg

I found you can get 10 way ribbon in a round cable so I made up a BBC Micro/ Master128 / Electron lead using that although I could have used normal 10 way ribbon instead:
beeb lead.jpg

There are fewer surface mount components in this design, only 4 caps and 5 resistors and the leds are now through hole so they can stick through the case
Last edited by IanB on Wed Nov 06, 2019 7:13 pm, edited 1 time in total.

User avatar
-B-
Posts: 148
Joined: Wed Nov 26, 2014 11:54 am
Location: Noordwijk ZH (NL) / Durham (UK)
Contact:

Re: RGB to HDMI using a Pi Zero and a small CPLD

Post by -B- » Wed Nov 06, 2019 6:48 pm

Excellent! I like the look of that. Especially since my Xilinx programmer doesn’t work any more.
Atom | BBC Model A | BBC Model B | Electron | Olivetti PC128S.

aotta
Posts: 184
Joined: Fri May 26, 2017 8:57 am
Location: Italy
Contact:

Re: RGB to HDMI using a Pi Zero and a small CPLD

Post by aotta » Wed Nov 06, 2019 6:57 pm

Nice work! but it's only for Elk and PC, or it works with Micros and Masters too?

User avatar
IanB
Posts: 421
Joined: Sun Sep 04, 2011 7:28 pm
Location: South Wales
Contact:

Re: RGB to HDMI using a Pi Zero and a small CPLD

Post by IanB » Wed Nov 06, 2019 7:11 pm

aotta wrote:
Wed Nov 06, 2019 6:57 pm
Nice work! but it's only for Elk and PC, or it works with Micros and Masters too?
Yes BBC, Master 128 and most Electrons. (I've just edited the post to make that a bit clearer)
There may be an issue with some early Electrons as I had to remove the buffer Dave used to get his early Electron working although my early Electron which I think was the same version didn't need the buffer anyway.

User avatar
Elminster
Posts: 3979
Joined: Wed Jun 20, 2012 8:09 am
Location: Essex, UK
Contact:

Re: RGB to HDMI using a Pi Zero and a small CPLD

Post by Elminster » Wed Nov 06, 2019 9:48 pm

I dont think I will build any more boards, but the ribbon cable is good idea, I keep snapping the cctv cable. Although that could just be due to rubbish ebay quality.

User avatar
IanB
Posts: 421
Joined: Sun Sep 04, 2011 7:28 pm
Location: South Wales
Contact:

Re: RGB to HDMI using a Pi Zero and a small CPLD

Post by IanB » Thu Nov 07, 2019 3:16 am

While I was waiting for the PCBs, I did some preliminary design on an analog interface add-on which should increase the number of old computers supported.

The design uses some fast comparators and D to A converters to set the thresholds from the menus instead of the potentiometers used in my original monochrome design posted some pages back. Also this design supports 2 levels on each of the RGB signals so as well as old monochrome systems it should support systems with 2 level RGB outputs such as the Spectrum +2A / +3 and the Amstrad CPC 464 / 664 / 6128.

Heres a rough test layout to give you an idea:
analog.jpg

I made a dummy board using just the connector and a piece of veroboard to see if such a design would actually fit and it looks like it does:
verboard.jpg

The current 6 bit TTL board supports the following:
BBC micro
Master 128
Electron (May be some problems with early machines)
PC MDA
PC CGA
PC EGA
Spectrum +2
Oric 1
Atmos
Atom (using the original Acorn colour card that provided TTL outputs)

Anyone know of any other computers with TTL outputs?

It should also work with many early monochrome computers provided you are prepared to pick up the Sync and video internally at TTL levels
e.g.
Apple II
PET
TRS80
ZX80
UK101
Ohio Superboard
Microtan 65
Nascom

Also if you pick up the RGBI internally at TTL levels:
Spectrum +2A
Spectrum +3


If the above analog board works it should support the following using their standard video outputs:
Spectrum +2A
Spectrum +3
Amstrad 464
Amstrad 664
Amstrad 6128
ZX80
ZX81
Apple II
TRS80
PET
UK101
Ohio Superboard
Microtan 65
Nascom
Early Electrons with problems using the standard TTL version (In fact all beebs should work with it although it's not required)

I'm going to build a breadboard prototype first so I hope to have some results soon.

User avatar
-B-
Posts: 148
Joined: Wed Nov 26, 2014 11:54 am
Location: Noordwijk ZH (NL) / Durham (UK)
Contact:

Re: RGB to HDMI using a Pi Zero and a small CPLD

Post by -B- » Thu Nov 07, 2019 8:14 am

Ah, you beat me to it. I am using your ZX81 circuit with the old version of the board...

C68870FE-F204-4B94-BD40-EFF99C47AB52.jpeg
Neil.
Atom | BBC Model A | BBC Model B | Electron | Olivetti PC128S.

User avatar
hoglet
Posts: 8758
Joined: Sat Oct 13, 2012 6:21 pm
Location: Bristol
Contact:

Re: RGB to HDMI using a Pi Zero and a small CPLD

Post by hoglet » Thu Nov 07, 2019 9:51 am

Nice work Ian.

By the way, I'm currently using the original RGBtoHDMI reasonably successfully with an Amstrad CPC 464:
capture10.png
I fitted 330R termination resistors, and it can just about descriminate the three level RGB signals, due to the differeing thresholds of the 74LS08 buffer and the CPLD. So you do actually see all 27 colours. I checked in some profiles here:
https://github.com/hoglet67/RGBtoHDMI/commit/a34e5324

Im very much looking forward to seeing the analog frontend working. Am I right in thinking that as well as plugging in to the 2x5 way header, there will need to be three additional wires soldered across to the Pi Header to pick up three GPIO signals. So installing it is semi-permanent?

Dave

User avatar
IanB
Posts: 421
Joined: Sun Sep 04, 2011 7:28 pm
Location: South Wales
Contact:

Re: RGB to HDMI using a Pi Zero and a small CPLD

Post by IanB » Thu Nov 07, 2019 7:17 pm

hoglet wrote:
Thu Nov 07, 2019 9:51 am
I fitted 330R termination resistors, and it can just about descriminate the three level RGB signals, due to the differeing thresholds of the 74LS08 buffer and the CPLD.
That's a clever trick although it may not be reliably repeatable.
hoglet wrote:
Thu Nov 07, 2019 9:51 am
Am I right in thinking that as well as plugging in to the 2x5 way header, there will need to be three additional wires soldered across to the Pi Header to pick up three GPIO signals. So installing it is semi-permanent?
Yes there will be another three connections for the D to A serial interface. I'm looking at the possibility of making that connection pluggable, possibly using a board to board connector between the programming header and the reset button as that area is unused at the moment.
The idea would be to plug the board into the 10 way connector at a slight angle then when it is inserted push the two boards together to mate the three pin connectors.
The main issue will be finding a connector pair with the appropriate clearance which is about 5.5mm.

Of course this would require a tweak to the board layout but it should be possible to prototype it by drilling holes in the existing board at the same location and mounting any proposed connector to test if it is practical.

The board needs a tweak anyway as there is a minor issue with the 10 way header:
If you look at this image: download/file.php?id=51296&mode=view
You can see some scratches on the board in front of the 10 way header. These are caused by the cut wire ends of the ribbon cable when the connector is inserted or removed and they eventually rub away the solder mask and there is one track right where the cable ends up. This is easily fixed with a piece of insulating tape but I'll move the tracks for any new issue.

BTW the round ribbon cable is available from Farnell by the metre:
https://uk.farnell.com/w/c/cable-wire-c ... ging=metre
It's a bit expensive but 1m will do two or three boards as you only need 30-50cm leads on the BBC side as long leads can be on the HDMI side.

It's also available from RS but only by the reel so very expensive.

User avatar
IanB
Posts: 421
Joined: Sun Sep 04, 2011 7:28 pm
Location: South Wales
Contact:

Re: RGB to HDMI using a Pi Zero and a small CPLD

Post by IanB » Thu Nov 07, 2019 7:35 pm

-B- wrote:
Thu Nov 07, 2019 8:14 am
Ah, you beat me to it. I am using your ZX81 circuit with the old version of the board...
That's very neat, I assume it works OK? (I was concerned that the extra heat inside the PI case might make the threshold adjustments a bit unstable.)

User avatar
-B-
Posts: 148
Joined: Wed Nov 26, 2014 11:54 am
Location: Noordwijk ZH (NL) / Durham (UK)
Contact:

Re: RGB to HDMI using a Pi Zero and a small CPLD

Post by -B- » Mon Nov 11, 2019 9:44 am

IanB wrote:
Thu Nov 07, 2019 7:35 pm
That's very neat, I assume it works OK? (I was concerned that the extra heat inside the PI case might make the threshold adjustments a bit unstable.)
It's not actually finished, I got to the stage where I needed to programme the CPLD but my Xilinx platform is not recognised by my laptop. I will have to go through the reinstall process I think. So, it was almost ready for testing a few weeks ago, but I've been so busy since. I will get around to it.

Neil
Atom | BBC Model A | BBC Model B | Electron | Olivetti PC128S.

User avatar
IanB
Posts: 421
Joined: Sun Sep 04, 2011 7:28 pm
Location: South Wales
Contact:

Re: RGB to HDMI using a Pi Zero and a small CPLD

Post by IanB » Tue Nov 19, 2019 1:59 pm

hoglet wrote:
Thu Nov 07, 2019 9:51 am
Im very much looking forward to seeing the analog frontend working.
After some initial problems with noise due to insufficient decoupling, I finally got the breadboard prototype of the analog interface working:

BREADBOARD.jpg
And here are some results:
capture20.png
capture21.png
capture16.png
capture19.png
capture15.png

There are new menu options to adjust the thresholds:

menu.jpg

User avatar
hoglet
Posts: 8758
Joined: Sat Oct 13, 2012 6:21 pm
Location: Bristol
Contact:

Re: RGB to HDMI using a Pi Zero and a small CPLD

Post by hoglet » Tue Nov 19, 2019 2:24 pm

That looks fantastic Ian.

Which DACs and Comparators is that using?

Dave

User avatar
IanB
Posts: 421
Joined: Sun Sep 04, 2011 7:28 pm
Location: South Wales
Contact:

Re: RGB to HDMI using a Pi Zero and a small CPLD

Post by IanB » Tue Nov 19, 2019 3:11 pm

hoglet wrote:
Tue Nov 19, 2019 2:24 pm
Which DACs and Comparators is that using?
The DAC is the TLC5620 and the comparators are the lower cost 40ns MAX9144.
Actually the biggest problem with noise was the outputs of the DACs and that was cured by connecting a 100nf capacitor to ground on each output. As the MAX9144 is 14 pin compared to 16 pin for the more expensive MAX9201, that should free up some space for the extra caps.

I removed the RGB amplifier chip which is shown in the above breadboard pic as the low pass filter in it was causing problems:
If you zoom into the 640x200 image above you can see lots of black pixels that should be blue (e.g. look at the letter k).
After removing it and adjusting the thresholds for the reduced level this new grab seems to be error free:

capture24.png

User avatar
danielj
Posts: 7692
Joined: Thu Oct 02, 2008 4:51 pm
Location: Manchester
Contact:

Re: RGB to HDMI using a Pi Zero and a small CPLD

Post by danielj » Tue Nov 19, 2019 7:36 pm

Wow. Basically! =D>

User avatar
-B-
Posts: 148
Joined: Wed Nov 26, 2014 11:54 am
Location: Noordwijk ZH (NL) / Durham (UK)
Contact:

Re: RGB to HDMI using a Pi Zero and a small CPLD

Post by -B- » Wed Nov 20, 2019 12:12 am

Amazing!!! =D>
Atom | BBC Model A | BBC Model B | Electron | Olivetti PC128S.

User avatar
IanB
Posts: 421
Joined: Sun Sep 04, 2011 7:28 pm
Location: South Wales
Contact:

Re: RGB to HDMI using a Pi Zero and a small CPLD

Post by IanB » Wed Nov 27, 2019 4:44 pm

The new boards came today:

new boards.jpg

I built a pair up:

built1.jpg
built2.jpg
built3.jpg

They fitted perfectly in the case:

installed.jpg

And worked perfectly:

capture88.png
capture89.png

User avatar
-B-
Posts: 148
Joined: Wed Nov 26, 2014 11:54 am
Location: Noordwijk ZH (NL) / Durham (UK)
Contact:

Re: RGB to HDMI using a Pi Zero and a small CPLD

Post by -B- » Wed Nov 27, 2019 5:09 pm

Excellent work =D>
Atom | BBC Model A | BBC Model B | Electron | Olivetti PC128S.

User avatar
hoglet
Posts: 8758
Joined: Sat Oct 13, 2012 6:21 pm
Location: Bristol
Contact:

Re: RGB to HDMI using a Pi Zero and a small CPLD

Post by hoglet » Wed Nov 27, 2019 5:13 pm

That looks Fab!

User avatar
IanB
Posts: 421
Joined: Sun Sep 04, 2011 7:28 pm
Location: South Wales
Contact:

Re: RGB to HDMI using a Pi Zero and a small CPLD

Post by IanB » Wed Nov 27, 2019 6:05 pm

Now working with the Spectrum:
capture2.png

Post Reply