ArcDVI, Archimedes DVI/HDMI output

discuss the archimedes & risc pc, peripherals and risc os/risc os on pi
User avatar
Mattmos
Posts: 79
Joined: Sat Jul 31, 2021 4:42 pm
Location: UK
Contact:

ArcDVI, Archimedes DVI/HDMI output

Post by Mattmos »

Hola,

I wanted to share a project I've been working on recently, which has today graduated from 'mess of wires' into a real PoC :D I'm building a digital video DVI/HDMI output adapter for the Archimedes:
arcdvi_screenshot.jpg
This is a photo of my bench test monitor showing mode 23 from my A3000. (The monitor's confused; it really is 1152x896!) I like this shot both because the A3000 "cannot do mode 23", and because this is my trusty A3000 from back in the day, first used with a miserable 9" mono/green monitor. Quite the difference! 8)

The approach taken is to passively snoop on VIDC's signals (with VIDC remaining in circuit), in order to capture the VIDC register state, and video, cursor (and eventually sound) DMA transfers. For this demo, a board clips onto the soldered VIDC using the upside-down PLCC socket trick:
arcdvi_a3k.jpg
arcdvi_ulx3s.jpg
The black board holds the socket and some 74'245-like 5V to 3.3V buffers, series termination. The data bus, VIDC clock, VIDRQ/VDAK, SDRQ/SDAK, flyback, HSYNC/VSYNC and VIDW strobes are exported over the ribbon cable to an FPGA board. Here, I'm prototyping using an ULX3S board (which handily has an HDMI-style socket on it). (I think approaches, such as using a CPLD/tiny FPGA to reformat suitable for a RPi's SMI, are also possible, but I <3 FPGAs so that's what I've used.)

Roughly, this is what the FPGA design does:
ArcDVI.png
This circuit is not software-visible/doesn't require any software changes. It is subordinate to VIDC, which RISC OS programs as usual, and "passively" observes VIDC going through the motions of generating syncs and doing DMA cycles. (VIDC's output is unused.)

The VIDC DMA transfers are captured directly into a double-buffered line buffer, which is scanned out. In this setup, the FPGA is directly generating the DVI signal (using Mike Field's vga2dvid module), from its own video timing. The internal video timing is synchronised to the Arc's VSYNC (FLYBK, actually) a bit like a genlock, so the DVI output is running exactly 1 line behind the Arc's output.

I wanted to choose the high-res mode 23 first, mostly because I'd never (for obvious reasons) seen my A3000 do it, but also as a limit case test (do the hard one first). Mode 23 has a 96MHz pixel clock, but that's because it was simpler for the Arc's designers to do integer clock multiple/divisors from the VIDC clock (x4): for the mode, it's got enormous borders/porches compared to VESA, and a pixel clock nearer 80MHz is much more appropriate for this mode. (shrug) That's an issue as 96MHz is much too quick for this FPGA + the "soft DVI" design.

So, this system uses a 78MHz pixel clock (derived from 24MHz VIDC clock x3.25). At 96MHz, the mode 23 1568 pixel horizontal cycle is output in the same period of time as 1274 pixels at 78MHz. A matching horizontal period is key here, so the scan-in and scan-out stay in exact sync without over- or under-run (given they ultimately run from the same VIDC clock). Even at 78MHz, the tools are struggling to meet timing on this FPGA part (a Lattice ECP5 with nextpnr-ecp5). I'll try with Diamond, which may help. Many of the failed-timing bitstream builds turn out like this:
arcdvi_timing.jpg
#-o

You can still see some more minor artefacts on the first (grey, nice) screenshot that are due to the "soft DVI" core not (being compiled so it can be) meeting timing -- it's not my circuit, your honour. ;)

Many caveats today:
  • I got this fully working about an hour ago, so it's pretty raw :D But such fun! Thought y'all might like to see it.
  • The palette registers are captured, but I haven't implemented video palette lookup, so it won't do regular colour modes yet. That's next.
  • It doesn't yet support sound. There are multiple options here, e.g. a sigma-delta DAC, SP/DIF or even HDMI audio.
  • The cursor/pointer is manky (but better than the black square I used for test ;) ). There's some funny bit ordering that the data sheet doesn't explain. Easy to fix tho.
  • The screen mode is hard-wired currently, but the idea is the embedded CPU will "notice" screen mode changes and configure the video output appropriately. Note it isn't necessarily just 1:1, some modes could have different output timing in order to accommodate DVI-compatible modes with the same resolution as the Arc mode.
There are loads of possibilities from here.

Feature-wise, implementing the palette and being able to display the VGA modes is next, then I want to do line-/pixel-doubling. For example, DVI outputs 640x512 and mode 13 gets a 2x/2x scale, mode 12 gets a 1x/2x scale, mode 21 gets a 1x/1x scale.

Version 2: But then, I was thinking to add a 24-bit palette (by finding an unused VIDC reg to use as an extension reg, or port-knocking), for the 1/2/4BPP and 8BPP modes. The FPGA can easily store 256 palette entries instead of 16. I'll be asking all kinds of dumb ColourTrans questions at that point, I'm sure :D At this point it starts to look a little like a ColourCard in capability, e.g. display any mode that MEMC can address and VIDC can shuffle data for. For example, generate a 16BPP mode by programming VIDC like mode 15 (640x256 8BPP) but output it as 320x256 16BPP.

Version 3: THEN, the question comes up as to frame buffering and going "Full Colourcard" to decouple VIDC pixel clock from output pixel clock, e.g. get VIDC to output 1024x768 at 20Hz, and get ArcDVI to scan that out at 75Hz. This requires memory to buffer the frames.

Implementation-wise, these pictures/mess of wires are obviously just a PoC. As well as the A3000 board, I built another board (that I can't find to photograph right now #-o ) which is an interposer for VIDC-socketed machines like A440. It plugs into the VIDC socket, then VIDC plugs into it. I see ArcDVI as a stacked 2-board solution, to cope with the different machines. Maintaining two designs of one-board solutions would get grim, I think. Aside from hack value, the "soft DVI" solution isn't ideal. IMHO using a dedicated DVI serialiser like a TFP410 is a good approach, except that's quite an expensive additional part, whereas the in-FPGA solution is free-ish. That said, it might enable a cheaper FPGA to be used. Eventually, it'd be cool to develop a plug-in "product" for this, but you can't even buy parts today so that's a while away.

I'll get the boards (~trivial) and FPGA design on GitHub at some point if there's interest. It's not very clean at the minute, but I do intend this to be an open source design.
User avatar
IanJeffray
Posts: 5961
Joined: Sat Jun 06, 2020 3:50 pm
Contact:

Re: ArcDVI, Archimedes DVI/HDMI output

Post by IanJeffray »

This is very impressive. And dare I say a little silly. I'm boggled by it all. Great stuff! =D>
User avatar
Mattmos
Posts: 79
Joined: Sat Jul 31, 2021 4:42 pm
Location: UK
Contact:

Re: ArcDVI, Archimedes DVI/HDMI output

Post by Mattmos »

:D Silly is what it’s all about! Thank you thank you.

All because my SCART lead didn’t work (lead? HDMI converter box? Who knows, don’t care anymore). Still Arc-ing with mono composite video, so had to solve that problem …….
steve3000
Posts: 2909
Joined: Sun Nov 25, 2012 12:43 am
Contact:

Re: ArcDVI, Archimedes DVI/HDMI output

Post by steve3000 »

This is fantastic!!! =D> =D> =D>

How crazy is that? MODE 23 on an A3000… whatever next?

Have you read up on my high res mono efforts on the A540, maybe you can get widescreen modes working too: viewtopic.php?f=16&t=10705
User avatar
Mattmos
Posts: 79
Joined: Sat Jul 31, 2021 4:42 pm
Location: UK
Contact:

Re: ArcDVI, Archimedes DVI/HDMI output

Post by Mattmos »

steve3000 wrote: Fri Nov 19, 2021 8:42 pm This is fantastic!!! =D> =D> =D>

How crazy is that? MODE 23 on an A3000… whatever next?

Have you read up on my high res mono efforts on the A540, maybe you can get widescreen modes working too: viewtopic.php?f=16&t=10705
Cheers Steve :) I have indeed read up on your excellent high-res efforts (tab open <---), and had my eye on trying out 1440x900. Currently modes are selected at build-time, but that'll change, and your module will be a great test. I reckon at this point it's less about memory bandwidth and more about how long it'll take the gutless wonder 2MB ARM2 A3000 to redraw huge windows :)

I was thinking 1280x720@60 would be a nice match for my 16:9 test monitor. Though, if I'm building a custom mode anyway, ArcDVI isn't limited to having to use HiRes mode -- could do this at 2BPP/4 greys and with a nice colour pointer ;) (1440x900@2BPP is <480KB, so is another option.)

