480-503-4295

Working with the E43RB1-FW405-C MIPI Display (Part 3)

Application Note 4223

This series of application notes will discuss the hardware and software requirements of driving the E43RB1-FW405-C MIPI DSI TFT Display with an STM32H747I-DISCO microcontroller board from ST Microelectronics. Driving a MIPI DSI display with a microcontroller presents a few challenges. The STM32H747 has the required bandwidth and I/O pins but lacks enough internal SRAM for a full frame buffer. The DISCO board presented has an external SDRAM chip used for implementing the display frame buffer.

Previously, Part 1 (FAN4221) walked through the hardware requirements and interfacing the display while Part 2 (FAN4222) presented an overview of the firmware. Part 3 (FAN4223) will discuss the firmware modifications required for using a different Focus LCDs MIPI display, the E50RA-I-MW490-C.  

Figure 1: E43RB1-FW405-C, Adapter PCB, and STM32H7 Disco Running Demo

Introduction

This is the continuation of the application note series started in FAN4221 where the hardware aspects of this project were discussed. Part 2 focused on the demonstration application, project structure, and firmware overview. Part 3, presented here, will show how to modify the code to suit the Focus LCDs E50RA-I-MW490-C TFT MIPI Display.

It is expected that the E50RA-I-MW490-C will be connected to the Adapter Board and plugged into the STM32H747I-DISCO Development Board. Contact Focus LCDs for more information on the Adapter Board and firmware.

E50RA-I-MW490-C TFT MIPI Display

The E50RA-I-MW490-C display used in this application is a 5.0” TFT with a 480 x 854 RGB pixel resolution from Focus LCDs. This display is interfaced over a 2-lane MIPI DSI protocol with a 20-pin FPC cable. The display is connected to an adapter board and to the STM32H7I Discovery development board.

Figure 2: E50RA-I-MW490-C TFT MIPI Display

The main features of the E50RA-I-MW490-C are:

  • 5.0-inch diagonal display, 480 x 854 RGB pixel resolution
  • Up to 65K/262K/16.7M (24-bit) colors
  • 2-Lane MIPI DSI interface with 20-pin FPC cable
  • Transmissive/Normally Black display mode
  • White LED Backlight
  • ILI9806E Display Controller
  • Capacitive Touch Interface (GT911) – Touch Modes: 5-Point and Gestures
  • Typical Operating Voltage 3.3V

Adapting the Firmware for the E50RA-I-MW490-C

Adapting the E43RB1-FW405-C firmware for the E50RA-I-MW490-C display will be presented. This guide will go through the necessary steps of the configuration for the E50RA display. Changes to the code will be shown in the STM32CubeIDE and in a plain text editor.

These are the basic steps to adapting the firmware:

  1. Copy the existing .c and .h files and change the names of the display specific files to the new display name.
  2. Edit the header file #ifndef to match the new file name.
  3. Edit the .c file with the new header file name.
  4. Check the LCD controller chip and adjust the .c files as necessary.
  5. Continue to edit the .c file with the new display parameters.
  6. Make the initialization sequence changes of the .c file in runInitSeqLCDConfig() function.
  7. Configure the Makefile by adding the .c file to the sources section.

These steps will be discussed in the following sections.

Configure the Header File and Names

Using the e43rb1_fw405_c.h and .c files, copy them into the project and change their names to the new display part number. In this example, e43rb1_fw405_c.h would be changed to e50ra_i_mw490_c.h. Once they are copied and the names changed an adjustment in the header file is required.

In the header file, change the #ifndef __E43RB1_FW405_C_H__ to match the new header file name. See the image below.

Figure 3: Header File Changes

Editing the Source File

First, looking at the datasheet for the E50RA-I-MW490-C, the TFT controller chip needs to be identified. In this case the controller chip is the same as the E43RB1-FW405-C, the ILI9806E. If the controller chip was different, more changes to the source code would be necessary.

Figure 4: E50RA-I-MW490-C TFT Controller

Include File Change

In the source file, the #include directive must be changed to the e50ra_i_mw490_c.h header file. After the include, there are definitions for the for the controller chip Page access. Since the controllers are the same between both displays these do not have to be changed.

Figure 5: Includes and Page Variables

Initial Parameter Configuration

The parameters of the TFT LCD will be set and initialized in the void initLCDConfig(LCDConfig *lcdconfig) function. This function is found in the e50ra_i_mw490_c.c file. The argument lcdconfig is a structure containing all the essential information required by the DSI controller to configure the MIPI DSI interface. This will have all the parameters to set up the display, as an example it contains the horizontal and vertical back porch timings.

Figure 6: Display Configuration Parameters

Video or Command Mode and Additional Configuration

