RGB to HDMI using a Pi Zero and a small CPLD

discuss both original and modern hardware for the bbc micro/electron
dantaipan
Posts: 43
Joined: Fri Feb 18, 2022 6:45 pm
Contact:

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

Post by dantaipan »

IanB wrote: Wed Jun 28, 2023 12:48 am The frequency is usually printed on the can.
Didn't see your post before I sent my last one. This is from Sean Harrington's Aquarius repro board BOM:

Part NTSC Value PAL Value Device Package
XTAL1 7.15909MhZ 8.867239MhZ Q CRYSTAL
XTAL2 open 7.15909Mhz Q CRYSTAL

Here is a detailed pic of his repro board configured for NTSC
Image
User avatar
IanB
Posts: 1055
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 »

dantaipan wrote: Wed Jun 28, 2023 1:42 am If I do not adjust the V Offset the picture will not stay stable and flashes off and on.
Yes it was a PAL profile so things like the offset would need to be adjusted

Try this profile:
Aquarius_profile.zip
(637 Bytes) Downloaded 89 times

Delete any Aquarius.txt profile in \Saved_Profiles
Delete the original Aquarius.txt file in \Profiles\6-12_BIT_RGB\UK101_+_Laser 128_+_Aquarius
Unzip and put the Aquarius folder in its place
This has PAL and NTSC profiles and should auto detect and select the right one.

The pixel clock is 7.159090Mhz but for some reason the original profile had double that so was oversampling.
This updated profile uses 7.159090Mhz so may produce better results
You may need to recalibrate and make further adjustments to the offsets.
Please post any updated saved profile
dantaipan
Posts: 43
Joined: Fri Feb 18, 2022 6:45 pm
Contact:

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

Post by dantaipan »

IanB wrote: Wed Jun 28, 2023 4:27 am Please post any updated saved profile
Tried it. After small V offset adjustment and an auto calibrate it is absolutely perfect. Thanks Ian.

Saved config:
Aquarius_60Hz.txt
(182 Bytes) Downloaded 81 times
Screenshot:
capture0.png
User avatar
IanB
Posts: 1055
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 »

aotta wrote: Tue Jun 27, 2023 6:22 am why didn't you use the profile i already posted here? Did you wire the video signals from TEA how i suggested in my post?
Can you try my revised PAL/NTSC profile above on your PAL Aquarius and post a screencap of the source summary page so I can check the timings.
Also post your saved profile after any tweaks and auto calibration.
User avatar
aotta
Posts: 456
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 »

