Projects

DIY hand-held games console: Screen Driver

Last updated: July 13, 2022, 10:40 p.m.

Now that the toolchain and the basics are working, the next thing to do is to start getting some of the peripherals working. I like to do this one at a time and it's usually best to start with the outputs first, that way you can use the outputs to test whether the inputs are working. We've proven the basic UART comms already, so the next big output device is the screen. The screen I've got came from eBay but appears to match up with this entry on LCD Wiki.

As well as a helpful set of pinouts and general specifications the LCD wiki site has a datasheet and a "Program Download" link. The link gives a zip file full of code and examples for a wide range of demo code including some for an STM32F429 which is what I'm using. The code isn't for Make/GCC, it looks like it's for Keil so the project is no use but the actual source code should be portable (it's all standard C after all). I spent an hour or so dragging bits of the code into my existing CubeMX project in VSCode and poking bits around. There were some character encoding issues I couldn't get past with the font, it seems to be using a multi-byte encoding for some simplified Chinese characters but it's not Unicode and I couldn't get it to compile. There are also some oddities in type naming, it seems to define its own (or maybe Keil does) integer types instead of using stdint.h but a find-and-replace fixed those. It's also been built on a system which has a case insensitive file-system and some of the include statements were broken.

After a bit of poking around at compiler errors and one further issue where the SPI config from the library was arguing with the SPI config from CubeMX I got it working and so on the screen are some coloured squares.

A quick demo on the SPI screen.

Screen Demo: A quick demo on the SPI screen.

There's obviously a lot of work to do on this to make it useful. I want to build a frame-buffer in the SDRAM and get it DMA copying to the screen to allow better graphics and I'll need to make a font system. However the challenge with these modules is usually getting them to show something to start with so this code has got me over that hurdle.

To see the code at the end of this stage, check out this commit on GitHub.

Section:
Projects
Tags:
display,
SPI

Comments

Posting comments is not currently possible. If you want to discuss this article you can reach me on twitter or via email.


Contact

Email: nathan@nathandumont.com

Twitter: @hairymnstr