HDMI over Pmod using the Arty Spartan 7 FPGA board

tl;dr: This post shows that driving DVI-D over an HDMI cable, directly connected to the High Speed Pmod connector of Digilents Arty S7 board, is very much possible- even at high resolution.

I’ve been working away on my RISC-V FPGA based computer ‘kit’, which is based on my VHDL CPU: ported to RISC-V. I wanted to get a new development board with faster ram, and found it hard to find boards with DDR3 memory, a large enough FPGA, SD card interface, and HDMI out.

The SD card was not really a problem – it’s low speed, you can just connect it with slow SPI I/O. HDMI is certainly considered high speed – bandwidth across the 4 serial channels top 4.4Gbps – but is driving HDMI though basic I/O interfaces possible?

It most certainly is!

A caveat, though: There is no protection circuitry. Do this at your own risk 🙂

The Digilent Arty S7 board can be had for sub £100, and my XC7S50 variant cost £119 shipped. It has DDR3, but no on-board HDMI. However, it turns out you can get perfectly acceptable (for my needs, anyway) output from the high-speed Pmod I/O ports. This will go very nicely with the small USB powered HDMI screens you can find, which are very handy. Image showing development board conencted via breadboard wires to an HDMI connector breakout board, which is driving a small HDMI display. I have put a 720p output test on github. It should load in Xilinx Vivado out of the box. You need to connect an HDMI cable to the Pmod, by either splicing a cable, or getting something like the Adafruit breakout board (seen above). It connects to Pmod JA, circled.

Image showing what I/O port to use.In the constraints file for the project, the Pmod pins are specified to use the TMDS_33 standard. The pinout is defined as follows:

A diagram showing what Pmod pins are for what HDMI purpose.The VHDL code in the example uses a simplified 1280x720x60 pixel clock of 75MHz – not the required 74.25MHz as per the standard. Due to this, some TVs/monitors may not accept the signal. It runs fine on my Acer XF240H and Samsung LU28E590DS using a 1m cable. I have not tried a television – they tend to be more picky. You can get much closer to 74.25MHz by chaining clock generators, but I have not done that in this instance. The refresh rate reports as 61Hz with this clock, likely due to it being out of spec.

If you want to learn more about how my example project generates a HDMI/DVI-D signal, you can find details here, which is part of my Designing a CPU in VHDL blog series.

Picture showing a monitor displaying a 720p signal.A video of it in action, using timings applicable for my 800×480 module.

You can change the pixel clock and the vga timings (sync starts, ends, porches ) in the code to generate different resolutions. For 1080p60Hz the pixel rate is supposed to be 148.5MHz, but again my monitor will accept a rate of 150MHz, and show 61Hz.

Even 1440p30 is possible. 1440p60 did not work, but I didn’t try hard to get a more accurate pixel clock in that instance. When you get to higher clocks, you can start to get timing constraint issues. At 1080p and 1440p I had some timing failures listed in the implementation report, but they did run. If you were using this in a real system, you’d have to fix those timing issues. That’s out of the scope of this blog, though 🙂

So there you have it. You really can bodge HDMI/DVI-D output directly through a Pmod!

Thanks for reading. Let me know what you think on twitter @domipheus.

Pi On The Wall – wall mounted home server – Part 4: Putting it together

This is part 4 of the Pi On The Wall build log, concerning modifications to the enclosure and how everything comes together into its final form factor. Part 3 was about power consumption, and optimizing it for low-power and ultimately low-temperature running. Previous parts can be found at Part 2 and Part 1.

41zJZupMBKLThe choice to use a standard (for the UK, anyway) footprint for the Pi On The Wall was made very early on. Ease of mounting to the wall (compatibility with existing wall-fixtures) and a wide range of cheap thermostats to choose from for simply utilising their outer shell.

thecaseAfter removing the guts of the £12 wall thermostat I purchased, the inside was what you’d expect – mounting posts for the PCB, guides for the LCD panel, and a PSU block behind it.

