RGB to HDMI using a Pi Zero and a small CPLD

discuss both original and modern hardware for the bbc micro/electron
aotta
Posts: 253
Joined: Fri May 26, 2017 9:57 am
Location: Italy
Contact:

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

Post by aotta » Tue May 12, 2020 9:01 am

IanB wrote:
Tue May 12, 2020 1:23 am

Thanks for testing, here's an update with some of the darker colours brightened up:

NTSCArtifactV3.zip
Yes, blu range is lighter and more accurate, the purple is still a bit reddish, but it's a great result:
capture8.png
IanB wrote:
Tue May 12, 2020 1:23 am
Looks like the H offset in the geometry menu needs tweaking to centre the image
yes, i set H offset to 34 after previous post.. i wonder how did you find it! :lol:

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

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

Post by IanB » Wed May 13, 2020 10:53 pm

aotta wrote:
Tue May 12, 2020 9:01 am
Yes, blu range is lighter and more accurate, the purple is still a bit reddish, but it's a great result:
I might have the order of colours mixed up, can you run the integer Basic program about half way down this page:
https://mrob.com/pub/xapple2/colors.html
to compare with the real off screen photo to the right of it.

aotta
Posts: 253
Joined: Fri May 26, 2017 9:57 am
Location: Italy
Contact:

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

Post by aotta » Thu May 14, 2020 8:26 am

IanB wrote:
Wed May 13, 2020 10:53 pm
aotta wrote:
Tue May 12, 2020 9:01 am
Yes, blu range is lighter and more accurate, the purple is still a bit reddish, but it's a great result:
I might have the order of colours mixed up, can you run the integer Basic program about half way down this page:
https://mrob.com/pub/xapple2/colors.html
to compare with the real off screen photo to the right of it.
That's the colours i got:
capture10.png
compared to the original photo:
lores-colors-photo.jpg
Let me say your chromatic scale is better than the original, but Woz hadn't a Pi Zero and HDMI... :lol:

system11
Posts: 34
Joined: Sun Apr 26, 2020 11:41 pm
Contact:

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

Post by system11 » Fri May 15, 2020 1:52 pm

This looks really good, are you selling made up devices or kits anywhere?

aotta
Posts: 253
Joined: Fri May 26, 2017 9:57 am
Location: Italy
Contact:

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

Post by aotta » Fri May 15, 2020 2:31 pm

Ian,
for more information, looking on an old thread in a french's forum, where talking about a replica of the RGB "Chat mauve" card for Apple II, i noticed the "different colours" issue was with the card too (end replica ones, even i didn't never get it working, but it's a different story..).
If you like french or google translator, here the link to thread: https://forum.system-cfg.com/viewtopic. ... &start=105
There, you could find a picture i got to my Apple IIC with RGB adapter (scart), that show the colours a bit different to original IIe TV output, and to the ones you made with RGBtoHD!
CM_Peritel_Cable.jpg

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

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

Post by IanB » Fri May 15, 2020 11:07 pm

aotta wrote:
Fri May 15, 2020 2:31 pm

There, you could find a picture i got to my Apple IIC with RGB adapter (scart), that show the colours a bit different to original IIe TV output, and to the ones you made with RGBtoHD!
Thanks for the link.

I've now changed the palette to be generated mathematically from the way an NTSC decoder works rather than using preset values so the colours should be more technically correct and I've provided adjustments like an NTSC TV for tint (hue), saturation, contrast, brightness and gamma so you can now vary the colours until you find something that matches real hardware.

This is the default:
capture36.png
BTW the above test pattern was generated on a beeb as the artifact decoding can work with any computer

(change Palette Control to "B/W NTSC Artifact" to enable the option):
capture38.png

Here's the latest version to test:
NTSCArtifactV4.zip
(160.92 KiB) Downloaded 3 times
Overwrite kernel.img, replace the Profiles folder with the one in the zip and delete any saved profiles

Note when setting the NTSC Artifact Phase, the NTSC tint option should be set to 0
Last edited by IanB on Sat May 16, 2020 12:58 am, edited 2 times in total.

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

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

Post by IanB » Fri May 15, 2020 11:20 pm

system11 wrote:
Fri May 15, 2020 1:52 pm
This looks really good, are you selling made up devices or kits anywhere?
I was planning on getting a small batch made up in china but the current situation has put that on hold for the moment. I do have some 6 bit blank pcbs if you can do surface mount soldering and want to build one.

