HDMI FPGA FeatherWing

A Lattice ECP5 FPGA with DDR3 RAM and 1080p HDMI in a Feather form factor.

Similar projects worth following
The intention of this project is to build a FeatherWing that provides graphics acceleration, allowing for a homebrew video game console with HDMI. Designed to be used with the Huzzah32 Feather, which uses the ESP32-WROOM module, but should be compatible with other Feathers too.

As a graphics accelerator, the board acts as a SPI slave. Commands are sent to the ECP5 over a standard SPI interface, and the ECP5 does all the heavy lifting. That way, your Feather can worry about game logic instead of pixels.

Exact components are still in the works, but the types of components have been "finalized". (Sortof... suggestions are welcome!)

Main Components:

-Lattice ECP5 FPGA
-HDMI capable (up to 1080p60)
-Standard (full-size) HDMI
-DDR3 memory
-QSPI flash for FPGA configuration
-MicroSD port for data storage
-JTAG port for programming/debugging

The goal is to route this on a 4-layer board with 6/6mil spacing. Some of the GPIO on the FPGA may go unused, but it's not the end of the world. 2-layer is not (likely) an option due to the impedance-controlled HDMI traces, as well as the mess of 50-ish traces between the FPGA and the DDR3 memory.

It is definitely worth noting that due to the flexible nature of the ECP5 FPGA, this board could be used for many other purposes.  The goal is to ship with an out-of-the-box configuration for creating graphics for games, but this can be updated/modified with a JTAG programmer/debugger for now. With a few tweaks, it could easily become a GUI front-end, sending an interrupt request to the host when a user interacts with the device. Or, the FPGA can be configured to perform accelerated mathematical functions for another device, allowing the primary processor to be more efficient. Maybe if I get the board right the first time, the FPGA could even be configured in-situ by an attached Feather, with OTA updating possible if Wi-Fi is available on the attached Feather (think Huzzah Feathers).

Someday this will graduate from a FeatherWing to a standalone system, similar to this FPGA dev board, yet different. It won't have any of the buttons or other modules on it, as the linked board is for educational purposes and so must include lots of stuff this system doesn't need. The vision for the future iteration of this concept will include an ESP32-WROOM module as a dedicated processor and WiFi/BLE module, USB ports for connecting wired controllers (if desired) or mouse/keyboard for config, and possibly battery management for a Li-Ion battery.

  • 1 × LFE5UM-45F-7BG381I Lattice ECP5 FPGA
  • 1 × W631GG6MB-11 TR 1Gbit (64Mx16) DDR3 SDRAM
  • 1 × MicroSD Card Holder
  • 1 × HDMI Connector (Output)

  • Prior Art (a.k.a. Open-Source Candy Shop)

    Brian Gilbert11/19/2019 at 03:30 0 comments

    A lot of PCBs out there have ESP32s and/or ECP5s that do graphics and game stuff. Since much of these projects are open-source, I hope to be able to leverage a lot of the information provided in them to speed up development.

    First, let's take a look at the ESP32. I'm definitely not the first to use the ESP32 to run classic games. First off, the emulators. The NES has been emulated many, many times on the ESP32. I'm also thinking that this may be one good demo piece for this hardware. Who wouldn't love Super Mario 3, but with the best graphics filtering imaginable so that it doesn't look blocky on a 50" 1080p television set? Sure, that pixelated image has a certian asthetic, but 5mm-square pixels are a no-go in my book.

    Emulators don't stop with the NES. The PocketSprite by [Sprite_tm] is an ESP32-based device that packs both a Game Boy emulator and a Sega Master System (Sega Genesis) emulator at the same time. Also, there has been at least one attempt at emulating the SNES, but the system didn't perform to expectations.

    Emulators are only the beginning. While not the first to do so, [Gadget Workbench] on YouTube has ported DOOM to the ESP32. He ported a number of other games as well, and documents all of them with open source code on his GitHub. He starts with a breadboard version which has a SPI LCD screen and an SD card over SPI as well, but on different SPI busses. In later iterations, he moved from his original breadboard layout to the Odroid-Go, which has LCD and SD card on the same bus. He addresses this by using a semaphore and it all works fine. These games are especially interesting because the porting wasn't overly difficult. He only had to reimplement some of the underlying graphics procedures as the games were all versions that had been ported to work with the cross-platform SDL library. That means that if I can write functions for the core functionality of the SDL library, adding games should be straightforward after that.

    At this point you might be wondering why I'm going on and on about the ESP32 when this project is about the ECP5. The reason is that I'm intending to use this HDMI FPGA FeatherWing in conjunction with the ESP32 on the Adafruit HUZZAH32 board. Turns out, I'm not the first one to think of this, although the application was a little bit different. The ULX3S is a new(-ish) open-source development board for the ECP5 which has an ESP32 on-board as a Wi-Fi/BLE bridge, and I'm excited to see where it goes. It already seems to have garnered a community of followers. Even though the ULX3S was designed for educational purposes, I will want to make sure I can make my board(s) relatively compatible with this design so that code written for the ULX3S could potentially work in my system.

    A number of other recent designs have also popped up that use the ECP5. Premiering just this past weekend, the 2019 Hackaday Superconference badge is ECP5-based, and had an HDMI connector! [Sprite_tm] gave a great talk explaining some of the specifics, and of course the GitHub page will be a great reference for this project.

    Another very recent design with an ECP5 is the Orange Crab by [Greg Davill]. It has a Feather form factor, and is also open-source.

    Long story short, there is a lot of stuff already out there, and if I don't take that into account, I would have to be a fool. So much open-source stuff is available in this domain, which should speed up development of this board considerably. I'm not always good at this open-source thing, but I'm really going to try this time to post updates as things happen. This will be especially important because I'll be using open-source stuff in this project, and so I should pay it back by sharing what I learn and discover along the way!

  • Memory Selection

    Brian Gilbert11/17/2019 at 05:09 0 comments

    I've been looking into memory options for the system. To be specific, I want some RAM for storing image data, so it needs to be fast and plentiful.

    Since I'm aiming for RGBA8888 graphics capabilities, it was logical to look for 32-bit memory. Options are limited in this space, but I found some 4Mx32 SDRAM for a reasonable price. This could hold two entire frames of 1920x1080, operates at 166MHz, and could make for a decent system. But, 32-bit architecture means 32 traces to route on my board. If I'm going to fit this on a 4-layer board, that's not going to be a trivial matter.

    Next, I looked at some of the DDR options. Speeds increase (good), and since it reads on the rising and falling edges of the clock, a 16-bit word size can still read 32-bits-per-clock-cycle. This will still let me read 32-bits-per-pixel no problem, and memory becomes cheaper in more abundance as a result. This DDR2 memory would work really well, and at clock speeds of 400 MHz, the ECP5 will have nearly-instant access to any data it needs.

    Turns out that looking at other designs, most go with DDR3 memory. At speeds of 667MHz or more, this memory certain outperforms what I need it to do, but remarkably the memory is actually cheaper in addition to being faster. As a result, I'm ultimately going to settle on something like this Winbond DDR3 chip. The faster speed might not help functionally, but it will more forgiving of slight mismatches in trace lengths when I route the PCB. As long as the clk traces are equal to or slightly longer than the rest of my traces, the address bits should all be present together at the memory IC.

    For the other designs I mentioned above, look no further than these two dev boards, one official dev board by Lattice and another unofficial dev board designed for college students. Another example that is all too similiar to this FeatherWing (but still different) is the Orange Crab board by Greg Davill. All of these include DDR3 memory, so it will be useful to keep some compatibility to make code more easily portable.

View all 2 project logs

Enjoy this project?



Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates