stm32f4 tft lcd example brands
The LCD I am using is a 2.8″ TFT LCD with SPI communication. I also have another 16-bit Parallel TFT LCD but it will be another story for another time. For this post, let’s focus on how to display what you want on the 2.8″ LCD. You can find all details about this LCD from this page:http://www.lcdwiki.com/2.8inch_SPI_Module_ILI9341_SKU:MSP2807
First thing first, this LCD use SPI as the main communication protocol with your MCU. For STM32 users, HAL Library has already implemented this protocol which makes this project easier for us. But, a little knowledge about this protocol does not hurt anyone. SPI is short for Serial Peripheral Interface which, aside from two data lines, also has a clock line and select lines to choose between devices you want to communicate with.
This LCD uses ILI9341 as a single-chip SOC driver for a display with a resolution of 240×320. More details can be found in the official document of ILI9341. But the most important thing is that we have to establish astart sequencein order for this LCD to work. The “start sequence” includes many other sequences which are also defined in the datasheet. Each sequence starts when you send a command to ILI9341 and then some parameters to follow up. This sequence is applied for all communication between MCU and ILI9341.
For this project, I recommend using theSystem Workbench for STM32for coding and building the code. After installing and open the program, go to the source code you have just downloaded and double click the.cprojectfile. It will automatically be open in your IDE. Then build the program by right click on the folder you just open (TFTLCD) and chooseBuild Project. Wait for it to finish and upload it to the board by right clicking the folder, choose Run As and then clickAc6 STM32C/C++ Application. And that’s it for running the example.
The most important library for this project is obviously the ILI9341_Driver. This driver is built from the provided source code in the lcdwiki.com page. I only choose the part that we need to use the most in many applications like writing string, displaying image and drawing symbols. Another library from the wiki page is the TOUCH library. Most of the libraries I got from the Internet were not working properly due to some adjustments to the original one.
To draw symbols or even display images, we need a “byte array” of that image or symbol. As an illustration, to display an image from a game called Transistor, I have a “byte array” of that image stored in a file named transistor.h. You can find this file in the link below. Then, I draw each pixel from the image to the LCD by adding the code in the Display_Picture() function in the Display folder.void Display_Picture()
The above example is just only for displaying black and white image. In order to show a color image, we need to a little bit different. First, go tothis websiteto generate the array of the colour image. Remember to change your size to 320×240 and choose the 65K color option. Because it now takes up two bytes for one pixel, we need to send two bytes at once. You can check the Display_Color_Picture() function in the Display folder.void Display_Color_Picture()
My question is why they have to access two areas of the FSMC SRAM bank instead of one. Basically why can"t I just send data to the LCD by writing only to LCD_REG (the start of the memory bank)?
The STM32F429 Discovery helps you to discover the high-performance microcontrollers of the STM32 F4 series and to develop your applications easily. It offers everything required for beginners and experienced users to get started quickly.
Based on the STM32F429ZIT6, it includes an ST-LINK/V2 embedded debug tool, a 2.4" QVGA TFT LCD, an external SDRAM of 64 Mbits, a gyroscope ST MEMs, a USB OTG micro-AB connector, LEDs and pushbuttons.
A large number of free ready-to-run application firmware examples are available on www.st.com/stm32f4-discovery to support quick evaluation and development.
STM32F429 has also LTDC driver for LCD like that, but this driver we will use later. For now we will use SPI for driving in serial mode and some other pins for controlling.
Remember: This library can also be used, if you are not using STM32F429 Discovery. It can be used in previous STM32F4 Discovery board. All pins can be changed in defines.h file which is included in project.
The STM32F429 Discovery helps you to discover the high-performance microcontrollers of the STM32 F4 series and to develop your applications easily. It offers everything required for beginners and experienced users to get started quickly.
Based on the STM32F429ZIT6, it includes an ST-LINK/V2 embedded debug tool, a 2.4" QVGA TFT LCD, an external SDRAM of 64 Mbits, a gyroscope ST MEMs, a USB OTG micro-AB connector, LEDs and pushbuttons.
A large number of free ready-to-run application firmware examples are available on www.st.com/stm32f4-discovery to support quick evaluation and development.
TFT stands for thin-film-transistor and is a variant of LCD displays with an active matrix. LCD-TFTs are widely used in embedded products as they are available in many different resolutions, sizes, interfaces, price ranges, etc.
Some variants of TFT-LCDs are TN and IPS panels. Examples of IPS TFT-LCDs, is the STM32F769 DISCO and STM32H747 DISCO, both running a 800*480 MIPI-DSI TFT IPS LCD display.
eInk displays are low color displays, ideal for applications with low power consumption needs, wide viewing angles, and easy readability. TouchGFX Implementer SDATAWAY demonstrates an eInk display running an TouchGFX application on a STM32F412 here: https://www.touchgfx.com/cases/e-ink/
TouchGFX can use any display interface, and STM32 microcontrollers offer a wide range of display interfaces connecting to Motorola 6800, Intel 8080, SPI, RGB-TFT, and MIPI-DSI.Interface# of pinsTarget resolutionsMax bandwidthBenefitsDisadvantagesSPI4*Up to 480*27216 MHzSimple hardware interface, faster than I2C,
RGB-TFT (LTDC)8/18/24*Up to 1280*800High performance, low costHigh pin count, parallel communication can cause EMC issues, can require higher clock freq
Pixel density defines how many pixels are shown per inch or square inch. Choosing the right pixel density can depend on the expectations from the end user, environment, design needs etc. Putting this into perspective, a high-end mobile phone runs a 6.1” 2340x1080 with a pixel density per square inch of 178,500, while a commonly used 5” TFT display running 800x480 has 34.816 Pixels per square inch.
For some applications it can be difficult seeing any difference, unless the display is being looked at very closely. Examples of pixels densities are: STM32F476DISCO with 16,462 PPI2 and STM32F769DISCO with 54,400 PPI2.
The dynamic color range is the ratio between two contrasting colors, like black and white. In the example above, the blue and white contains different levels of white and blue. The image on the left has lower pixel density, and the picture on the right has more pixels to show all the colors represented, creating a smoother transition between different colors and edges.
There are different touch technologies available in the market today and some examples are: resistive, capacitive (surface, projected), SAW touch, infrared touch. This section will only address some of these technologies:
The STM32F429 Discovery kit (32F429IDISCOVERY) empowers users to quickly develop applications utilizing the STM32F429 high-performance MCUs with ARM®Cortex®-M4 core.
The kit comes with an ST-LINK/V2-B embedded debug tool, a 2.4" QVGA TFT LCD, an external 64Mbit SDRAM, an ST MEMS gyroscope, a USB OTG micro-AB connector, LEDs, and push-buttons.
Significant changes in the third edition include updated serial communication description (UART, SPI, and I2C), new serial communication examples, incorporation of GNU gcc compiler, low power modes, modification of example programs from STM32L1 (Cortex-M3) to STM32L4 (Cortex-M4).
The book also gives detailed examples of interfacing peripherals, such as general purpose I/O (GPIO), LCD driver, keypad interaction, stepper motor control, PWM output, timer input capture, DAC, ADC, real-time clock (RTC), and serial communication (USART, I2C, SPI, and USB).