A simple game on STM32F429I Discovery board

In this past two weeks I spent some time learning how to create a simple graphic application for my STM32F429I-DISCOVERY board. Since it has a QVGA display with a ILI9341 display controller on board and a STM32F429ZI microcontroller I thought I should give it a try. I’ve been interfacing displays with SPI and 8080 parallel interfaces but since the ILI9341 offers the opportunity to drive the panel using a parallel RGB interface I felt that was the way to go. The STM32 micro has a LTDC display controller that provides all the signals needed to use the RGB interface. I wrote a post on how to configure and use it. It has its own DMA and manages to send all RGB data from a framebuffer in memory to the TFT display generating all the necessary signals to refresh correctly the LCD, leaving the CPU free to do other jobs (for example updating the back buffer). Since I wanted to animate sprites I used double buffering and a single LTDC layer so I needed some extra RAM.  Luckyly the board has a 64Mbit (8MB) external SDRAM and the micro has a Flexible Memory Controller that makes accessing the external memory a breeze. So I implemented a little graphic library with some functions to draw on the framebuffer and to swap the buffers once finished:

It initializes the ILI9341 in SPI mode and then configures the ILI9341 display controller to use the RGB interface. Then the LTDC kicks in, initializes the SDRAM controller (FMC) and sets up two frame buffers in external memory. Then I configure the LTDC, one of the layers and everything is good to go.

// to be continued

Leave a Reply

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