I remember playing with custom modes 20 years ago, but need to refresh my memory, e.g. find example mode module source (I want to tell RISC OS one thing, and tell VIDC another, and display a third, IYSWIM).
User avatar
Mattmos
Posts: 79
Joined: Sat Jul 31, 2021 4:42 pm
Location: UK
Contact:

Re: ArcDVI, Archimedes DVI/HDMI output

Post by Mattmos »

A little update:
F41A4CD7-1EB4-405F-88E0-03EBD0516360.jpeg
(Fake/hardwired palette, but colour at last!) There’s an odd noise issue that’s turned up (slightly twinkling pixels, I believe on the DVI end), may be the PSU getting hot :D
Line/pixel doubling next!
Paul
Posts: 223
Joined: Fri Nov 15, 2013 10:39 am
Contact:

Re: ArcDVI, Archimedes DVI/HDMI output

Post by Paul »

Superb work!

:D

Paul.
thecellartroll
Posts: 1072
Joined: Thu Nov 24, 2011 10:43 pm
Location: Lanark, Central Scotland
Contact:

Re: ArcDVI, Archimedes DVI/HDMI output

Post by thecellartroll »

This is a very exciting project indeed!
User avatar
anightin
Posts: 970
Joined: Thu Aug 23, 2018 2:03 pm
Location: Cambridge UK
Contact:

