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

2 Responses

  1. Jan Stöfer says:

    Hi Luca,

    thanks for your posts about STM32 LTDC/DMA2D, found them very inspiring and fun to read !

    I have started to design a display module which is nearly sw-compatible with the stm32F429I-disco but more suitable for real projects.

    Just out ofcuriosity: What about the remaining part of your “simple hame for stm32F429” – I wouldlove to see it !

    Best Regards,

    Jan Stoefer

    • Luca Davidian says:

      Hi Jan, thanks for your feedback, I really appreciate it!

      As for new posts about embedded programming I must disappoint you, because I’ve been taking to game development in C++, so that’s
      what my future posts will be about (I’ve already begun to post some articles on programming patterns and C++ features, you can find them on the blog if you’re interested).

      If you need advice or want to share some thoughts on programming feel free to contact me!

Leave a Reply

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