FPGA to control the lcd This project allows you to drive an lcd display without driver, with any FPGA. I'm using Tang nano 1k FPGA and 525x286 tft lcd for this project.
- Check whether your FPGA have FPC connector provision. In Tang nano 1k, a 40pin FPC connecter is available. Else you need to have a breakout board with FPC connector.
- Choose the lcd wisely. LCD pins must have same number of pins as that of the FPC. In LCD flex cable and FPGA FPC, first pin mentioned as '1'. Proper connection is important.
- Mostly the lcds are made for RGB888 protocol which is 8 bits per each color. RGB888 allows mode color spectrum but requires more resources of FPGA. Tang nano 1k allows RGB585.
- FPGA : Tang nano 1k(1152LUT)
- Display : TFT 525x286 pixels(480x272 active pixels) RGB565 Color depth
- Clock : 27Mhz(FPGA),9Mhz (Display)
- Disply refreshrate : 60Hz
- Active Display : 480(Horizontal pixels) ,272(Vertical lines) ,
- Front Porch : 2(For Hsync and Vsync),
- Sync Pulse : 41(Hsync),10(Vsync),
- Back Porch : 2(For Hsync and Vsync),
- Total Frame : 525(Horizontal pixels), 286(Vertical lines)
One pixel contains 3 leds(Red,Green,Blue). Each led takes 8 bits of data. In RGB565, R and B takes 5 MSB out of 8 bits while G take 6 MSB out of 8 bits. Rest are assumed 0 bits. There are total 286 vertical lines in which each vertical line have 525 pixels. For each pixel, one complete display clock is needed. One vsync stands for completeion of 286 lines while one hsync stands for 525 pixels. So in one frame vsync cycles only once and hsync cycles for 286 times. Literally there are 525x286 pixels in one frame. But we cant use all those pixels. Instead we are allowed to use only 480x272 pixels for each frame by avoiding front porch, back porch and pulse width. These are called blanking area where nothing is displayed.
- src/ : Source files
- cst/ : Constraints file
- docs/ : Required documents
- Clone the repo https://github.com/VSSR-01/fpga_lcd_driver.git
- Open GowinEDA tool a. Create project for your FPGA b. Copy source files to src folder in your project folder c. Copy constraints (.cst) to the constraints folder
- Synthesize, Place and route and program the .fs file into the FPGA.
- Gowin EDA(You can use OSS CAD SUITE also)
- Icarus Verilog compiler for simulation
- gtkwave for visualising the signal waveform
Any FPGA can be used for this purpose as long as there are sufficient LUTS and pins available. Proprietary EDA tools and open source tools are available for most FPGAs. FPGAs have pLL IPs available to create specific frequency than the available board frequency. It is better to use IPs instead of creating a clock divider from the available clock.