Re: ArcDVI, Archimedes DVI/HDMI output

Post by anightin »

Very Cool Matt -- this could be very popular I think =D>
User avatar
Mattmos
Posts: 79
Joined: Sat Jul 31, 2021 4:42 pm
Location: UK
Contact:

Re: ArcDVI, Archimedes DVI/HDMI output

Post by Mattmos »

Hello! I've been busy hacking and have some more progress to report :)

First, I got line-doubling working. Here's the desktop in mode 15, scaling 640x256 (which won't display on most monitors) to output as 640x512:
arcdvi_mode15.jpeg
(The current design has a broken cursor in line-doubled modes, better than in this screenshot (which is an earlier broken) but corrupt.)

Similarly, pixel-doubling works, outputting 320x256 as 640x512. Mode 13 et al are good; here's DEMO3:
arcdvi_mode13_demo3.jpeg
I'd been using an inconvenient serial console to switch mode/change timing parameters on the fly for development. Now, mode-change detection is working. The firmware notices VIDC reconfiguration and infers the best output timing, whether to double in X or Y, etc. In short, change mode on the Arc and ArcDVI follows, choosing a good config.

At this point, all the standard desktop/game modes Just Work: 0/1/8/9/12/13/15/18/19/20/21/23/25/26/27/28.

Line-doubling of the wide modes (e.g. 24/35/39) doesn't work yet: line-doubling means outputting lines twice as fast, and with 24MHz output pixel clock there aren't enough horizontal pixels to do this. This is fixable by having a faster output pixel clock, e.g. 48MHz, with the complication that we then get into dynamic PLL reconfiguration/clock switching.

The mode inference routine supports non-standard modes, so e.g. game variations of 320x256 should just work. For example, here's Transmortal (one of my favourite demos) at 320x272:
arcdvi_transmrtl.jpeg
It looks so strange and sharp! It's like using an emulator ... and it's disconcerting having a 4K monitor on an Arc :D :D

I completely forgot about the SVGA modes. I'd thought the A3000 wouldn't even try to switch into them, thinking RO would probe for a VIDC enhancer (but it does). But one oddity of ArcDVI is I don't think VIDC enhancers are all that necessary. They're for refresh rate, not resolution! So, SVGA modes actually work, but at a reduced refresh rate in the framebuffer-update sense. (I'd argue an Arc's not going to come close to 60Hz updates of an SVGA-amount of data anyway :) ) The display is totally stable, as many modern monitors decouple the LCD scan from the input signal anyway. Here's a perfectly usable mode 31 at 37Hz:
arcdvi_mode31.jpeg
In other photos I've posted, you'll see glitching/broken pixels -- this is my bench/test display not liking the DVI signal, whereas these newer photos are from my desktop "good" monitor which displays perfectly. To avoid irritating incompatibilities, I believe the way forward is building a board with a dedicated DVI transmitter (e.g. TFP410, ADV7511 etc.) rather than continuing with the "soft DVI" FPGA core.