Identifying whether the display operates in MIPI video or command mode can be verified by reviewing the controller datasheet for GRAM. If the controller has GRAM, it can operate in command mode but if there is no GRAM it must operate in video mode. Reviewing the ILI9806E datasheet shows that it has no internal GRAM and operates in video mode. In the source file the mode is set to DSI_VIDEO_MODE and does not need to be changed as both displays use the same controller.

Figure 7: Set the Mode to Video

Looking at the datasheet, the display resolution is 480 x 854. Modify the configuration height and width:

Figure 8: Height and Width Configuration

The next set of parameters to consider are the display timings. These can sometimes be found in the display datasheet or from the comments section of the display initialization file. Both can be found on the Focus LCDs website or are available upon request.

Figure 9: Display Initialization Timings

Due to slight variations in timing, some parameters need to be adjusted to ensure proper functioning of the display. Shown below the display initialization file calls for the HFP (horizontal front porch) to be 18, but through testing it was found that 20 displayed the image properly.

Figure 10: LCDConfig Timings

Configuring the Initialization Sequence

Having adjusted the timings for the display, the initialization sequence will be modified for the new display. In the previous section, the display timings were retrieved from the display initialization file. The display initialization is included in that file.

Figure 11: Initialization Sequence

In the figure above, there are two types of data writes, a long and short. The write_command(0xFF) is the address of the register where the data will be written, in this instance the 0xFF register. The write_data() is the data that will be written to the register. This command takes 5 parameters and requires the use of a long write function.

The short write function is used when there is only 1 data parameter.

There is also a write command function that has no corresponding write data function. In these instances, a short write function is used and 0x00 is placed in the data parameter argument.

Edit the void runInitSeqLCDConfig(LCDConfig *lcdconfig) function for the new initialization sequence. This is required for all the write commands in the display initialization file. Shown below is a section of the modified runInitSeqLCDConfig() function.

Figure 12: LCD Configuration Sequence

In the figure above, the longWriteDSI() and shortWriteDSI() functions are used to send commands to the display. Looking back at Figure 14, there are 5 parameters to the page change command. In Figure 15, the long write is the DSI version of the page change command. The last parameter, Page1, is the array from Figure 8 which stores the 5 parameters.

Following the long write, the short write for setting the resolution takes the command 0x30 and the data parameter 0x01. This sets the resolution to 480 x 854.

Checking the LCD controller datasheet can confirm that writing 0x01 to register 0x30 will set the resolution to 480 x 854. The controller datasheets can be found on Focus LCDs website. The specific ILI9806E datasheet can be found here.

Figure 13: Resolution Control

Modify the Makefile

The final step in the process is to modify the Makefile with the new display source file. In the original Makefile, under SRCS, the e43rb1_fw405_c.c file was listed.

Figure 14: E43RB1 Makefile

The source file must be replaced with the new source file e50ra_i_mw490_c.c for the code to compile correctly.

Figure 15: E50RA Makefile

Once all the changes have been made to the various headers, source, and Makefiles the demo will build and can be downloaded into the STM32H7 Discovery board with the appropriate display attached.

Figure 16: E50RA-I-MW490-C Running Demo Firmware

Summary

In Part 1, the hardware requirements for a MIPI display demo were presented. How to assemble the hardware was shown. Finally, a brief overview of the MIPI DSI interface and the STM32 DSI Host peripheral were discussed.

In Part 2 presented here, the development tools and frame buffer consideration were briefly discussed. The demonstration firmware operation was mentioned along with the touch interface. The following sections went through the operation of modifying the firmware for the E50RA-I-MW490-C display. Through the modification of the firmware, the structure and basic layout of the code is shown.

LCD Handling Precautions

  • Do not store the TFT-LCD module in direct sunlight, best stored in a dark place.
  • Do not leave it exposed to high temperature and high humidity for a long period of time.
  • Recommended temperature range is 0 to 35 °C, relative humidity should be less than 70%.
  • Stored modules away from condensation as formation of dewdrops may cause an abnormal operation or failure of the module.
  • Protect the module from static discharge.
  • Do not press or scratch the surface and protect it from physical shock or any force.

Disclaimer

Buyers and others who are developing systems that incorporate FocusLCDs products (collectively, “Designers”) understand and agree that Designers remain responsible for using their independent analysis, evaluation, and judgment in designing their applications and that Designers have full and exclusive responsibility to assure the safety of Designers’ applications and compliance of their applications (and of all FocusLCDs products used in or for Designers’ applications) with all applicable regulations, laws, and other applicable requirements.

Designer represents that, with respect to their applications, Designer has all the necessary expertise to create and implement safeguards that:

(1) anticipate dangerous consequences of failures

(2) monitor failures and their consequences, and

(3) lessen the likelihood of failures that might cause harm and take appropriate actions.

The designer agrees that prior to using or distributing any applications that include FocusLCDs products, the Designer will thoroughly test such applications and the functionality of such FocusLCDs products as used in such applications.