Parts list etc in the wiki:
https://github.com/hoglet67/RGBtoHDMI/wiki

aotta
Posts: 253
Joined: Fri May 26, 2017 9:57 am
Location: Italy
Contact:

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

Post by aotta » Sat May 16, 2020 12:47 pm

IanB wrote:
Fri May 15, 2020 11:07 pm

I've now changed the palette to be generated mathematically from the way an NTSC decoder works rather than using preset values so the colours should be more technically correct and I've provided adjustments like an NTSC TV for tint (hue), saturation, contrast, brightness and gamma so you can now vary the colours until you find something that matches real hardware.

...

Here's the latest version to test:
NTSCArtifactV4.zip

Overwrite kernel.img, replace the Profiles folder with the one in the zip and delete any saved profiles

Note when setting the NTSC Artifact Phase, the NTSC tint option should be set to 0
It works fine! i made only same quick test, and not yet optimized parameters to match original output, but results are good!
capture11.png
Thank you for this new options!

system11
Posts: 34
Joined: Sun Apr 26, 2020 11:41 pm
Contact:

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

Post by system11 » Sun May 17, 2020 1:14 am

IanB wrote:
Fri May 15, 2020 11:20 pm
system11 wrote:
Fri May 15, 2020 1:52 pm
This looks really good, are you selling made up devices or kits anywhere?
I was planning on getting a small batch made up in china but the current situation has put that on hold for the moment. I do have some 6 bit blank pcbs if you can do surface mount soldering and want to build one.

Parts list etc in the wiki:
https://github.com/hoglet67/RGBtoHDMI/wiki
I can but I honestly prefer avoiding it! What does the analog front end mentioned on the wiki actually do?

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

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

Post by IanB » Sun May 17, 2020 2:03 pm

system11 wrote:
Sun May 17, 2020 1:14 am
I can but I honestly prefer avoiding it!
It's only one 44 pin chip and 10 capacitors/resistors. All the rest are through hole.
system11 wrote:
Sun May 17, 2020 1:14 am
What does the analog front end mentioned on the wiki actually do?
It's a set of 8 voltage level comparators and an 8 output DAC to set the reference voltage levels. Two comparators are used as sync separators and the others are effectively used as 1 bit analog to digital converters.