Internally, all I was planning on doing was removing as much of the PCB and LCD supports as possible – there was quite a few and they really restricted the usable space inside the case. A hobby drill and knife were enough to completely re-engineer the inside to suit my needs for maximum possible space (whilst still keeping some of the LCD guides, for the new panel). The following image shows the sort of supports that existed.

front_rear_unmodified On the rear panel, I removed the PSU block and smoothed the pcb supports whilst removing a notch for the flush USB connector.

case_modificationThe front panel ended up looking as follows after installation of the front TFT, after many hours of making sure it was perfectly straight, and holding it down with glue.

front_screen_buttonguidesNote the hole bottom right, for the PIR sensor/lens. It was countersunk to make it ‘neat’ and I messed it up. Which it why there is now a grommet on the opposite side, as the hole is too large for the sensor.

Also of note are the red straw tubes hot-glued into locations around the buttons. The straws are actually cut from the one provided with a can of WD-40, as I didn’t have anything else the correct size. The reason for these straws are made clear with the next image.

button_pcb_guidesThey form the guide for the small off-cut of PCB from the original thermostat which housed the tactile switches for the front buttons. The top one is flush with the PiTFT circuit board giving it a good fit.

frontpcb_wiringThe traces on that board were cut and the switches were directly connected to the 4 GPIO buttons on the PiTFT. There is not much else on this half of the enclosure, the main components (minus the actual panel itself) are laid out below.

raw_front_pcbsThe PIR motion sensor module was rather annoying in that it took 5v input and provided a 4.4v logic level signal when movement was detected. This is voltage divided through to 3v3 for a Pi GPIO input and is designed to switch on the back light of the PiTFT when movement is detected in front of the unit and works well. You can see some foam underneath the tactile switches, there is some on the other side as well when the case is fully closed to keep the pressure correct for the panel buttons. The PIR unit itself was deconstructed for ease of positioning the components, with 0.2mm enamelled wire being used to connect the sensor to the control board, as normal wire was too thick to also allow for the USB connector to fit snug above it.

heatsink_clampSomething I failed to write up well was the heatsink I designed for the Pi On The Wall. It needed to be incredibly low-profile due to the fact the PiTFT board was only 4mm above the Broadcom SoC. Using some very thin metal I cut out a strip which I moulded into a clip-like shape, which would clip either side of the PCB and provide some feedback into the top of the SoC whilst giving enough clearance to other components on the board.

heatsink_sinkAfter that some copper wire was soldered to the metal and arranged so the top of the SoC conducted thermally with the copper, with the help of some paste. The wires were routed to what would be the top side of the board, where the case has ventilation holes. I cut a small aluminium heatsink into two strips and then soldered the wire to those sinks, very poorly. Aluminium does not solder well and I only managed a very weak bond using the oil+scrape method. Soldering a heatsink really is as stupid as it sounds.

Amazingly, however, the heatsink works. It averaged 2 degrees Celsius of a saving over a days worth of burn-in testing. On a very hot day (for UK standards) the SoC was reporting after several hours of burn in that it was 42 degrees Celsius. This was using the ondemand governor with a 350-500MHz working range. I actually don’t think underclocking from 700 to 500 made a massive difference, but I’ve kept it at that value.

BujMHAACcAE0g93The last item is the power supply block. The AC-DC adaptor I choose fit nicely into the case and had enough room to fit the MP2307 5v->3v3 converter, as well as some required capacitors. The capacitors I eventually settled on are different from part 3, as I went from a phone charger 5v rail to this and it had different characteristics. A switch is included to hard-restart the Pi when required. 200uF is provided on the 5v rail mainly to allow for USB hot plugging, which the Pi is spectacularly terrible at.

power_sch_latest powerpsu_cableFinally, I made a video which goes into further detail about how the components all fit together. This was released a few weeks ago, but compliments this part of the build log well, so it is below.

The last part will be on the software running on the PiOnTheWall. Thanks very much for reading, I hope it was interesting!

As always, you can reach me on twitter @domipheus.