Today’s users expect their mobile devices to have excellent graphics capabilities but still want an acceptable battery life. Other users of displays expect low power consumption too. These criteria obviously pull in different directions, but there are low-power microcontrollers available that, if applied correctly, can go a long way to solving these problems. This article will look at three such devices, going into detail on three graphics-based applications.
The first applications will look at using an EFM32
microcontroller from Silicon Labs for driving an electronic paper display. The article will then look at two different ways of driving an LCD using a standard microcontroller. In the first of these, a PIC32
microcontroller from Microchip will form part of a circuit for developing controllerless graphical embedded applications. In the second, a standard ST62
microcontroller from STMicroelectronics will be used to drive an LCD.
Electronic paper display
The growth in e-readers has created a demand for displays that look as if they are made from paper, to create a more book-like experience for the reader. Such displays are reflective in that they rely purely on ambient light; there is no backlight. They are bistable in that they will retain an image even if the power is disconnected. As well as e-readers, they are also used in industrial signage, electronic shelf labels and other applications where the image is not updated frequently. When showing a static image, they draw no current and thus battery life is extended. However, they need a lot of current to update the image, which can take one to two seconds.
Transparent capsules filled with dark-colored oil make up the pixels. Within the oil are white, negatively charged titanium dioxide particles. There are electrodes on the front and back of the capsules. If the front electrode is positively charged, the particles are drawn toward it and the pixel appears white. If the back electrode is positively charged, the particle goes toward that leaving the black oil visible, so the pixel appears black. This is illustrated in Figure 1.
Figure 1: Electrodes draw the negatively-charged white particles to the front or back of the display to create the image.
Since they draw so little current, anything else in the display that does draw current becomes relatively more noticeable, and thus the choice of microcontroller becomes important. In this example, we are using an EFM32 MCU from Silicon Labs as this can take advantage of its various energy modes that reduce the amount of current being drawn. In this type of application, it would mostly be in energy mode four in which it draws as little as 20 nA. MCUs in this range can have up to 1 Mbyte of Flash and 128 kbyte of SRAM, which can be used for saving frame buffers and images. These displays also take longer to update in low temperatures, but the MCU has an internal temperature sensor that can be used to adjust this time.
One problem with this type of display is the contrast ratio, which decays over time. Some manufacturers place a demand on this rate of decay, an example from one manufacturer being a specified drop from a contrast ratio of 9.1 to 7.1 over three weeks. Ghosting can also cause problems, where parts of the previous image can still be seen. This occurs if not all of the particles manage to move to the other side of the cell, creating a grey shade. This is normally cured by writing multiple times to the display for each image.
This example uses the Pervasive Displays SG020AS0T1
EPD extension board and the Silicon Labs EFM32
starter kit. The extension board includes a flexible panel connector to connect the display, 8 Mbyte of Flash for storing images, temperature sensor, and 20-pin header to connect the EFM32 MCU. The connector can be used with 1.44, 2.0 and 2.7 inch paper display panels. The signal to drive the panel is routed out on the 20-pin header. The board comes with a 20-pin connector cable that terminates in standard jumper cables on the opposite side. Figure 2 shows how to connect the starter board to the extension kit.
Figure 2: Connection table for connecting the extension board to the starter kit.
The panels from Pervasive Displays come with an integrated chip-on-glass (CoG) driver that controls the lines and columns on the panel. The CoG has a three-wire SPI interface for accepting commands from the MCU. When writing an image to the display, the panel requires a large voltage across it to drive the pixels. To achieve this without an external voltage supply, a charge-pump circuit is used. The MCU must provide a PWM signal between 100 and 300 kHz to charge up this voltage.
The process of drawing an image starts by the MCU powering up and initializing the CoG. During initialization, the MCU sends SPI commands to the CoG and must stick to the timings in the CoG documentation. It must also provide the PWM waveform as part of the initialization sequence. Image data are written in multiple passes to avoid ghosting and improve the contrast. The number of times a frame should be rewritten depends on the type of display and the temperature. The particles move more slowly in colder temperatures and thus the panel needs more rewrites. This is why the extension board has a temperature sensor to help determine the number of rewrites necessary. There is also an internal temperature sensor in the EFM32
that can be used. The CoG driver is then powered off, which must be done in a particular sequence with timings that the MCU must follow. This sequence involves first clearing the pixel registers and then discharging the charge-pump capacitors.
The MCU needs to keep two frame buffers in memory, one for the new image and one for the old image still on the panel. This is because the panel is updated in four stages. First, the current image is inverted. Secondly, the entire panel is drawn white. Then, the inverse of the new image is drawn and, finally, the new image is drawn. After the power-down sequence is finished, power to the panel can be removed and the image will stay in place.
To optimize power during a display update, the EFM32
must be in the correct energy mode at all times. So, when rendering a new image it should run at high frequencies. During the update stages, when the frame is transmitted over SPI to the panel, the clock frequency can be slower since the stage should run for a predetermined time. During delay periods, when the MCU is waiting for the CoG to be ready, the MCU can be in a sleep mode. It can be sensible to use energy mode four as the sleep mode depending on whether other tasks need to be performed during the sleep mode. When waking up from this mode, the MCU has to go through a full reset and run the start-up and initialization code, which adds to the current consumption. So this mode only is fully beneficial if the sleep modes are long.
The main parameter that can be optimized to save power during an update is how long each stage should take. The display documentation should define sensible defaults for each panel along with a temperature factor that can be used to extend this time for colder environments.
Controllerless graphics application
Many embedded applications use an internal or external graphics controller, but these can add cost and make the design more complicated. However, for a basic graphical user interface, such controllers are often not necessary. Instead, microcontroller peripherals can be used to create a virtual graphics controller without taking up a large amount of CPU time; the example given here uses less than 5% of CPU time. It uses a PIC32
microcontroller from Microchip and the company’s PICtail Low-Cost Controllerless (LCC)
Graphics Board that works with many PIC32
A controllerless graphics system needs to send a frame of pixel information to a display glass at a refresh rate of about 60 Hz. This means the system must constantly send frame data to the LCD panel, which can take up a lot of CPU time. However, the PIC32
MCUs can have a direct memory access (DMA) peripheral for transferring data without CPU intervention, and that reduces CPU time to less than 5%.
In a controllerless graphics application, the DMA should be set to transfer one line of frame data at a time through the parallel master port (PMP). Each line contains many pixels and the DMA sends a portion of the frame buffer during each transfer. A PMP or timer interrupt triggers the next DMA transfer until a line is transferred. For PIC32
devices with non-persistent interrupts, a timer is the DMA trigger source.
The PMP strobes a read or write signal after each pixel transfer. The read-write strobes of the PMP peripheral act as the pixel clock for the display glass. After each line of pixel data is transferred, the CPU is interrupted by the DMA and certain timing signals – such as HSYNC, VSYNC, and DEN – needed for LCD panels are updated. This is repeated until an entire frame has been drawn. The frame is stored in volatile memory so the image can be dynamic. In this setup, SRAM is used. The system can be set up to use internal or external SRAM, as shown in Figure 3.
Figure 3: System set up to use external (top) and internal (bottom) memory.
The PMP data lines are used for mapping color to a TFT LCD. Depending on the color format used, the 16 PMP data lines can be configured to transmit the color data. In 8 BPP Color mode, only eight PMP data lines are needed. When using external memory for 16 BPP Color mode, eight or 16 PMP data lines can be used. With eight data lines, the external memory data lines still get mapped to the TFT LCD in 16 BPP mode, but the PIC32
MCU only connects to the memory through eight bits. When a write needs to be performed, the MCU can then use the low/high byte pins on the external memory to send 16-bit color values to the SRAM.
Though the controllerless method described here was designed to work with TFT LCD panels, it can also work with CSTN or MSTN glass with some minor modifications. Most LCD panels can have eight to twenty-four color data lines depending on the color depth. These lines provide the LCD with the raw color data. The clock signals HSYNC, VSYNC, DEN and PCLK synchronize the pixel data with the graphics frame and the LCD panel. The sync lines tell the LCD panel when the data are at the start or end of a line (HSYNC) or a frame (VSYNC). The DEN (data enable line) lets the panel know when valid pixel data are being sent. The DEN is required for TFT type panels because there is time needed to set up the panel for proper pixel locations.
The PCLK signal is the clock source for the whole system. One clock pulse from the PCLK updates the panel. All other clock lines must be synchronized to the pixel clock to achieve proper image output. Not all display panels have HSYNC, VSYNC, and DEN lines. This example is for panels that can be used to explain each line and its purpose. However, panels not containing HSYNC and VSYNC signals can still be used with the controllerless graphics setup.
The LCC software driver can help with synchronization needing certain timing parameters, such as pulse width, front porch and back porch for horizontal and vertical pulses. After these values are compiled into the driver, the panel displays the frame.
Rendering new pixels in the screen is as important as refreshing the screen. This is done by the CPU writing to the display buffer. If the frame is stored externally, the DMA transfer is suspended while the frame is being updated. This is because there is only one PMP peripheral and it is being shared by the virtual graphics controller or DMA transfer. This affects the refresh rate of the screen. The amount of pixel updates needs to be monitored to prevent too large a refresh rate change, otherwise the change will be perceptible by the human eye. This is done using a pixel count variable within the virtual graphics controller that is updated on every pixel write and cleared during every DMA interrupt.
Driving LCD with standard microcontroller
An LCD can also be driven without a dedicated driver using an ST62
microcontroller from STMicroelectronics. This suits applications that need a small display at low cost but yet can take advantage of the versatile capabilities of this microcontroller.
With a zero root mean square (RMS) voltage applied to it, an LCD is practically transparent. The LCD contrast, which makes the segments turn dark or opaque and thus on, is caused by the difference between the RMS LCD voltage applied and the LCD threshold voltage, which is specific to each LCD type. The applied LCD voltage must alternate to give a zero DC value to ensure a long life for the LCD. The higher the multiplexing rate is, the lower the contrast. The period of the signal has to be short enough to avoid visible flickering of the display.
Each LCD segment is connected to an IO segment and to one backplane common to all the segments. A display using S segments is driven with S+1 MCU output lines. The backplane is driven with a signal – com – controlled between 0 and VDD
with a duty cycle of 50%. When selecting a segment “on”, a signal with opposite polarity to com is sent to the corresponding segment pin. When the non-inverted signal com is sent to the segment pin, the segment is “off”. Using an MCU, the IO operates in output mode at either the logic level 0 or 1.
For duplexed drive (see Figure 4), two backplanes are used instead of one. Each LCD pin is connected to two LCD segments, each one connected on the other side to one of the two backplanes. Thus, only (S/2)+2 MCU pins are necessary to drive an LCD with S segments. Three different voltage levels have to be generated on the backplanes: 0, VDD
/2 and VDD
. The segment voltage levels are 0 and VDD
only. The LCD segment is inactive if the RMS voltage is below the LCD threshold voltage and is active if the LCD RMS voltage is above the threshold voltage. The intermediate voltage VDD
/2 is only required for the backplane voltages. The ST62
IO pins selected as backplanes are set by software to output mode for 0 or VDD
levels and to high impedance input mode for VDD
/2. This voltage VDD
/2 is defined by two equal-valued resistors externally connected to the IO pin. By using an MCU with flexible IO pin configuration, a duplexed LCD drive can be made with only four additional resistors.
Figure 4: Basic LCD segment connections in duplexed mode.
This approach can be very cost effective for simple LCDs with a multiplexing rate of one or two and up to thirty-six segments.
Some form of display is needed for many types of applications, even those with pressure on cost and power consumption. This can provide a headache for many engineers also faced with strict time-to-market limitations. However, as the three examples here have shown, standard low-cost and low-power MCUs can often be used to drive graphical applications.