OK. At this point I think this is feature-complete for a useful/practical v1. I'm still tidying up, but will get the PCBs/Verilog published in the next couple of days. Then, I think it's best to return to this in a few months and tackle building a board when parts are more freely available -- everything is SO expensive right now, if you can even buy it. (I'll do some experiments to see just how small this design can be, i.e. which cheapest FPGAs will fit it.)
User avatar
Mattmos
Posts: 79
Joined: Sat Jul 31, 2021 4:42 pm
Location: UK
Contact:

Re: ArcDVI, Archimedes DVI/HDMI output

Post by Mattmos »

But wait, there's more!

I found a couple of reserved VIDC register locations that can hide ArcDVI-specific "extension" registers. Just prototyping/messing, but I made these a conduit to write 24bit colours to the 8bpp palette. Here're 256 greys in mode 28:
arcdvi_8bpp_grey.jpeg
(There aren't any RISC OS smarts here yet... RO still thinks the palette is the same. Shrug. If someone can explain ColourTrans to me in 20 words or fewer, I'd be happy to learn. Is it even possible to use a custom 256 colour palette on RO3.1?)

And hackier still, here's a 16BPP 320x256 mode:
arcdvi_16bpp.jpeg
(The Arc thinks this is mode 15, but it's displayed as two bytes per pixel at half the res with an image *LOADed into screen memory, hacky hack hack. "Some work is required". :) )
User avatar
dominicbeesley
Posts: 2210
Joined: Tue Apr 30, 2013 12:16 pm
Contact:

Re: ArcDVI, Archimedes DVI/HDMI output

Post by dominicbeesley »

That is very cool!
User avatar
davidb
Posts: 3395
Joined: Sun Nov 11, 2007 10:11 pm
Contact:

Re: ArcDVI, Archimedes DVI/HDMI output

Post by davidb »

=D> It's the graphics enhancer card we all wanted back in the day. :)
paulb
Posts: 1767
Joined: Mon Jan 20, 2014 9:02 pm
Contact:

Re: ArcDVI, Archimedes DVI/HDMI output

Post by paulb »

It is certainly rather impressive and rather like various colour card solutions, albeit using a different way of obtaining the video data. The colour cards also offered a more flexible palette but were also restricted to the video memory limit of the VIDC. Later State Machine cards reportedly got around that by relocating the MEMC as well, but there aren't too many details of them out there, and I wonder how successful (or even available) they were given that they were announced/introduced not long before the Risc PC came along.

Congratulations on making this work and bringing the colour card concept into the modern era!
User avatar
Mattmos
Posts: 79
Joined: Sat Jul 31, 2021 4:42 pm
Location: UK
Contact:

Re: ArcDVI, Archimedes DVI/HDMI output

Post by Mattmos »

Cheers folks!
paulb wrote: Sun Nov 28, 2021 12:32 am It is certainly rather impressive and rather like various colour card solutions, albeit using a different way of obtaining the video data.
Thanks for the link, really interesting! I remember seeing ads (and a PCATS card at an AU show), and the custom resolutions made sense to me, but I never understood how they interacted with RISC OS on the colour front. From the article it sounds like RO3.1 is perfectly happy to choose from flexible 256col palettes. (I’d mis-remembered 256 grey demos in non-desktop only.) How do they do this? Did they hack/replace ColourTrans, or is the stock one good enough?
steve3000
Posts: 2909
Joined: Sun Nov 25, 2012 12:43 am
Contact:

Re: ArcDVI, Archimedes DVI/HDMI output

Post by steve3000 »

This is wonderful, great progress so far!

As you've found, RISC OS 3 doesn't check for VIDC enhancers, and there was no standard in how these were designed back in the day (many used AUX port to switch clock speed, at least one used I2C and you even had some manually controlled ones with a switch on the side of the computer to change the clock speed!). The computer concepts colourcard gold ran most large modes at VIDC speeds of 10-15Hz, with output at 70Hz+ and this reduced video databus usage considerably, making very large modes (1024x768x16c, etc) perfectly usable.
Mattmos wrote: Sun Nov 28, 2021 12:50 am I never understood how they interacted with RISC OS on the colour front. From the article it sounds like RO3.1 is perfectly happy to choose from flexible 256col palettes. (I’d mis-remembered 256 grey demos in non-desktop only.) How do they do this? Did they hack/replace ColourTrans, or is the stock one good enough?
IIRC RISC OS 3.1 includes support for fully definable 256 colour palettes, just the hardware doesn't. So it may even be as simple as defining the VDU variables list of your mode definition to indicate 256 real palette entries, and trapping writes to the palette vector to send to your new registers...

The CC colourcard gold certainly enabled 256 entry palettes and it even patched RISC OS 3.1 to allow 16bit colour in the desktop, although with a fairly small screen size due to the 480kb max screen memory. Not sure how much extra work was needed to get the desktop working in 16bit, but I'm sure it would be possible to borrow their patches and adapt for yours, of you get to that stage :)
User avatar
IanJeffray
Posts: 5961
Joined: Sat Jun 06, 2020 3:50 pm
Contact:

Re: ArcDVI, Archimedes DVI/HDMI output

Post by IanJeffray »

Low-refresh-rate MODE 31 (and larger res) is one of the best features of the ColourCard, so having such capability as you've shown here is great -- desktop refresh rate is rarely interesting (though I guess the cursor will also only update at the same rate, which is different to ColourCard).

The 16bpp is just hilarous. Gotta make use of that! :) Great stuff.
sirbod
Posts: 1624
Joined: Mon Apr 09, 2012 9:44 am
Location: Essex
Contact:

Re: ArcDVI, Archimedes DVI/HDMI output

Post by sirbod »

Mattmos wrote: Sat Nov 27, 2021 11:52 pm And hackier still, here's a 16BPP 320x256 mode
Impressive indeed.

Who'd like to see Zarch running in 16BPP on a classic Arc?
sP1d3r
Posts: 769
Joined: Fri Aug 23, 2019 2:40 am
Contact:

Re: ArcDVI, Archimedes DVI/HDMI output

Post by sP1d3r »

I wonder how it's possible to get Zarch these days, looking for a copy on eBay seems to be the only option.
User avatar
geraldholdsworth
Posts: 1401
Joined: Tue Nov 04, 2014 9:42 pm
Location: Inverness, Scotland
Contact:

Re: ArcDVI, Archimedes DVI/HDMI output

Post by geraldholdsworth »

Have you asked Superior?

Richard's brother Steve still sells copies of the old stuff, so may have a copy he'd happily sell you.
Gerald Holdsworth, CTS-D
Extron Authorised Programmer
https://www.geraldholdsworth.co.uk
https://www.reptonresourcepage.co.uk
Twitter @radiogezza
User avatar
Mattmos
Posts: 79
Joined: Sat Jul 31, 2021 4:42 pm
Location: UK
Contact:

Re: ArcDVI, Archimedes DVI/HDMI output

Post by Mattmos »

+++ Time passes

Finally got a chance to push this to GitHub. The main repo is https://github.com/evansm7/ArcDVI which contains the Verilog/firmware. The crappy prototype PCBs are here https://github.com/evansm7/ArcDVI-PCB (tho I expect Future Better PCBs would go there too :) ).

I spent a morning looking for HDMI serialisers that fit this spec:
  • Generate DVI/HDMI from a 24b parallel bus (or 12b DDR)
  • Ideally, support HDMI audio (with I2S input)
  • QFN, QFP packages, not BGA
  • Not obsolete, no NDA
  • Available in small quantities, ideally from Mouser/DK/Farnell
  • Ideally <=£5
Does anyone have any suggestions for parts to look at? I've used TI's TFP410 in other projects, but it's getting (more!) expensive and doesn't do audio. I like the look of the Analog ADV7511 feature-wise but can't see how to buy it. :(

I'll have a look at doing a proper PCB/kit for this probably in the new year (hopefully when parts are easier to get), but if anyone gets impatient and you want to build something yourself, do let me know! In the meantime, ideas, comments, wishes ... crack on. :)
paulb
Posts: 1767
Joined: Mon Jan 20, 2014 9:02 pm
Contact:

Re: ArcDVI, Archimedes DVI/HDMI output

Post by paulb »

Mattmos wrote: Sun Nov 28, 2021 12:50 am Cheers folks!
paulb wrote: Sun Nov 28, 2021 12:32 am It is certainly rather impressive and rather like various colour card solutions, albeit using a different way of obtaining the video data.
Thanks for the link, really interesting! I remember seeing ads (and a PCATS card at an AU show), and the custom resolutions made sense to me, but I never understood how they interacted with RISC OS on the colour front. From the article it sounds like RO3.1 is perfectly happy to choose from flexible 256col palettes. (I’d mis-remembered 256 grey demos in non-desktop only.) How do they do this? Did they hack/replace ColourTrans, or is the stock one good enough?
I thought one of the ColourCard experts would reply to this, but I think Computer Concepts patched various things to support 15/16 bpp modes for the ColourCard Gold: "Graphics cards galore", Acorn User, January 1994. So, CC weren't above patching things to get them working and generally going their own way, as those of us who used their software products would know.

It is possible that ColourTrans would be fine with a custom palette in 256-colour modes, but I would have to look at the PRMs from the era to check. Obviously, Acorn had to make sure that such capabilities were available for the VIDC20 machines, so official support would have arrived at some point, anyway.
sP1d3r
Posts: 769
Joined: Fri Aug 23, 2019 2:40 am
Contact:

Re: ArcDVI, Archimedes DVI/HDMI output

Post by sP1d3r »

I've found with !Lander that you can recharge the craft's energy if you land on the starting point but you need a great sense of direction to get back to it.
User avatar
kppot
Posts: 148
Joined: Mon Oct 23, 2017 10:48 pm
Location: Moscow
Contact:

Re: ArcDVI, Archimedes DVI/HDMI output

Post by kppot »

Just WOW! =D>
User avatar
vanpeebles
Posts: 763
Joined: Wed Nov 28, 2012 10:01 am
Location: UK
Contact:

Re: ArcDVI, Archimedes DVI/HDMI output

Post by vanpeebles »

Will you be making these to sell at some point? :)
User avatar
Mattmos
Posts: 79
Joined: Sat Jul 31, 2021 4:42 pm
Location: UK
Contact:

