Writing to a TFT screen with ZPUFlex

A few months ago I bought a cheap 2.2 inch TFT screen on EBay but never managed to find the time to get it working, so today I dusted it off, and hooked it up to a nice little Cyclone IV dev board I bought some months previously.


This board doesn’t have a VGA port, and the FPGA is only 6000 LEs but it’s cheap and does have a 40-pin GPIO header and onboard SDRAM, so it’s quite a good board for ZPU-based projects.

Since this project is even more experimental than usual, and is likely to be restricted to the one board, I’ve started a new branch in the ZPUDemos repo, called “TFT”.

The TFT screen has an ILI9341 driver chip which is controlled via something that looks a lot like SPI – there is however one extra control line – D_C which is used to inform the display whether the byte being transferred over SPI is a command or data byte.  I found some driver code for this chip in a PSOC4 project, and adapted it for use with the ZPU.

So far the demo project creates a 320×240 pixel 16-bit framebuffer, and repeatedly copies its contents to the display, updating the framebuffer each time.  This is extremely slow – so my next project will be to bring the framebuffer update under DMA control.

Leave a Reply

Your email address will not be published. Required fields are marked *