Most of the portable handheld terminal products now, such as mobile phones, navigation systems, etc., have a small LCD display, which makes the design of LCD drive circuit an important part of handheld terminal design.
The design of LCD driver circuit is an important part of handheld terminal products. This paper designs and implements the LCD driver circuit of handheld terminal based on S3C2440A. Taking the handheld terminal used in special industries as an example, the design and implementation method of LCD driver circuit is described.
Hardware circuit design
Hardware circuit structure
The handheld terminal CPU in this design adopts Samsung's ARM920T core processor S3C2440A, and its LCD controller supports STN LCD and TFT LCD. The actual LCD used is LTS350Q1-PE1_PI, which is a TFT LCD.
The circuit block diagram is shown in Figure 1.
The driving circuit mainly consists of three parts: the first part is LCD driving, which uses the MAX1779 chip; the second part is LED backlight driving, which uses the MP1521 chip; the third part is VCOM signal driving, which uses the LM8261 chip. Here we mainly describe the implementation of LCD driving and backlight circuits.
LCD drive circuit
Since LCD integrates digital circuits and analog circuits, it needs to provide digital voltage DVDD and analog voltage AVDD externally. In addition, in order to complete data scanning, TFT needs to be turned on/off in turn. When TFT is turned on, data is loaded to the display electrode through the source driver, and the voltage difference between the display electrode and the common electrode acts on the liquid crystal to realize display. Therefore, it is necessary to control the TFT's turn-on voltage VGH, turn-off voltage VGL, and voltage VCOM applied to the common electrode.
The MAX1779 chip can generate the analog voltage AVDD, gate turn-on voltage VGH and gate turn-off voltage VGL required by the LCD. The chip integrates three DC-DC converters, including two charge pumps and a boost converter, which can provide efficient regulated voltage for small TFT LCD screens. The LCD driver circuit is shown in Figure 2.
Here, one charge pump generates a positive voltage as the TFT's turn-on voltage VGH; the other charge pump generates a negative voltage as the TFT's turn-off voltage VGL. In addition, the chip can also generate a -5V voltage output, which is used to assist LM8261 in generating the VCOM signal.
LED backlight drive circuit
As a passive display device, LCD cannot emit light by itself and must be provided by a backlight module. White light LEDs are widely used as LCD backlight sources for embedded handheld devices due to their low complexity, low cost and small size. The backlight drive circuit in this article is shown in Figure 3.
The driver chip uses MP1521, which has three independent current feedback loops and can drive three parallel LEDs at the same time. Now short-circuit the three feedback loops FB1, FB2, and FB3 to provide a larger drive current for driving six white series LED backlights.
MP1521 supports two ways to control LED brightness, one is to connect BRT to a voltage in the range of 0.26V~1.2V, and the other is to control LED brightness through PWM signal. When designing, connect it to the PWM port and use PWM to control LCD backlight brightness.
S3C2440A has 5 16-bit timers, of which timers 0, 1, 2, and 3 have PWM functions. Connect the BRT to the TOUT0/GPB0 pin of the CPU that can output PWM signals, and use the PWM signal generated by timer 0 to control the LCD brightness. The LED brightness can be adjusted by changing the duty cycle of the PWM signal, and the PWM duty cycle can be changed by setting the value of the CPU internal register.
In order to save power consumption, the enable (EN) terminal of the circuit is connected to the LCD_PWREN pin of the CPU. When the level is high, the backlight circuit works; when the level is low, the backlight circuit does not work. At the same time, the EN terminal can be directly connected to the 3.3V power supply through a resistor for debugging.
LCD_BCK+ and LCD_BCK- are connected to the positive and negative ends of the series LEDs respectively. Software Design
The kernel version used by the embedded Linux of the handheld terminal is kernel-2.4.18. In order for the LCD to display normally, it is also necessary to develop the LCD driver under the Linux system.
Character device drivers
Character devices are the simplest devices in the Linux system and can be accessed like files. When a character device is initialized, its driver registers with the Linux kernel and adds a device_struct data structure entry to the chrdevs vector table. The major device identifier of this device is used as an index into this vector table. The major device identifier of a device is fixed. The device_struct data structure in the chrdevs vector table includes a pointer to the name of the registered device driver and a pointer to a set of file operations. This set of file operations itself is located in the character device driver of this device and handles some specific tasks.
Frame buffer devices under Linux
The Linux operating system provides a frame buffer for display devices such as LCDs. The frame buffer is an interface provided by Linux for display devices. It is a device that abstracts the video memory. The essence of writing a driver for an LCD is to write a driver for the frame buffer.
Since the implementation of the frame buffer driver has been described in detail in many papers, it will not be repeated here. This article focuses on the implementation of the backlight device driver.
LCD backlight device driver
LCD backlight device can be regarded as character device, and can be implemented according to the writing method of character device driver. Various LCD control functions are implemented in the driver. The driver mainly includes lcdctrl.c and lcdctrl_smdk2440.c. Among them, lcdctrl.c shields the specific hardware, and it calls the related functions of lcdctrl_smdk2440.c through the hook function to complete various specific operations. In order to vividly illustrate the relationship between the two files, here we take the LCD brightness adjustment process as an example to illustrate the function calling process, as shown in Figure 4.
The lcdctrl_ioctl function in lcdctrl.c needs to implement different functions according to different parameters of the upper-level application. These LCD control functions include brightness adjustment, contrast adjustment, LCD off, LCD on, etc.
The implementation of the two files is described below.
lcdctrl.c file
1. Define the file_operation structure
static struct file_operations lcdctrl_fops = {
ioctl: lcdctrl_ioctl,
open: lcdctrl_open,
release: lcdctrl_close };
Various control functions of the LCD are implemented in the lcdctrl_ioctl function. lcdctrl_open and lcdctrl_close do not implement specific functions and directly return a value of 0.
2. lcdctrl_ioctl function
The lcdctrl_ioctl function needs to implement different functions according to different parameters of the upper-layer application. Here we mainly explain the implementation of the brightness adjustment function. Part of the code is as follows:
static int lcdctrl_ioctl(struct inode * inode, struct file *filp, unsigned int cmd , unsigned long arg)
{……
switch(cmd)
{ ……
case
_LCDCTRL_IOCTL_BRIGHTNESS:
if ((arg >=0) && (arg <= 100))
ret = lcdctrl_set_brightness(arg);
break; //Adjust LCD backlight brightness
……
break;}
return right;}
When the command parameter passed by the application is LCDCTRL_IOCTL_BRIGHTNESS, lcdctrl_ioctl calls lcdctrl_set_ brightness to implement the brightness adjustment function.
3. lcdctrl_set_brightness function
lcdctrl_set_brightness specifically implements the brightness adjustment function. The main code is as follows:
int lcdctrl_set_brightness(int b)
{
brightness = b;
return lcd_device->set_brightness(b);
}
It can be seen that this function calls the lcd_ device->set_brightness function, and lcd_device has been pointed to a function related to specific hardware during initialization.
4. Initialization function
The initialization function mainly completes the setting of initial information and registration of equipment.
lcdctrl.c_smdk2440 file
1. lcdctrl_device structure
The lcdctrl_device structure defines the function pointers for specific LCD operations, including LCD initialization function, LCD on and off function, brightness, contrast setting function, etc. The essence of the LCD off function is to set the LCD backlight brightness to 0.
static struct lcdctrl_device smdk2440_dev = {
heat: smdk2440_lcdctrl_heat,
enable: smdk2440_lcdctrl_enable,
disable: smdk2440_lcdctrl_disable,
set_intensity: smdk2440_lcdctrl_set_intensity,
set_brightness: smdk2440_lcdctrl_set_brightness,
set_contrast: smdk2440_lcdctrl_set_contrast};
2. smdk2440_lcdctrl_set_brightnes function
Only the implementation of the brightness setting function is described here.
static int smdk2440_lcdctrl_set_brightness( int b)
{ ……
TCNTB0 = 100;
TCMPB0 = b*100/100;
//Set the value of TCMPB0 register
TCON = (TCON & ~(0xf)) | ( TCON_0_AUTO | TCON_0_MAN | COUNT_0_OFF);
TCON = (TCON & ~(0xf)) | 0;
TCON=(TCON & ~(0xf)) | (TCON_0_AUTO | COUNT_0_ON);}
Most of the statements in the function are to write values to registers related to the timer. Among them, b is the bright value passed down by the upper function. From the program, we can see that adjusting the brightness is essentially to write the value related to bright through the TCMPB0 register to control the PWM duty cycle to achieve the brightness adjustment function.
3. lcdctrl_device_get_ops function
It is used by the upper layer to obtain the hook function of the specific device. The code is as follows:
struct lcdctrl_device *lcdctrl_device_get_ops(void)
{return &smdk2440_dev;}
This function is called when lcdctrl.c is initialized to point the device to smdk2440_dev.
At this point, the driver design is completed. In order to better manage the LCD, a human-computer operation interface needs to be provided in the upper-level Qtopia application.
Qtopia Applications
The Qtopia application provides a human-machine interface and calls the underlying driver to complete the LCD control function. Here, the working process of the application is still described using brightness adjustment as an example.
Main completed functions:
1. The application completes the human-machine operation interface and provides a friendly interface for users;
2. Read the brightness value and store it in the variable bright;
3. Open the device file: fd=open("/dev/devname",O_RDONLY);
4. Call the underlying driver and adjust the LCD backlight brightness to the specified value through the underlying driver.
ioctl(fd, _BACKLIGHT_ IOCTL_BRIGHT, bright)。
The ioctl function calls the driver to complete the brightness adjustment.
Conclusion
After testing, the designed LCD can display graphics well, and the terminal power management interface includes the LCD brightness adjustment function. The graphical management interface can conveniently manage the LCD to save energy and extend the working time of the handheld terminal.
Previous article:Simplified drive circuit for single positive gate drive IGBT
Next article:Mains powered LED driver
Recommended ReadingLatest update time:2024-11-16 19:49
- Popular Resources
- Popular amplifiers
- Siemens Motion Control Technology and Engineering Applications (Tongxue, edited by Wu Xiaojun)
- Modern Product Design Guide
- Modern arc welding power supply and its control
- Small AC Servo Motor Control Circuit Design (by Masaru Ishijima; translated by Xue Liang and Zhu Jianjun, by Masaru Ishijima, Xue Liang, and Zhu Jianjun)
- MathWorks and NXP Collaborate to Launch Model-Based Design Toolbox for Battery Management Systems
- STMicroelectronics' advanced galvanically isolated gate driver STGAP3S provides flexible protection for IGBTs and SiC MOSFETs
- New diaphragm-free solid-state lithium battery technology is launched: the distance between the positive and negative electrodes is less than 0.000001 meters
- [“Source” Observe the Autumn Series] Application and testing of the next generation of semiconductor gallium oxide device photodetectors
- 采用自主设计封装,绝缘电阻显著提高!ROHM开发出更高电压xEV系统的SiC肖特基势垒二极管
- Will GaN replace SiC? PI's disruptive 1700V InnoMux2 is here to demonstrate
- From Isolation to the Third and a Half Generation: Understanding Naxinwei's Gate Driver IC in One Article
- The appeal of 48 V technology: importance, benefits and key factors in system-level applications
- Important breakthrough in recycling of used lithium-ion batteries
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- 【Laser target detector】Belated unboxing, RPI400 unit only
- Getting Started Using TouchGFX to Develop STM32 Interface Applications (Part 1) - Software Installation and Hello World
- psoc creator soft imitation function
- Developer Case: Design of Smart Agriculture Based on Gizwits IoT and RT-Thread
- Basic Theory of System Timing
- GD32L233C-START evaluation development environment construction and official DEMO download test
- Several technical principles of unlocking shared bicycles with mobile phones,,,
- 【GD32E503 Review】——04.MCU CoreMark Performance Test
- [RTT & Renesas high performance CPK-RA6M4] 3. PWM to achieve breathing light evaluation
- Comparison of IIC data and logic diagram between the reference prototype and your own product