Re: ArcDVI, Archimedes DVI/HDMI output

Post by Mattmos »

vanpeebles wrote: Tue Dec 14, 2021 1:43 pm Will you be making these to sell at some point? :)
I reckon so. Just browsing Mouser/DigiKey for parts, though, it's not looking great for availability so I'm going to give up until the new year by which point things may have changed.

If I find the right DVI/HDMI chip then that makes the FPGA requirements lower, which increases choice, which increases availability. It'll involve a round of prototypes. I'll keep y'all posted of course. :D
User avatar
Joka80
Posts: 144
Joined: Tue Dec 25, 2018 7:37 pm
Contact:

Re: ArcDVI, Archimedes DVI/HDMI output

Post by Joka80 »

Hello Mattmos

Would this would in conjunction with an Ultra VIDC (for those who have it installed in there A3000’s specifically) or would it totally replace that?

Looking at a kit for an A3000…pm sent as well :D :D :D
User avatar
Mattmos
Posts: 79
Joined: Sat Jul 31, 2021 4:42 pm
Location: UK
Contact:

Re: ArcDVI, Archimedes DVI/HDMI output

Post by Mattmos »

Joka80 wrote: Mon Jan 03, 2022 2:55 pm Hello Mattmos

Would this would in conjunction with an Ultra VIDC (for those who have it installed in there A3000’s specifically) or would it totally replace that?