IanB wrote: Wed Jun 28, 2023 1:39 pm
aotta wrote: Tue Jun 27, 2023 6:22 am why didn't you use the profile i already posted here? Did you wire the video signals from TEA how i suggested in my post?
Can you try my revised PAL/NTSC profile above on your PAL Aquarius and post a screencap of the source summary page so I can check the timings.
Also post your saved profile after any tweaks and auto calibration.
Hi Ian,
i'll put it in my "to do list", but it may needs some time, i didn't found the Aquarius to test (i found the "boxed" one that i didn't modify to use with RGBtoHDMI).
I repair / modify computer i buy and put them in a LIFO stack, all over the house and in the little garage.
Sometimes i bought on ebay some "never seen before" retrocomputer for my collection, only to discover, after some time, that i already owned one of that!!! :roll:
User avatar
BeebMaster
Posts: 7380
Joined: Sun Aug 02, 2009 5:59 pm
Location: Lost in the BeebVault!
Contact:

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

Post by BeebMaster »

Can anybody remind me why I did this mod please?
RGBtoHDMIbodge.jpg
Think it might have been so I could update the firmware via the Pi SD card.
Image
User avatar
hoglet
Posts: 12664
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 »

BeebMaster wrote: Wed Jun 28, 2023 5:48 pm Can anybody remind me why I did this mod please?
On an original "3-bit" board it allows the Pi Firmware to reprogram the CPLD
https://github.com/hoglet67/RGBtoHDMI/w ... rogramming
User avatar
BeebMaster
Posts: 7380
Joined: Sun Aug 02, 2009 5:59 pm
Location: Lost in the BeebVault!
Contact:

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

Post by BeebMaster »

That's it, thank you so much! Looked around for ages, literally 15 or 20 seconds maybe, for that picture of the mod. I remember printing it out in colour and then going into the garage to do the soldering, but I couldn't tell from the print where which wire went as all the blue melded into one!
Image
User avatar
thedark
Posts: 501
Joined: Mon Feb 02, 2009 7:14 pm
Location: Elspeet
Contact:

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

Post by thedark »

How or where to buy one?
Cant find any info on it =D>
-------------------------------------------------------------
-=[[ Music 5000 Stil Rulez On The Acorn Scene. ]]=-
-------------------------------------------------------------
User avatar
IanB
Posts: 1055
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 »

thedark wrote: Wed Jun 28, 2023 10:26 pm How or where to buy one?
Cant find any info on it =D>
There is a link to some sellers in the project wiki
https://github.com/hoglet67/RGBtoHDMI/wiki
https://github.com/hoglet67/RGBtoHDMI/w ... s-for-sale
dantaipan
Posts: 43
Joined: Fri Feb 18, 2022 6:45 pm
Contact:

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

Post by dantaipan »

Are there known limitations of Apple ii artifacting emulation?

When comparing composite to my RGBTOHDMI profile it seems certain patterns are misinterpreted. Just want to know if it relates to my settings or if it is a known limitation. It seems anytime a checkered character appears in graphics it is misinterpreted. Composite left, RGBTOHDMI right. See the character's shirt and the area bottom-right of "C".

Screenshot 2023-06-29 120049.png
User avatar
IanB
Posts: 1055
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 »

dantaipan wrote: Thu Jun 29, 2023 5:03 pm Are there known limitations of Apple ii artifacting emulation?
The current single core algorithm (Pi zero or Pi 1) is rather simple due to the limited processing time available. A more sophisticated algorithm is run if you are using a multicore Pi like the zero 2W, Pi 3 or Pi 4. (PI 2 is also multicore but currently doesn't work with the multicore algorithm)
What program is that screencap from? I'll do a screencap with a Pi zero 2W for comparison.

I am investigating using a better algorithm for the Pi zero but it depends if it can be made to run in the time available.

Also there is an "Artifact Quality" setting in the Palette menu that will vary the output a little on the Pi zero
dantaipan
Posts: 43
Joined: Fri Feb 18, 2022 6:45 pm
Contact:

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

Post by dantaipan »

IanB wrote: Thu Jun 29, 2023 6:46 pm What program is that screencap from? I'll do a screencap with a Pi zero 2W for comparison.
It is from the game Aztec's intro screen. I have a separate setup for the 6-way IDC that was using Pi02w. I just swapped over to that and I can see how the area around the shirt looks a bit better but what should be a black and white checker pattern under the "C" defaults to magenta and green stripes. It seems a lot of games use that character in graphics.
IMG_3540.jpg
As an aside, is it better to keep the 02w in the 12-bit setup if I need to choose which one to keep it in?
User avatar
IanB
Posts: 1055
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 »

dantaipan wrote: Thu Jun 29, 2023 8:35 pm It is from the game Aztec's intro screen. I have a separate setup for the 6-way IDC that was using Pi02w. I just swapped over to that and I can see how the area around the shirt looks a bit better but what should be a black and white checker pattern under the "C" defaults to magenta and green stripes. It seems a lot of games use that character in graphics.
That's interesting, I wrote the simple single core algorithm and the multicore one was written by Reenigne, one of the authors of the 8088mph PC demo (which has some very sophisticated NTSC artifact tricks) but we have both arrived at the same result for that block. Reenigne's algorithm is used in several PC emulators but CGA mono mode has the same underlying pixel clock rate the Apple II so it is applicable to that as well as the PC.

The only thing I can think of at the moment is that the composite monitor you are using has a more sophisticated NTSC decoder which uses a comb filter among other things to try to extract more high frequency mono detail from the composite signal and that particular checker board pattern happens to be treated as mono with such a decoder.
Maybe if you connected the Apple II to an original 1970s/early 80s CRT TV/monitor it might look more like the artifact emulation.

I looked at several youtube playthroughs like this one and they all show the green stripes but of course they may be emulators or even an via an RGBtoHDMI:
https://www.youtube.com/watch?v=DZiBguz4twc
dantaipan wrote: Thu Jun 29, 2023 8:35 pm As an aside, is it better to keep the 02w in the 12-bit setup if I need to choose which one to keep it in?
At the moment the only benefit of the zero 2W is improved artifact emulation and that is mainly for the PC as it will correctly emulate artifacts in the PC's four colour modes and also produce the 1024 artifact colours in the 8088mph demo.
dantaipan
Posts: 43
Joined: Fri Feb 18, 2022 6:45 pm
Contact:

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

Post by dantaipan »

Well how about that. My commodore monitor looks just like your algorithm. So I guess that means it looks more authentic than what I am getting when sending composite into the RetroTink Pro 5x.
IMG_3542.JPG
User avatar
IanB
Posts: 1055
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 »

dantaipan wrote: Thu Jun 29, 2023 10:02 pm Well how about that. My commodore monitor looks just like your algorithm. So I guess that means it looks more authentic than what I am getting when sending composite into the RetroTink Pro 5x.
As I suspected, modern monitors and converters will have comb filters in their NTSC decoders. They work by adding and subtracting several lines or frames to more accurately extract the luma and chroma from composite video and that checker board pattern (with alternate lines being inverted copies of each other) must be seen as a mono signal due to the inverted lines cancelling out the chroma signal when combined.

Some more info on comb filters here if you are interested:
https://www.extron.com/article/ntscdb3
https://www.extron.com/article/ntscdb4

I think they were introduced in the late 80s or early 90s so emulating NTSC decoders without them would give a more authentic result.
dantaipan
Posts: 43
Joined: Fri Feb 18, 2022 6:45 pm
Contact:

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

Post by dantaipan »

Thanks for the info Ian, interesting stuff.
RonsCompVids
Posts: 1
Joined: Sat Aug 05, 2023 5:28 pm
Contact:

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

Post by RonsCompVids »

Just a small contribution to this amazing thread...

If you take Adrian's Macintosh Classic profile, and adjust the SETTINGS>GEOMETRY>SYNC TYPE> to be "+H-V" it works perfectly on the SE and SE/30!

Thank you!
Attachments
Capture.JPG
User avatar
IanB
Posts: 1055
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 »

RonsCompVids wrote: Tue Aug 08, 2023 5:13 pm If you take Adrian's Macintosh Classic profile, and adjust the SETTINGS>GEOMETRY>SYNC TYPE> to be "+H-V" it works perfectly on the SE and SE/30!
Thanks for that, I'll include it in the next beta
willinliv
Posts: 9
Joined: Sat Jan 07, 2023 10:38 pm
Contact:

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

Post by willinliv »

I've been experimenting with replacement ULA 'VLA82S+' in my Spectrum 48k which provides an RGB output 8-pin DIN socket, as an improvement over the YUV edge connector cable I was previously using with my RGBtoHDMI. I wired up the cable as 'Spectrum +2A or +3 (Analog RGB)' into an analog board, but I have yet to find a profile that I am completely happy with.

The VLA is compatible with Spectrum +2A/2B/3 cables - there is no High Intensity line, instead combined in the RGB. I have found the profiles for Spectrum +2, give lots of pixel movement, whereas Harlequin is very good so think timing is at play here (just needs a bit of horizontal adjustment). However with the Harlequin from some small testing I cannot seem to see any difference between the bright colours. Any ideas on how I might pull these out within the RGBtoHDMI? I'm wondering if I might adjust the Spectrum +2 profile, or modify the Harlequin one somehow.

Many thanks, Will
willinliv
Posts: 9
Joined: Sat Jan 07, 2023 10:38 pm
Contact:

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

Post by willinliv »

willinliv wrote: Thu Aug 17, 2023 2:30 pm Any ideas on how I might pull these out within the RGBtoHDMI? I'm wondering if I might adjust the Spectrum +2 profile, or modify the Harlequin one somehow.
Hang on, I've worked it out, not really edited the DAC settings before but comparing to the C0pperdragon profile where brights are just visible it gave me a hint where to start. Still need some further work I think and I have some transient noise running through the picture.
Attachments
PXL_20230817_203228010.jpg
User avatar
IanB
Posts: 1055
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 »

willinliv wrote: Thu Aug 17, 2023 2:30 pm The VLA is compatible with Spectrum +2A/2B/3 cables - there is no High Intensity line, instead combined in the RGB. I have found the profiles for Spectrum +2, give lots of pixel movement, whereas Harlequin is very good so think timing is at play here
Yes, timing is a factor here. The original 48K Spectrum had a pixel clock of 7.0 Mhz with 448 clock cycles per line and 312 lines but the later Spectrums +2/3 etc used a 7.0938Mhz pixel clock with 456 clock cycles per line and 311 lines.
To get perfect sampling the right combination has to be used so as this is a ULA for the original Spectrum I would assume it is using 7.0Mhz / 448 so you would want the original Spectrum timing.
willinliv wrote: Thu Aug 17, 2023 2:30 pm Any ideas on how I might pull these out within the RGBtoHDMI? I'm wondering if I might adjust the Spectrum +2 profile, or modify the Harlequin one somehow.
The Harlequin actually supports both types of clock frequency / line length and there are two sub-profiles available in the latest stable release and it should auto select the correct one although this is untested.
willinliv wrote: Thu Aug 17, 2023 2:30 pm Hang on, I've worked it out, not really edited the DAC settings before but comparing to the C0pperdragon profile where brights are just visible it gave me a hint where to start. Still need some further work I think and I have some transient noise running through the picture.
The harlequin ZX 7000000Hz sub-profile is probably the best starting point and you have to adjust the DAC settings to extract the levels.
From your photo it looks like you have already set the Green Hi / Lo settings mostly correct as you are displaying two levels for colours containing green. The other two adjustments (RB Hi and RB Lo) are shared between the red and blue thresholds and usually will be the same as the green levels unless there is something unusual like sync on green which is used by the c0pperdragon mod.
i.e. try setting RB Hi = G Hi and RB Lo = G Lo
Generally once you have some settings that work you should adjust the values up and down until something 'breaks" and then set the final values in the middle of that range (including the sync setting)

Your image shows a lot of noise and that is not normal. If it doesn't go away by adjusting the DAC levels a little, I have seen such noise caused by cheap "wall wart" power supplies so what are you using to power your RGBtoHDMI or Spectrum?
I have even seen this problem with the external PSU used to power a small monitor so not directly powering either the computer or converter and again it went away after replacing the PSU with a better one.

If your monitor has a built in USB hub you might be able to power the RGBtoHDMI from that using a USB to micro USB cable which is what I am now doing with my monitors.

The other possible cause of noise is the FPGA in the ULA replacement but that seems less likely if the noise is not visible on a normal analog monitor

If you get something usable, please post your saved profile (will be in saved_profiles on the SD card) and I will include in in a future release
willinliv
Posts: 9
Joined: Sat Jan 07, 2023 10:38 pm
Contact:

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

Post by willinliv »

IanB wrote: Sun Aug 20, 2023 10:32 pm Your image shows a lot of noise and that is not normal. If it doesn't go away by adjusting the DAC levels a little, I have seen such noise caused by cheap "wall wart" power supplies so what are you using to power your RGBtoHDMI or Spectrum?
Hi Ian, thanks for this as always - I did get some good settings that bring out the colour differences - but the noise remains. Happy to share when I double check things. I think your findings from the PSU might well apply in my case, I had an original Spectrum PSU and this did give a cleaner signal earlier on in my testing so might well be this. I did think the newer replacement PSU was an upgrade but maybe it isn't!

Meanwhile I have ordered a C0pperdragon for the ZX Spectrum from video game perfection. Switching the board to rgb mode, does the cable pinout follow that used by the other 3-bit RGB such as the BBC Micro into the 6-way IDC? E.g.

RGBtoHDMI 6 way IDC 6 way DIN Notes
Pin 1 GND Pin 5
Pin 2 SYNC Pin 4
Pin 3 BLUE Pin 3
Pin 4 GREEN Pin 2
Pin 5 RED Pin 1

Thanks, Will
User avatar
IanB
Posts: 1055
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 »

willinliv wrote: Tue Aug 22, 2023 7:09 pm I think your findings from the PSU might well apply in my case, I had an original Spectrum PSU and this did give a cleaner signal earlier on in my testing so might well be this. I did think the newer replacement PSU was an upgrade but maybe it isn't!

Meanwhile I have ordered a C0pperdragon for the ZX Spectrum from video game perfection. Switching the board to rgb mode, does the cable pinout follow that used by the other 3-bit RGB such as the BBC Micro into the 6-way IDC? E.g.
It does seem likely that the noise is PSU related and it could be caused by either one bad PSU or possibly certain combinations of switched mode PSUs that interact in unpredictable ways. The best option is to try the old linear PSU for the Spectrum as that shouldn't be noisy and if you are still seeing noise, try a different PSU for RGBtoHDMI and even a different monitor if available. Before powering my own RGBtoHDMI converters directly from the monitors I used to power them using the official Pi PSU (the older style one with interchangeable plug heads) and never saw any issues with that.

The c0pperdragon Spectrum board replaces the modulator with a small PCB that outputs RGsB on a 3.5mm TRRS connector via the hole for the modulator phono connector

The TRRS connector outputs RGB with sync on green so should be connected as follows:

Pin 1 GND TRRS sleeve
Pin 2 SYNC TRRS tip
Pin 3 BLUE TRRS ring 1 (next to tip)
Pin 4 GREEN TRRS tip (same as SYNC)
Pin 5 RED TRRS ring 2

See:
https://components101.com/connectors/35mm-audio-jack
willinliv
Posts: 9
Joined: Sat Jan 07, 2023 10:38 pm
Contact:

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

Post by willinliv »

Thanks Ian, I'll give a different PSU a try (I don't have the Sinclair one available at present), and the RGBtoHDMI is powered by one of those Ikea usb adapters. I think it's the PSU to the Spectrum though. Thanks for the heads up on that, Best, Will
User avatar
IanB
Posts: 1055
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 »

willinliv wrote: Tue Aug 22, 2023 11:38 pm Thanks Ian, I'll give a different PSU a try (I don't have the Sinclair one available at present), and the RGBtoHDMI is powered by one of those Ikea usb adapters. I think it's the PSU to the Spectrum though. Thanks for the heads up on that, Best, Will
I power my 48K Spectrum using this psu:
https://cpc.farnell.com/powerpax/sw4177 ... dp/PW04007
with the voltage set to 7.5v which keeps the internal regulator cooler although you might have to set it to the more normal 9v if you are using with addons that require that.

