Nxp jul1311
Transcript of Nxp jul1311
1
Designing LCD applications with NXP ARM Cortex-M3 LPC1788
Kenneth Dwyer, eeTimes Webinar, July 13th, 2011
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
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
NXP MCU – the only complete ARM range of Cortex-M0, Cortex-M3 and Cortex-M4 processors
NXP ARM Cortex-M Continuum
Cortex-M4Cortex-M3Cortex-M0
True 8/16-bit replacement
- low power, low cost, more performance
High performance for communication and
control- LCD, USB, Ethernet, CAN and much more
Advanced Digital Signal control
- Floating point unit- Dual-core options
$0.65* $7.00*
Over 250 different ARM based microcontrollers available!!
Entry levelCortex-M0
Fully featured Cortex-M4
(* Recommended price at 10kpcs)
4
LPC178XBringing LCD graphics to Cortex-M3
5
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
LPC178x series
Cortex-M3 performance @ 120MHz
Up to 96 kB on-chip SRAM
Up to 512 kB on-chip flash memory
First Cortex-M3 with full LCD graphics controller
Up to 4 kB on-chip EEPROM
See web: http://ics.nxp.com/products/lpc1000/lpc17xx/
Maximum bandwidth for USB and Ethernet
communication because of unique matrix bus and
flexible SRAM implementation
32-bit full External Memory Interface
New NXP USART with support for Smart Card
Interface
New NXP Event Recorder in RTC domain for anti-
tampering protection
7
LPC177x & LPC178x Features
Analog Peripherals– 12-bit ADC with 8 channels (400 ksps)– 10-bit digital-to-analog converter
Other Peripherals– LCD controller (LPC178x)– Up to 32-bit External Memory Controller– Low Power Real-time clock– Event recorder– Eight-channel, general-purpose DMA– Up to 165 GPIO– Motor control PWM– Quadrature encoder interface– Four 32-bit timers/counters– 12 MHz internal RC oscillator trimmed to
1% accuracy
ARM Cortex-M3 Core– 120 MHz operation– Nested Vectored Interrupt Controller (NVIC)– Wakeup interrupt controller– Memory Protection Unit– CRC Calculation engine
Memories– Up to 512 kB Flash memory– Up to 96 kB SRAM (3 blocks)– Up to 4 kB EEPROM
Serial Peripherals– 10/100 Ethernet MAC– USB 2.0 full-speed device/host/OTG– Four UARTs + one USART– Two CAN 2.0B controllers– Three SSP/SPI controllers– Three I2C (one with FM+)– SD/MMC– I2S interface
8
LPC178x
Four parts in the family support LCD
9
HMI / Home-display
Target application for LPC177x / LPC178xNXP Cortex-M3 design-wins in multiple applications
Point-of-sale terminals
Car AlarmsPLC
And many other communicationsapplications, e.g.:
- Web server- Multi-protocol
bridge
And many other industrial/medical applications, e.g.:
- HVAC- security monitoring
- video intercom- circuit breakers
And many other consumer / appliance
applications, e.g.:- Audio
- Alarm systems- Scanners
- Small appliances
And many other transportation
applications, e.g.:- Aftermarket- GPS/Fleet
management
10
11
LCD Terminology and Technologies
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)
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
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
Framebuffer Palette Image
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)
16
LCD Clocked STN
R
R
R
G
G
G
B
B
B
R G B
R G B
R G B
R G B
R G B
320x240 CSTN display
Element 0,line 0
Element 959,line 0
Element 3,line 239
D0 D3D2D1
3 RGB elements make 1 pixel
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
drive all the data for a 320 pixel line.
17
LCD Clocked TFT
320x240 TFT display
Pixel 0 (16 bits),line 0
Pixel 319,line 0
Pixel 1, line 239
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
320 pixel line.
RGB RGB RGB
RGBRGB RGB
RGBRGB RGB
R5...R0 G5...G0 B5...B0
18
LCD Interface and signals
19
Driving a clocked LCD bus
Host MCU LCD panelData lines
VSYNC/FP
HSYNC/LP
Pixel clock
Constant current source
BacklightPWM
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
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
LCD STN Signals
Single Panel
22
LCD TFT Signals
23
24
Driving the LCD – various timings
320x240 display shown with timing for VSYNC, HSYNC,
clock, and porch values
VSYNC starts the frame
Vertical back porch timing
Vertical front porch timing
Horizontal front porch timing
Horizontal back porch timing
HSYNC starts at the beginning of
each line
Truly 240 x 320 TFT RGB666
25
Snapshot of incorrect LCD settings
26
27
LCD – TFT Horizontal Timings
28
LCD – TFT Vertical Timings
29
NXP Microcontrollers with LCDinterfaces
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
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
32
Dual-CSTN data flow
33
NXP Microcontrollers – TFT data flow
34
System Issues to Consider
LPC178x bandwidth calculator
http://ics.nxp.com/support/documents/microcontrollers/xls/lpc178x.lcd.bus.load.calculator.xls
35
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
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
38
LCD Software and Tools
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
SWIM Code Overview
Using SWIM it’s easy to setup the LCD controller
40
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
LPC1788 Boards and IDE’sEvaluation Boards
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
Available Now!
42
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
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
44
Top plate
Bottom plate
X+ X-
Y+
Y-
VREF
Resistor which much higher impedance than
the touchscreen
To ADC1
To ADC2
GPIO1
GPIO2
GPIO3
GPIO4
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
46
3rd party LCD Software Support
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
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
51
LPCZone, Training
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
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) – http://ics.nxp.com/support/training/lpc1000.debug.tools.tips.1/
LPC1700 series overview– http://ics.nxp.com/support/training/lpc1700.overview/
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/
LPCXpresso introduction– http://ics.nxp.com/support/training/lpcxpresso.intro/
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/
New Cortex-M training videos
Cortex-M4
LPCXpresso
Cortex-M3
Cortex-M0
USB
54
Q&A
55