Looking at a kit for an A3000…pm sent as well :D :D :D
Hey Joka80 – my current belief is the two should all coexist but a VIDC enhancer isn’t required. My PoC above shows the SVGA mode displaying correctly from my enhancer-less A3000. It remains to be tested but in theory using a higher VIDC clock (from UltraVIDC) will all work fine, just will increase the video refresh rate in a way that won’t be too noticeable on LCD monitors/TVs.

Re future kits, I’ll update this thread with progress, don’t worry :)
User avatar
Mattmos
Posts: 79
Joined: Sat Jul 31, 2021 4:42 pm
Location: UK
Contact:

Re: ArcDVI, Archimedes DVI/HDMI output

Post by Mattmos »

It's not dead yet!

It still remains a terrible time to buy anything made from element 14, but I now posess a handful (a small hand) of ICE40HX FPGAs and am designing a test board around them. Very early preview:
arcdvi-1.png
arcdvi-2.png
This will piggyback onto the black PCB in the prototype-1 pics above to replace the ULX3S. I'm thinking of this board as ~prototype-2, not a product just yet!

The other fly in the ointment is the DVI (or HDMI) transmitter. There are a few options but most aren't in stock from the main (DK/Farnell/Mouser/etc.) western distributors. One option is to try luck on pool-of-fakies Alibaba or Taobao, but not keen. So, I've decided to try the TDA19988 from NXP, which is in stock and not too expensive. It's an obsolete part, so will eventually dry up, but availability would be ironic to worry about right now. :-) The other issue is the registers aren't publicly documented, but all things considered I've decided to try my luck gleaning initialisation info from a couple of opensource drivers.