No special reason for this choice other than I already had one and it worked so I haven't looked at any other options.

The interchangeable tips are reversible which is important as the Spectrum has the polarity reversed on its power connector compared to the normal standard in use these days.
If you use this PSU, it's advisable to check the voltage and polarity are set correctly with a multimeter before plugging into a Spectrum.
User avatar
IanB
Posts: 1055
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 »

Mince wrote: Mon May 29, 2023 2:08 am Frankly, I'm amazed the RGBtoHDMI can get a perfect picture out of this! I don't know if you have any other suggestions but I think it was probably in a reasonably good position to start with — it's certainly usable: it's more the wandering voltages that are a bit irritating.
Here are some alternative profiles to try with your mutant caterpillar ZX81 composite interface.
It is probably a good idea to set the adjustment pots roughly back to the way they were originally if that is possible.

This one triggers off the leading edge of sync rather than the trailing edge:
ZX81-MC-Leading_.txt
(172 Bytes) Downloaded 70 times
This one uses the back porch clamp to set that as the voltage reference for the video level:
ZX81-MC-Clamp_.txt
(171 Bytes) Downloaded 71 times
This has both of the above:
ZX81-MC-Leading+Clamp_.txt
(171 Bytes) Downloaded 65 times
You will still have to first adjust the sync and Y Hi levels and run a calibration to get a stable image but one or more of these changes might help to keep the image stable.

Use the latest release and put the files in:
\Profiles\6-12_BIT_YUV_Analog\Sinclair_

Use the select profile menu as normal
dantaipan
Posts: 43
Joined: Fri Feb 18, 2022 6:45 pm
Contact:

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

Post by dantaipan »

Just popped in to say how impressed I am with c0pperdragon’s GTIADigitizer in combination with RGBTOHDMI. Attached pics for how I included it on 800xl. I also added a 3.5mm audio jack so I don’t need to use a full size cable just for audio. For this kind of thing I often just use a small headphone amplifier.
Attachments
IMG_4220.jpeg
IMG_4219.jpeg
IMG_4211.jpeg
dantaipan
Posts: 43
Joined: Fri Feb 18, 2022 6:45 pm
Contact:

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

Post by dantaipan »

Not sure why photos are rotated. They weren’t like that on my end.
User avatar
Tony359
Posts: 41
Joined: Fri Jul 28, 2023 11:38 pm
Contact:

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

Post by Tony359 »

Hi there - I purchased an RGB To HDMI to display EGA from an IBM XT. I just wanted to say how impressed I am with this little thing. It works beautifully and the output is crystal clear! Thanks for the efforts!
Post Reply

Return to “8-bit acorn hardware”