1. Designing LCD applications with NXP
ARM Cortex-M3 LPC1788
Kenneth Dwyer, eeTimes Webinar, July 13th, 2011
1
2. Agenda
NXP and LPC1788 Introduction
LCD Terminology and Technologies
LCD Interface and signals
NXP Microcontrollers with LCD interface
System Issues to consider
LCD Software and Tools
3rd Party LCD Software Support
LPCZone and Training
Q&A
2
3. NXP is a leader in ARM Flash MCUs
Clear strategy: 100% focus on ARM
Top performance through leading
technology & architecture
Design flexibility through pin- and
software-compatible solutions
β Scalable memory sizes
β Widest range of peripherals
Unlimited choice through complete
families for multiple cores
3
4. NXP MCU β the only complete ARM range of
Cortex-M0, Cortex-M3 and Cortex-M4 processors
NXP ARM Cortex-M Continuum
Entry level Fully featured
Cortex-M0 Cortex-M4
$0.65* Cortex-M0 Cortex-M3 Cortex-M4 $7.00*
True 8/16-bit High performance for Advanced Digital
replacement communication and Signal control
- low power, low cost, control - Floating point unit
more performance - LCD, USB, Ethernet, - Dual-core options
CAN and much more
Over 250 different ARM based microcontrollers available!!
(* Recommended price at 10kpcs)
4
6. Bridging Cortex-M3 and ARM7
LPC1700 Cortex-M3 MCUs are pin-compatible to NXP ARM7 MCUs
allowing easy project migration
β LPC178x is pin-compatible to the LPC247x series
β LPC177x is pin-compatible to the LPC246x, LPC245x and LPC238x series
β LPC176x is pin-compatible to the LPC236x series
6
7. LPC178x series
Cortex-M3 performance
@ 120MHz Up to 512 kB on-chip flash
memory
Maximum bandwidth for Up to 4 kB on-chip
USB and Ethernet EEPROM
communication because
of unique matrix bus and Up to 96 kB on-chip SRAM
flexible SRAM
implementation
32-bit full External New NXP USART with
Memory Interface support for Smart Card
Interface
First Cortex-M3 with full New NXP Event Recorder
LCD graphics controller in RTC domain for anti-
tampering protection
See web: http://ics.nxp.com/products/lpc1000/lpc17xx/
7
8. LPC177x & LPC178x Features
ARM Cortex-M3 Core Analog Peripherals
β 120 MHz operation β 12-bit ADC with 8 channels (400 ksps)
β Nested Vectored Interrupt Controller (NVIC) β 10-bit digital-to-analog converter
β Wakeup interrupt controller
β Memory Protection Unit Other Peripherals
β CRC Calculation engine β LCD controller (LPC178x)
β Up to 32-bit External Memory Controller
Memories β Low Power Real-time clock
β Up to 512 kB Flash memory β Event recorder
β Up to 96 kB SRAM (3 blocks) β Eight-channel, general-purpose DMA
β Up to 4 kB EEPROM β Up to 165 GPIO
Serial Peripherals β Motor control PWM
β 10/100 Ethernet MAC β Quadrature encoder interface
β USB 2.0 full-speed device/host/OTG β Four 32-bit timers/counters
β Four UARTs + one USART β 12 MHz internal RC oscillator trimmed to
β Two CAN 2.0B controllers 1% accuracy
β Three SSP/SPI controllers
β Three I2C (one with FM+)
β SD/MMC
β I2S interface
8
10. Target application for LPC177x / LPC178x
NXP Cortex-M3 design-wins in multiple applications
Point-of-sale PLC HMI / Home-display Car Alarms
terminals
And many other And many other And many other And many other
communications industrial/medical consumer / appliance transportation
applications, e.g.: applications, e.g.: applications, e.g.: applications, e.g.:
- Web server - HVAC - Audio - Aftermarket
- Multi-protocol - security monitoring - Alarm systems - GPS/Fleet
bridge - video intercom - Scanners management
- circuit breakers - Small appliances
10
12. Resolution and Color Depth
Resolution is not measured in inches!
β QVGA 320 X 240
β VGA 640 x 480
β SVGA 800 X 600
β Landscape or portrait orientation
Color depth or bits per pixel (bpp)
12
13. What is a Frame Buffer?
Contiguous memory buffer containing a complete frame of data
Consists of color values for every pixel
β For QVGA with 16 bpp color => 240 x 320 x 2 = 150kB of RAM
Color values are commonly represented as
β 1 bit (1 bpp): Monochrome
β 2 bit (2 bpp): Palette based (4 colors)
β 4 bit (4 bpp): Palette (16 colors, controller has a palette look-up table)
β 8 bit (8 bpp): Palette (256 colors, controller has a palette look-up table)
β 16 bit (16 bpp): High color format (5:5:5 - 32,768 colors; 5:6:5 - 65,536
colors)
β 24 bit (24 bpp): True color format (16,777,216 colors)
13
14. Palette Based Frame Buffer
The frame buffer will contain an index value for each pixel
Palette RAM is pre-filled with 16-bit color value for each index
Framebuffer Palette Image
NXP microcontrollers have 256 entries to support
β 1, 2, 4, or 8 bpp palletized color displays for color STN and TFT
β 1, 2, or 4 bits-per-pixel (bpp) palletized displays for mono STN
14
15. LCD panel Technologies β STN and TFT
STN (Super-Twisted Nematic)
β Slower response compared to TFT technologies
β Lower cost and power than TFT
β Variations include Color STN (CSTN) and Dual STN (DSTN)
β STN displays only turn segments on and off
TFT (Thin-Film transistor)
β Fast response
β Higher cost than STN, Uses more power than STN
β Variations include Advanced TFT (ADTFT) and Highly Reflective TFT
(HRTFT)
15
16. LCD Clocked STN
Element 0, 3 RGB elements Element 959,
line 0 make 1 pixel line 0
320x240 CSTN display
R G B R G B R G B
R G B R G B
Element 3,
line 239
R G B R G B R G B
With a 4-bit CSTN display, a clock of data will drive 4
elements, or 1-1/3 pixels. It will take 240 clocks to
D0 D1 D2 D3 drive all the data for a 320 pixel line.
16
17. LCD Clocked TFT
Pixel 0 (16 bits), Pixel 319,
line 0 line 0
320x240 TFT display
RGB RGB RGB
RGB RGB RGB
Pixel 1, line 239
RGB RGB RGB
With a 18-bit TFT display, a clock of data will drive 1
pixel. It will take 320 clocks to drive all the data for a
R5...R0 G5...G0 B5...B0 320 pixel line.
17
19. Driving a clocked LCD bus
VSYNC/FP
HSYNC/LP
Pixel clock
Data lines
Host MCU LCD panel
PWM Backlight
Constant
current
source
19
20. Refresh Rate
REFRESH_RATE (Hz) =
pixel_clock_rate / [(vertical_resolution + vertical_front_porch +
vertical_back_porch) * (pixel_clocks_per_data_line +
horizontal_front_porch + horizontal_back_porch))]
Example :
β 6.5MHz pixel clock
β vertical resolution=240 lines,
β vertical front porch=5 lines,
β vertical back porch=1 line,
β pixel clocks per data line = 320 pixels,
β horizontal front porch=20 clocks,
β horizontal back porch=10 clocks
β REFRESH_RATE = 6,500,000 / [(240 + 5 + 1) * (320 + 20 + 10)] = 75.5Hz
20
21. LCD Signals
The largest configuration for the LCD controller uses 31 pins. There are
many variants using as few as 10 pins for a monochrome STN panel.
21
24. Driving the LCD β various timings
VSYNC starts the
frame Horizontal front
porch timing
Vertical back
porch timing
HSYNC starts at
the beginning of
each line
Vertical front
porch timing
Horizontal back 320x240 display shown with
porch timing timing for VSYNC, HSYNC,
clock, and porch values
24
30. NXP Microcontrollers with LCD interfaces
Main features of the LCD Controller:
β Support for STN Single and Dual and TFT panels
β Up to 1024x768 resolution
β 24-bit LCD interface supports 24bpp (16M colors)
β Palette table allowing display of up to 256 of 64k colors
β Adjustable LCD bus size supports various panel bus configurations
β Dedicated LCD DMA controller
β Hardware cursor support
In addition to the LPC1788 the following devices have the same
interface:
β LPC1850, LPC4300, LPC325x, LPC247x and LH7 devices
This helps to significantly to reduce software porting efforts
30
31. Configuring the LPC1788 LCD
Power: In the PCONP register, set the PCLCD bit (0 @ Reset).
β Note the LCD power-up sequence
Setup the clocks and timing registers
Select LCD pins and pin modes via the relevant IOCON registers
31
36. LCD Tearing
Tearing:
β Result of LCD DMA unable to service the LCD FIFO in time
β Use the FIFO Underflow to monitor for this
Workarounds
β Change AHB priority β next slide
β Slow down frame refresh rate, pixel clock if possible
β Use 32-bit wide external memories
β Increase the SDRAM clock speed, use faster SRAM
β Profile code and move frequently accessed code to internal SRAM
36
37. LPC1788 LCD AHB Priority
AHB Matrix Arbitration register (Matrix_Arb - 0x400F C188)
The values used for the various priorities are 3 = highest, 0 = lowest
To give priority to the LCD DMA use the value 0x0000 0C09
37
39. Basic Graphicβs Library - SWIM
A free βbasicβ graphics library
β Simple Windows Interface Manager
β Basic fonts ASCII characters, 6x7, 6x13, 8x8
β Draw boxes, lines, set colors
β Display and scale bitmap images
AN10815
β API documentation for SWIM Library
β Quick start guide document
β IAR, Keil, Rowley, GNU projects for:
β’ LPC3250 Phytec, LPC2478 and LPC1788 EA, LPC1850 Hitex
β http://ics.nxp.com/support/documents/microcontrollers/zip/an10815.zip
39
40. SWIM Code Overview
Using SWIM itβs easy to setup the LCD controller
40
41. LPC Bitmap Converter Utility
This tool converts BMP format into C Code format
Useful for importing images but uses a lot of memory β not compressed
like JPEG or GIF
Command line tool Windows 7 compatibility
Source code available
http://www.lpcware.com/content/nxpfile/bmp-c-image-conversion-utility
41
42. LPC1788 Boards and IDEβs
Evaluation Boards Available
Now!
Embedded Artists LPC1778/88 (OM13001)
β Display panel separate
IAR KSDK-LPC1788
FDI uEZ-LPC1788
IDEs
LPCXpresso
ARM/Keil Β΅Vision4
CodeRed RedSuite
IAR Embedded Workbench for ARM (EWARM)
JTAG debuggers
All debuggers supporting Cortex-M3
42
43. Other support material
http://ics.nxp.com/support/microcontrollers/lcd/
LPC178x PDL β Peripheral driver library
β Software drivers and examples for all peripherals
β Includes USB, Ethernet and LCD examples
β CMSIS 2.0 Compliant
β http://ics.nxp.com/support/documents/microcontrollers/?scope=LPC178x&t
ype=software&search=CMSIS
http://ics.nxp.com/literature/presentations/microcontrollers/pdf/graphics.
lcd.technologies.pdf
uClinux Q3/2011 with all the graphics packages it offers
β nano-X (formerly microWindows), Qte, directfb
BSDL, IBIS Models, Orcad symbols
β http://ics.nxp.com/support/models/lpc1000/
43
44. Touchscreen AN
AN10675
β http://ics.nxp.com/support/documents/microcontrollers/pdf/an10675.pdf
β Details on how to utilize the ADC for Touchscreen support
β Technique can be easily adapted for other MCUs
LPC3250 has dedicated hardware support for resistive touchcreens VREF
Resistor which much
higher impedance than
the touchscreen
GPIO1 To ADC1
Y+
Top plate
To ADC2
X+ X-
GPIO2
GPIO4
Bottom plate
Y-
GPIO3
44
45. LPC247x Design Example
This illustrates how to connect the following
β STN 4-bit B/W QVGA (320 X 240)
β TFT 18-bit WVGA (800 X 480)
β TFT QVGA (320 X 240)
β ADTFT 24-bit QVGA (320 X 240)
http://ics.nxp.com/support/design/microcontrollers/lcd.controller/
45
47. BlueWater Embedded Prism/Prism-Micro
Prism Micro is for lower color depth applications, <= 8bpp (256 colors)
It has a smaller footprint than Prism, but it is still C++ API
Demo software here:
http://www.bwembedded.com/products/prism_target_demos.php
47
48. FDI uEZGUI-1788 System
LPC1788 system running uEZ +FreeRTOS
Seiko 7.0β TFT WVGA 800x480 with integrated Touch Screen
Rowley Crossworks and JLINK
GPL licensed source code
http://www.teamfdi.com/products/uEZGUI-1788-
70WVE/brochure/uEZGUI-1788-70WVE%20Brochure.pdf
http://sourceforge.net/projects/uez/
http://ics.nxp.com/support/microcontrollers/lcd/#Featured
48
49. Segger emWIN
Written in ANSI-C
Widgets, anti-aliasing, multiple fonts
Touchscreen support integrated
Virtual screen, VNC Support
Memory devices β smoother transitions
Full API Documentation
NXP evaluation versions here
β http://www.segger.com/cms/nxp.html
49
50. Other Third party offerings
I2ST
β Java virtual machine
β Support for LPC2478 and LPC1788
β http://www.is2t.com
GHI
β Microsoft .NET Micro Framework
β FEZ support LPC1788 and LPC2478 devices
β www.GHIElectronics.com
50
52. Where to get started?
www.nxp.com/microcontrollers
β MCU homepage
www.nxp.com/lpczone
β Product updates and training
www.nxp.com/lpcxpresso
β Low-cost development
www.mbed.org
β Rapid proto-typing
53. New Cortex-M training videos
Introduction to NXP's Cortex-M0/M3/M4 processors
β http://ics.nxp.com/support/training/cortex-m.intro/
LPC1000 debug tools, tips, and tricks (part 1) Cortex-M0
β http://ics.nxp.com/support/training/lpc1000.debug.tools.tips.1/
LPC1700 series overview
β http://ics.nxp.com/support/training/lpc1700.overview/
Cortex-M3
Introduction to NXP's LPC4300 Cortex-M4 based digital controller
β http://ics.nxp.com/support/training/lpc4300.intro/
Introduction to NXP's LPC4300 advanced peripherals
β http://ics.nxp.com/support/training/lpc4300.peripherals/
Cortex-M4
LPCXpresso introduction
β http://ics.nxp.com/support/training/lpcxpresso.intro/
LPCXpresso
Learn Eclipse the LPCXpresso way
β http://ics.nxp.com/support/training/learn.eclipse.lpcxpresso/
Simplifying USB with NXP's lowest-cost ARM MCUs
β http://ics.nxp.com/support/training/lpc1000.debug.tools.tips.1/ USB