Stepping back/upwards, I'm thinking a three-board solution for this (!). There are two problems to solve: supporting A3000 and not being able to fish an HDMI cable into the case.

The A3000 and A5000 have soldered-down VIDCs and will need a clip-over PLCC approach, whereas the A540/A4x0/A3x0 have socketed VIDCs and will need a board-in-the-middle interposer approach. Rather than redesign the complicated board twice, I think it's easier* having an adapter board to get VIDC's signals onto 0.1" headers plus a second board with the complicated stuff. Note in the pic above there's no DVI socket -- the signals will go onto FFC (top right) onto a third trivial adapter board which can mount on the back panel. FFC can fish through the case gaps on the A3000 and the adapter board (with video out socket) can ... bolt to it somehow. Someone can come up with a pretty bracket for the M6 holes on the back of the A3000 :-)

This board should be quite nice if it works. My plan is an ICE40HX to capture the VIDC video _and_ audio DMA, doing video reformatting as per previous prototype, sending that to the HDMI transmitter. There's an RP2040 (this adapter ARM-based and faster than the host...) to program the FPGA and make it easy to do in-field bitstream upgrades over USB -- but also will generate the I2S audio output to the HDMI chip. Easier to do sample rate conversion/filtering/DSP-whatever in software there.

If it all goes to shit then this would at least be a fun standalone microcontroller/FPGA video game board ;-)

Will, as ever, keep this thread updated if I get anywhere!
User avatar
Mattmos
Posts: 79
Joined: Sat Jul 31, 2021 4:42 pm
Location: UK
Contact:

Re: ArcDVI, Archimedes DVI/HDMI output

Post by Mattmos »

Some progress to report! I got the PCBs back.

Here's the main board corresponding to the Kicad screenshot in the previous post (shown pre-FPGA population):
arcdvi_board_constr.jpeg
Broadly, the VIDC signals go into the pins on the left (from one of the boards shown previously that has an upturned PLCC socket to clip onto VIDC); in the centre is an ICE40HX4K FPGA which does the reformatting/buffering/scaling; at the top is an RP2040 as a tremendously-overpowered but thoroughly purchasable and convenient MCU; on the right is a TDA19988 HDMI serialiser. The 2040 programs the FPGA bitstream and controls the serialiser via I2C; it communicates with the design in the FPGA to read/write VIDC & output timing/config registers. In short, it watches for VIDC config to change, calculates which mode timing to use, and configures the output module appropriately.

You'll notice it doesn't have a DVI or HDMI socket on it! Well, it's mechanically awkward to fish a DVI/HDMI cable into the guts of a machine. The FFC socket at the top takes the signals out to a separate back panel board (which can be more easily tuned/redesigned to suit different machines where necessary). I tried JLCPCB's aluminium PCB service to make a back panel -- am very pleased with their manufacturing quality. It's got nice tactile raised-ink silkscreen printing:
arcdvi_panel_boards.jpg
These two provide a single-width podule plate-mounted socket, or in principle some sort of A3000-friendly solution (such as some kind of bracket that attaches to the M6 threaded holes above the expansion connector):
arcdvi_rear.jpeg
This is a v1, and still a bit of an experiment. I wanted a physical thing to debug, and to try to fit in various machines to see what the problems were, but plan to do (at least) another revision.

It's currently a 3-board solution, then (the only real issue with 3 being time to assemble, as the boards themselves are very cheap). The bottom interface board might need to be a different shape between A3000 and A5000 even though both have soldered-down VIDC. And the socketed-VIDC interposer version may also need to differ between A{3,4}xx series and A540. These are TBD. My rationale is that creating a new interface board is much easier than having the interface and logic on the same board that needs to be laid out again each time!

Alternatively, the logic and HDMI socket could be on the same rear panel-mounted board, with an FFC to VIDC, but then that doesn't work for A3000. As ever, I'm interested in suggestions. :)

This is it mounted in my A3000:
arcdvi_a3k_1.jpeg
The eagle-eyed among you will notice this setup is a few mm too tall to fit underneath the FDD -- not a surprise, the 0.1" headers are much too big (about 10mm tall). My thinking for the next rev is to use 2mm headers, which have a much shorter stacking height (yet should be large enough for the scenario of ArcDVI+interposer bottom board which will have VIDC socketed in the middle).