It can be used to detect the voltage levels of some analog video sources with only a few discrete levels such as the Amstrad CPC or Spectrum +2A & +3 which only have 3 possible voltage levels on each of their RGB outputs. It can also be used on mono video outputs like the ZX81 as it only needs to detect the on or off state of each pixel. (A normal A to D couldn't be used as there are insufficient bits per pixel)

As the video source is re-quantised by this, there is no noise at all in the final output and it's as if the source is digital all the way from the original frame buffer (See the gallery in the wiki for examples).

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

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

Post by danielj » Thu May 21, 2020 1:08 pm

Boing. @IanB - do you still have any 6 bit boards knocking around?

d.

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

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

Post by IanB » Thu May 21, 2020 5:40 pm

danielj wrote:
Thu May 21, 2020 1:08 pm
Boing. @IanB - do you still have any 6 bit boards knocking around?
Yes, and I also have some analog boards and 3 bit TTL buffer boards.

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

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

Post by danielj » Thu May 21, 2020 5:43 pm

Oooh, I'll drop you a PM if you're happy to post out.

d.

tingo
Posts: 13
Joined: Fri Jul 06, 2018 1:56 pm
Contact:

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

Post by tingo » Sun May 24, 2020 3:19 pm

Wondering: for those of you who have soldered the board (or boards as appropriate) yourself; did you use a stencil when putting paste on the board? Or did you just apply paste manually?
--
Torfinn

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

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

Post by hoglet » Sun May 24, 2020 3:58 pm

tingo wrote:
Sun May 24, 2020 3:19 pm
Wondering: for those of you who have soldered the board (or boards as appropriate) yourself; did you use a stencil when putting paste on the board? Or did you just apply paste manually?
I just soldered them with old fashioned solder and flux.

tingo
Posts: 13
Joined: Fri Jul 06, 2018 1:56 pm
Contact:

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

Post by tingo » Sun May 24, 2020 4:05 pm

Even the SMD components? I'm fine with throughhole, but I'm not sure my skills are up to soldering the smallest SMD components with a soldering iron.
--
Torfinn

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

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

Post by IanB » Sun May 24, 2020 4:57 pm

tingo wrote:
Sun May 24, 2020 4:05 pm
Even the SMD components? I'm fine with throughhole, but I'm not sure my skills are up to soldering the smallest SMD components with a soldering iron.
Same here, ordinary solder, a liquid flux painted on the pads and legs of ICs and desoldering braid to mop up any bridges

Here's a tutorial by Ben Heck and he doesn't even use any flux:

https://www.youtube.com/watch?v=oGB7Yrbeo_Y

A magnifier with built in light helps to inspect the joints if your eyesight isn't too good and tweezers for positioning small smd components.

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

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

Post by IanB » Mon May 25, 2020 3:54 pm

hoglet wrote:
Sun Apr 26, 2020 6:41 pm
So I guess your "new" CPLD wasn't actually blank, and was driving pins 39/40.
Where did you buy them from?
wjnuk wrote:
Sun Apr 26, 2020 10:50 pm
I bought the cpld from AliExpress. It came sealed in a tray and unless they cleaned it up very well it looked brand new to me. However as always you take your chances with items shipped from China. At least it works now!
If it isn't a recycled part, one possible explanation that just occurred to me is that if someone orders a large enough quantity of a particular chip, they can get the parts pre-programmed at the manufacturer. Any surplus devices from that order may end up on the grey market which is why you can get unused looking parts that are already programmed.

I think it should be possible to partially work around this by always erasing the chip when entering CPLD recovery mode before looking at any keypresses. This won't work under all circumstances because if some pins are set as outputs it would inhibit the ability to erase the chip itself but it would help with most cases.

User avatar
anightin
Posts: 483
Joined: Thu Aug 23, 2018 2:03 pm
Location: Cambridge UK
Contact:

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

Post by anightin » Mon May 25, 2020 8:28 pm

First attempt at SMD soldering! Well, technically my first 5 attempts :lol:
IMG_6947.jpeg
Hope they work!

:D

Best wishes

Andy

P.S: This video video was invaluable
Last edited by anightin on Mon May 25, 2020 8:44 pm, edited 1 time in total.

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

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

Post by hoglet » Mon May 25, 2020 8:43 pm

anightin wrote:
Mon May 25, 2020 8:28 pm
Hope they work!
Looking good....

On one of them (top right in the photo), the CPLD looks a bit mis-aligned with the pads.

Do check them very carefully for solder bridges, under bright light (e.g. outside), ideally using some form of magnification.

Dave

User avatar
anightin
Posts: 483
Joined: Thu Aug 23, 2018 2:03 pm
Location: Cambridge UK
Contact:

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

Post by anightin » Mon May 25, 2020 8:52 pm

hoglet wrote:
Mon May 25, 2020 8:43 pm
anightin wrote:
Mon May 25, 2020 8:28 pm
Hope they work!
Looking good....

On one of them (top right in the photo), the CPLD looks a bit mis-aligned with the pads.

Do check them very carefully for solder bridges, under bright light (e.g. outside), ideally using some form of magnification.

Dave
Thanks Dave, yes one I'm not entirely happy with. I will try removing the CPLD and re-seating if it doesn't check out.

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

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

Post by IanB » Mon May 25, 2020 9:14 pm

anightin wrote:
Mon May 25, 2020 8:28 pm
Hope they work!
Good luck!

As people are starting to build the latest issue 3 boards, I've just updated the BOM in the wiki to reflect the differences between the six bit issue 2 and 6/8 bit issue 3 boards

https://github.com/hoglet67/RGBtoHDMI/w ... t-Board%29

User avatar
anightin
Posts: 483
Joined: Thu Aug 23, 2018 2:03 pm
Location: Cambridge UK
Contact:

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

Post by anightin » Mon May 25, 2020 9:27 pm

IanB wrote:
Mon May 25, 2020 9:14 pm
anightin wrote:
Mon May 25, 2020 8:28 pm
Hope they work!
Good luck!

As people are starting to build the latest issue 3 boards, I've just updated the BOM in the wiki to reflect the differences between the six bit issue 2 and 6/8 bit issue 3 boards

https://github.com/hoglet67/RGBtoHDMI/w ... t-Board%29
Many thanks Ian, and especially for updating the Wiki! :D

User avatar
anightin
Posts: 483
Joined: Thu Aug 23, 2018 2:03 pm
Location: Cambridge UK
Contact:

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

Post by anightin » Fri Jun 05, 2020 10:06 pm

First attempt at SMD soldering and ... [-o<
IMG_7063.jpeg
Bit confused at first why my monitor didn't like the initial boot screen, but the CPLD programmed fine and after that the menu sorted itself out.
IMG_7064.jpeg
IMG_7065.jpeg
IMG_7066.jpeg
IMG_7067.jpeg
:D :D :D

Thanks for a great project again guys and for a great Wiki page.

=D> =D>

... Now on to the analogue boards :)
IMG_7068.jpeg

Update post ABUG:


All 5 6-Bit boards up and running now which is great. One to share between my Beeb, Master and Electron, 4 for the rest of my ancient 8-bit collection.

Analogue boards now built but not yet tested:
IMG_7076.jpeg
Last edited by anightin on Sun Jun 07, 2020 11:30 pm, edited 1 time in total.

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

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

Post by IanB » Fri Jun 05, 2020 11:04 pm

Nice to see another successful build =D>
anightin wrote:
Fri Jun 05, 2020 10:06 pm
Bit confused at first why my monitor didn't like the initial boot screen, but the CPLD programmed fine and after that the menu sorted itself out.
The screen offset in CPLD recovery mode is a bug that was introduced in one of the last changes before release. It's already been fixed for the next release.

BTW the TS12A44514DR analog switch on the analog addon board has been discontinued by RS and isn't stocked by Farnell so I've changed it in the wiki BOM to a 74LVC4066D which is stocked by both and has the same pinout. This has a slightly lower on resistance but I've tried one and it didn't make any significant difference.

JohnJones
Posts: 4
Joined: Sun May 24, 2020 2:19 pm
Contact:

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

Post by JohnJones » Sun Jun 07, 2020 7:42 pm

Hello IanB

You mentioned below that you had some of the 6-bit blank pcbs available. Do you still have some, and if you do how coiuld I get one? Many thanks.
IanB wrote:
Fri May 15, 2020 11:20 pm
system11 wrote:
Fri May 15, 2020 1:52 pm
This looks really good, are you selling made up devices or kits anywhere?
I was planning on getting a small batch made up in china but the current situation has put that on hold for the moment. I do have some 6 bit blank pcbs if you can do surface mount soldering and want to build one.

Parts list etc in the wiki:
https://github.com/hoglet67/RGBtoHDMI/wiki

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

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

Post by danielj » Sun Jun 07, 2020 7:57 pm

Just to say, I've ordered a few extra cplds from digikey given the price at Farnell is extortionate at the mo. Nudge me if anyone needs one.

d.

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

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

Post by IanB » Mon Jun 08, 2020 3:45 pm

JohnJones wrote:
Sun Jun 07, 2020 7:42 pm
You mentioned below that you had some of the 6-bit blank pcbs available. Do you still have some, and if you do how coiuld I get one? Many thanks.
Yes I still have plently of blank 6 bit pcbs. I've just sent you a PM with some info.

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

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

Post by IanB » Mon Jun 08, 2020 4:02 pm

anightin wrote:
Fri Jun 05, 2020 10:06 pm

Update post ABUG:

Analogue boards now built but not yet tested:
Looking good, however you should fit P6 and P7 on the other side of the board then cut off their pins flush with the plastic (see wiki photo).

RS actually stock the correct single pins now and I have linked them in the wiki but if you have spare ones of the 4 way header used on P2 you can cut individual pins off those to use instead. They act as feet and rest on top of the Pi zero's camera connector to stop P2 on the analog board from falling out of it's socket if you push down on the six way header which might result in the bottom of the analog board shorting against components on the Pi zero.

User avatar
anightin
Posts: 483
Joined: Thu Aug 23, 2018 2:03 pm
Location: Cambridge UK
Contact:

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

Post by anightin » Mon Jun 08, 2020 4:19 pm

IanB wrote:
Mon Jun 08, 2020 4:02 pm
anightin wrote:
Fri Jun 05, 2020 10:06 pm

Update post ABUG:

Analogue boards now built but not yet tested:
Looking good, however you should fit P6 and P7 on the other side of the board then cut off their pins flush with the plastic (see wiki photo).

RS actually stock the correct single pins now and I have linked them in the wiki but if you have spare ones of the 4 way header used on P2 you can cut individual pins off those to use instead. They act as feet and rest on top of the Pi zero's camera connector to stop P2 on the analog board from falling out of it's socket if you push down on the six way header which might result in the bottom of the analog board shorting against components on the Pi zero.
Much appreciated Ian, will do -- would most likely otherwise have found this out the hard way and then reaslised what they were for :lol:

Post Reply

Return to “8-bit acorn hardware”