![]() |
An early VGA experiment using the FPGA "ZPUino" soft core |
Last week I wrote about some ideas to use colour to enhance the coding experience. This week I round-up some of the hardware that makes colourful graphics possible on low resource systems.
The 32-Bit Mass Migration
The hobbyist market is moving towards more sophisticated microcontrollers, and I guess that within a couple of years we shall all programming 32 bit ARM devices.
These will be literally "as cheap as chips", and it will be the 25 year old, 8-bit processors (PICS AVRs, 8051) , manufactured in rapidly becoming obsolete process geometries that become disproportionately expensive - as we rush to geometries around the 10nm mark.
Atmel have tried to counter this 8-bit stagnation, by releasing some new AVR parts, that are made in a 130nm CMOS process but the writing appears to be on the wall for the humble 8-bit parts. STMicroelectronics are making some of their older processes available to Universities for custom chip design - for about $2400/mm2.
Atmel have recently launched a range of 300MHz Cortex M7 processors using a 65nm process. These will eventually migrate to a 40nm process, and have clock frequencies of around 400MHz. ST Microelectronics have also indicated that they are pushing their M7 processors to 400MHz.
Whilst single board computers, such as BeagleBone and Raspberry Pi are now offering multi-core 1GHz processors, these devices are generally intended to work with the Linux O/S., and have achieved large sales success - it's is the basic 32-bit microcontroller, programmed in bare metal C (without operating system framework) that is rapidly playing catch-up.
Within a year or so, 400MHz, 32bit ARM processors will be available on boards - designed for ease of use to the hobbyist and hacker community. With a vast array of on-chip peripherals, these devices will find their way into flight controllers, software defined radios, games consoles, robotics and anywhere the microcontroller has to perform cycle-accurate real-time control.
Video for All
The one key factor that fuelled the microcomputer revolution 35 years ago has to be colour graphics on high street affordable PCs. Few perhaps remember when the only interaction with a computer was via a monochrome serial terminal. The use of colour, brings all levels of computing alive - even for the most basic of microcontroller projects, where a touch screen LCD is now a realistic practicality.
Traditionally, embedded microcontrollers have had fairly minimal user interfaces - perhaps a character LCD and a few switch button inputs. In reality, a lot of embedded projects have user interfaces that have not progressed much beyond the 1970's calculator era.
This is perhaps not for the want of processing power, as microcontrollers now have clock frequencies in the hundreds of MHz, and sufficient RAM to support a modest graphics buffer. The fact is, that until recently, displays have been an expensive luxury, and product designers have at best, been conservative in their designs - in order to keep overall costs down.
There is now, however, no real need for this frugality, as the price of colour TFT displays has plummeted in recent years as a result of the SmartPhone and Tablet revolution. The displays used in last year's smartphone are now available very cheaply - virtually dumped on the market, when the SmartPhone Circus moves on to it's next destination.
This is good news for the hobbyist, as there are now a whole bunch of very cheap LCDs and OLEDs available - starting at a couple of dollars. The open source community has stepped up and produced drivers for these displays - making the whole business of adding a colour LCD or OLED to your project a whole lot simpler and cheaper.
RGB Video Hardware
From a hardware point of view, generating colour video is really not very difficult - especially when some of the newer ARM Cortex M processors have on-chip LCD controllers that do all the hard work of getting the pixels out of RAM, and sending them to the screen with the right timing and in the right order.
By offloading the graphics generation to a secondary IC, it can free up a lot of resources from the main processor - allowing stunning graphical performance from what perhaps is a fairly modest processor.
For the hobbyist wanting to experiment with DIY graphics hardware - there are currently 3 or 4 options of interest. I am currently evaluating 1-3 below - and have hardware on order to allow me to investigate 4 below.
1. STM32 Cortex M4 and Cortex M7 - some parts have on chip LCD controller.
2. FPGA - use a soft core processor like the ZPUino - which is connected to an 800x600 VGA engine
3. FTDI81x - an embedded video engine IC - known affectionately as EVE for about £5
4. Raspberry Pi class SBCs normally have VGA, composite or HDMI graphics on board
Getting a VGA Output
I have now reached the age where I rely on reading glasses to read small text - and so to read a text from a SmartPhone LCD is a case of reaching for my reading glasses every time. Large, flat screen monitors - perhaps of 24" or 27" diagonal are now available cheaply - and so this would be my preferred choice of viewing any graphical output. On a 27" diagonal screen - a single 800 x 600 pixel is about 0.75mm square.
Most flat screen monitors will accept an analogue VGA input, with a range of resolutions handled by the multi-sync display.
The VGA signals consist of a Red, Green and Blue analogue voltage, accompanied by horizontal and vertical synchronisation signals on 2 separate pins. These signals are relatively easy to create from either a FPGA or an LCD controller - just with some simple resistor networks to reconstruct the analogue voltage from the parallel RBG digital outputs.
By offloading the graphics generation to specialist hardware means that even a low resource microcontroller can have great looking graphics. Indeed there has been much interest in recent years in recreating some of the classic home-computers from the 1980s using FPGA technology. The original Gameduino (2011) - an add on video shield for the Arduino to allow 8 bit arcade games to be played, ran a VGA video engine inside a FPGA.
GameDuino 2 - uses an embedded video engine - or EVE device from FTDI to create the graphics - and displays them on a 4.3" LCD.
The EVE device has been enhanced (EVE2) - and will now support up to 800 x 600 displays. It is likely that a number of products based on EVE 2 will appear in the near future.
Since the Spring I have been using the ZPUino soft core processor running on an FPGA to generate VGA graphics. My platform of choice is the Gadget Factory, Papillio Duo - an FPGA board based on the Xilinx Spartan 6 FPGA coupled to a fast 2MB SRAM. When fitted with a "Computing Shield" which provides VGA connector and PS/2 connectors for keyboard and mouse it makes a compact platform. This combination allows up to 800 x 600 VGA - and it is quick and easy to programme in "Arduino" C++ using the Adafruit GFX Graphics library.
The ability to write coloured text, individual pixels or graphics easily to anywhere on a screen from within an Arduino sketch - makes the whole experience very rewarding. The ZPUino core can readily animate the graphics with simple code.
The final method I touched on to generate video is to use the On-Chip graphics engine. Some of the STM32F4xx Cortex M4 and STM32F7xx Cortex M7 microcontrollers have this as an on-chip peripheral. It can produce stunning graphics, but will take a lot of C programming, and will consume a fair percentage of the processors throughput to produce a good display.