The TDA19988 video serialiser was a bit of a risk: they're obsolete, but there's plenty of stock at DigiKey etc. (i.e. you can actually buy them && price is reasonable, unlike TFP410, ADV7911 etc. However, they require a complicated and undocumented (closed) register init sequence that on paper needs careful configuration tailored to each required output resolution/config. :roll: But, stars are aligned and actually the basic init sequence appears to then work for any resolution anyway, and after a bit of updating the RTL/MCU firmware, it works: :D :D
arcdvi_working_yay.jpeg
The ICE40HX PLL appears also to support (^Wbe abusable to do) dynamic reconfiguration, meaning freely-variable output pixel clocks. That's really useful for the upscaling. Consider mode 35, 768x288 with a 16MHz VIDC pixel clock: this mode is too low-res and needs line-doubling, but the 24MHz VIDC clock isn't fast enough to draw 576 lines in the same frame period. A 36MHz clock makes this mode now work (it didn't in the first prototype)! Similarly, mode 16 (1056x256) now works at 1056x512 using a 48MHz output.

So 24, 36, and 48MHz are useful. But so is 96, for my beloved hi-res mode 23, and the dynamic aspect means ArcDVI can just detect when the Arc uses mode 23 (or similar HR modes) and pop up to 96MHz to suit.

Just to scratch a particular itch, this is my ARM2 A3000 running RISC iX with hi-res mono :D
arcdvi_riscix_2.jpeg
It's ...not fast. :-)

(Trivia: RISC iX, with a high-resolution mono monitor, generally uses 1152x896 or 1152x900 depending on the console size (as selected by the Print key menu). However, the VT-switcher Break key (hmm have I got these swapped?) menu switches down to 640x400 at 96MHz, with mahoosive borders. ArcDVI doesn't display these modes yet; another use for letterboxing, but we're really niche within a niche here...)

The state of play today is:
  • It works
  • I fixed the cursors, which now look good in all modes/resolutions. (Their screen position to some degree relies on some magic numbers, but they seem to be in the correct position...)
  • All the stock RO3.1 modes work (on my monitors), VGA, 640x512, SVGA, 1152x900 -- with the exception of mode 39 (and friends). These are 896x352, not *quite* tall enough for monitors to accept, but line-doubling creates 896x704 which is outrageously square and also not really acceptable. With some work, a ("visible") vertical letterbox could be applied to output these as something like 1024x704 which might work. Not a priority for me RN.
  • Bizarrely, the 16-colour 1056x256 mode 16 works fine yet the 256-colour mode 24 is a flickery broken mess. The timing/sync between the two is somehow different even for the same res :shrug: Will debug.
  • I feel it's now feature complete (for v1) and I should focus on the mechanical aspects, and how to build them in greater numbers
  • The design relies on parts that are all easily purchased EXCEPT for the ICE40HX4K-TQ144 FPGA, which like most other FPGAs is unobtanium. I bought a handful from RS a few months back in anticipation ... but these remain the gating factor to producing boards.
Ah, almost forgot, tinkering is very moreish. I added rear DIP config switches but never really found anything that needed configuration:
arcdvi_rear_board2.jpeg
Some will be aghast at this newfangled TFT monitor rubbish, revelling in their freedoms to put their back out lifting ancient glass display devices and sorely missing the CRT fuzzy aesthetic. To appease you, I tried a trivially crappy "CRT look" mode, which performs the line-doubling by darkening the padded lines to give a slightly stripy effect:
arcdvi_crtfx1.jpeg
arcdvi_crtfx3.jpeg
It's by no means actual blending or image processing, it's cheap-but-nice. (Speaking of which, the trivial line/pixel doubling is a feature not a limitation, I prefer the slightly-blocky result and do not want to do any proper scaling/interpolation.) And, config switch #1 now has justification -- to turn 'CRT-look' on/off. :)

Anyway -- another lengthy post but I hope it is of interest. :) I will push the RTL and firmware at some point soon. If anyone has any feedback about the mechanical "shape" of the next version (3 boards/2 boards, accommodating A3000/A5000/A{3,4,5}xx etc.) do chime in. The prospect of building these boards en masse is slightly daunting. Depending on how I acquire the next supply of ICE40 FPGAs (in 2023? :P ), I'll think about whether someone like JLCPCB can do assembly also.

edit: sorry for the repetition w.r.t. previous post! It's late X-(
Post Reply

Return to “32-bit acorn hardware”