SAM4E-EK: Add ILI9341-based LCD driver

This commit is contained in:
Gregory Nutt 2014-08-20 11:45:01 -06:00
parent 29eef778ce
commit cf242fbeb4
6 changed files with 1370 additions and 55 deletions

View File

@ -65,7 +65,19 @@ endchoice # AT25 serial FLASH configuration
if LCD
choice
prompt "ILI9325-based LCD Color Configuration"
prompt "LCD Type"
default SAM4EEK_LCD_ILI9341
config SAM4EEK_LCD_ILI9325
bool "ILI9325 LCD controller"
config SAM4EEK_LCD_ILI9341
bool "ILI9341 LCD controller"
endchoice # LCD Type
choice
prompt "LCD Color Configuration"
default SAM4EEK_LCD_RGB565
config SAM4EEK_LCD_RGB565
@ -77,7 +89,7 @@ config SAM4EEK_LCD_RGB24
config SAM4EEK_LCD_RGB32
bool "RGB32"
endchoice # ILI9325-based LCD Color Configuration
endchoice # LCD Color Configuration
config SAM4EEK_LCD_BGCOLOR
hex "Initial background color"

View File

@ -24,7 +24,7 @@ Contents
- USB Full-Speed Device
- HSMCI
- Touchscreen
- ILI9325-Based LCD
- ILI9325/41-Based LCD
- SAM4E-EK-specific Configuration Options
- Configurations
@ -917,18 +917,16 @@ Touchscreen
STATUS: Verified 2014-05-14
ILI9325-Based LCD
ILI9325/41-Based LCD
=================
The SAM4E-EK carries a TFT transmissive LCD module with touch panel,
FTM280C34D. Its integrated driver IC is ILI9325. The LCD display area is
2.8 inches diagonally measured, with a native resolution of 240 x 320
FTM280C34D. Its integrated driver IC is either a ILI9325 ILI9342 (the
original schematics said ILI9325, but I learned the hard way that I had
an ILI9341-based LCD). The LCD display area is 2.8 inches diagonally
measured, with a native resolution of 240 x 320
dots.
No driver has been developed for the SAM4E-EK LCD as of this writing.
Some technical information follows might be useful to anyone who is
inspired to develop that driver:
Connectivity
------------
@ -998,39 +996,34 @@ ILI9325-Based LCD
brightness control) from a 32-level logarithmic scale. Four resistors
R93/R94/R95/R96 are implemented for optional current limitation.
Resources
---------
Configuration
-------------
If you want to implement LCD support, here are some references that may
help you:
This is the basic configuration that enables the ILI9341-based LCD.
Of course additional settings would be necessary to enable the graphic
capabilities to do anything with the LCD.
1. Atmel Sample Code (ASF). There is no example for the SAM4E-EK, but
there is for the SAM4S-EK. The LCD and its processor connectivity
appear to be equivalent to the SAM4E-EK so this sample code should be
a good place to begin. NOTE that the clock frequencies may be
different and pin usage may be different. So it may be necessary to
adjust the SAM configuration to use this example.
System Type -> AT91SAM3/4 Configuration Options
CONFIG_SAM34_SMC=y : SMC support
2. There is an example of an LCD driver for the SAM3U at
configs/sam4u-ek/src/up_lcd.c. That LCD driver is for an LCD with a
different LCD controller but should provide the NuttX SAM framework
for an LCD driver.
Device Drivers -> LCD Driver Support
CONFIG_LCD=y : Enable LCD support
CONFIG_LCD_MAXCONTRAST=1 : Value should not matter
CONFIG_LCD_MAXPOWER=64 : Must be > 16
CONFIG_LCD_LANDSCAPE=y : Landscape orientation
3. There are other LCD drivers for different MCUs that do support the
ILI9325 LCD. Look at configs/shenzhou/src/up_ili93xx.c,
configs/stm3220g-eval/src/up_lcd.c, and
configs/stm3240g-eval/src/up_lcd.c. I believe that the Shenzhou
driver is the most recent.
Board Selection
CONFIG_SAM4EEK_LCD_ILI9341=y : For the ILI9341-based LCD
CONFIG_SAM4EEK_LCD_RGB565=y : Color resolution
CONFIG_SAM4EEK_LCD_BGCOLOR=0x00 : Initial background color
STATUS:
2014-05-14: Fully implemented. There is still a bug in in the LCD
communications. The LCD ID is read as 0x0000 instead of 0x9325.
2014-8-19: Updated. The LCD ID is bad because the on-board LCD is
*not* an ILI9325. It is an ILI9341. The ID lies in a different
address and is 0x00009341. Need to write a new driver.
2014-8-20: Updated. The ILI9341 LCD has some basic functionality.
Certainly it can transfer and display data fine. But there are some
issues with the geometry of data that appears on the LCD..
The LCD backlight appears to be functional.
The LCD backlight is functional.
SAM4E-EK-specific Configuration Options
=======================================
@ -1185,9 +1178,14 @@ SAM4E-EK-specific Configuration Options
LCD Options. Other than the standard LCD configuration options
(see configs/README.txt), the SAM4E-EK driver also supports:
CONFIG_LCD_PORTRAIT - Present the display in the standard 240x320
"Portrait" orientation. Default: The display is rotated to
support a 320x240 "Landscape" orientation.
CONFIG_LCD_LANDSCAPE - Define for 320x240 display "landscape"
support. Default is this 320x240 "landscape" orientation
CONFIG_LCD_RLANDSCAPE - Define for 320x240 display "reverse
landscape" support.
CONFIG_LCD_PORTRAIT - Define for 240x320 display "portrait"
orientation support.
CONFIG_LCD_RPORTRAIT - Define for 240x320 display "reverse
portrait" orientation support.
Configurations
==============
@ -1425,6 +1423,7 @@ Configurations
CONFIG_LCD_LANDSCAPE=y : Landscape orientation
Board Selection
CONFIG_SAM4EEK_LCD_ILI9341=y : For the ILI9341-based LCD
CONFIG_SAM4EEK_LCD_RGB565=y : Color resolution
CONFIG_SAM4EEK_LCD_BGCOLOR=0x00 : Initial background color
@ -1469,9 +1468,9 @@ Configurations
2014-05-14: The touchscreen interface was successfully verified.
2014-05-14: The LCD interface is fully implemented. However,
there is still a bug in in the LCD communications. The
LCD ID is read as 0x0000 instead of 0x9325.
2014-08-20: The LCD interface is fully implemented and data appears
to be transferred okay. However, there are errors in
geometry that leave the LCD unusable still.
The LCD backlight appears to be functional.

View File

@ -55,7 +55,13 @@ CSRCS += sam_hsmci.c
endif
ifeq ($(CONFIG_LCD),y)
ifeq ($(CONFIG_SAM4EEK_LCD_ILI9325),y)
CSRCS += sam_ili9325.c
else
ifeq ($(CONFIG_SAM4EEK_LCD_ILI9341),y)
CSRCS += sam_ili9341.c
endif
endif
endif
ifeq ($(CONFIG_INPUT_ADS7843E),y)

File diff suppressed because it is too large Load Diff

View File

@ -90,12 +90,16 @@ Examples: /drivers/lcd/
Re-usable LCD drivers reside in the drivers/lcd directory:
LEDs:
LCDs:
----
mio283qt2.c. This is a driver for the MI0283QT-2 LCD from Multi-Inno
Technology Co., Ltd. This LCD is based on the Himax HX8347-D LCD
controller.
mio283qt9a.c. This is a driver for the MI0283QT-9A LCD from Multi-Inno
Technology Co., Ltd. This LCD is based on the Ilitek ILI9341 LCD
controller.
nokia6100.c. Supports the Nokia 6100 display with either the Philips
PCF883 or the Epson S1D15G10 display controller. This LCD is used
with the Olimex LPC1766-STK (but has not been fully integrated).
@ -202,7 +206,10 @@ that makes then less re-usable:
configs/stm3220g-eval/src/up_lcd.c and configs/stm3240g-eval/src/up_lcd.c.
AM-240320L8TNQW00H (LCD_ILI9320 or LCD_ILI9321) and
AM-240320D5TOQW01H (LCD_ILI9325)
configs/shenzhou/src/up_ili93xx.c. Another ILI93xx driver.
config/sam4e-ek/src/sam_ili9325.c. ILI9325 driver
config/sam4e-ek/src/sam_ili9341.c. ILI9341 driver
R61505U
@ -242,6 +249,12 @@ that makes then less re-usable:
configs/stm32ldiscovery/src/stm32_lcd.c. 1x6 segment LCD with bars
using the segment LCD controller built-into the STM32L15X.
TFT Panel Drivers:
configs/open1788/src/lpc17_lcd.c and arch/arm/src/lpc17xx/lpc17_lcd.c
configs/sama5d3x-ek/src and configs/sama5d4-ek/src: Use
arch/arm/src/sama5/sam_lcd.c
graphics/
=========

View File

@ -47,7 +47,7 @@
**************************************************************************************/
/* ILI9341 ID code */
#define ILI9341_DEVICE_CODE 0x00009341
#define ILI9341_DEVICE_CODE 0x9341
/* ILI9341 LCD Register Addresses *****************************************************/
@ -143,22 +143,22 @@
/* ILI9341 LCD Register Bit Definitions ***********************************************/
/* Memory Access control */
#define ILI9341_MEMORY_ACCESS_CONTROL_MY (1 << 7)
#define ILI9341_MEMORY_ACCESS_CONTROL_MX (1 << 6)
#define ILI9341_MEMORY_ACCESS_CONTROL_MV (1 << 5)
#define ILI9341_MEMORY_ACCESS_CONTROL_ML (1 << 4)
#define ILI9341_MEMORY_ACCESS_CONTROL_BGR (1 << 3)
#define ILI9341_MEMORY_ACCESS_CONTROL_MH (1 << 2)
#define ILI9341_MEMORY_ACCESS_CONTROL_MH (1 << 2) /* Horizontal refresh order */
#define ILI9341_MEMORY_ACCESS_CONTROL_BGR (1 << 3) /* RGB/BGR order */
#define ILI9341_MEMORY_ACCESS_CONTROL_ML (1 << 4) /* Vertical refresh order */
#define ILI9341_MEMORY_ACCESS_CONTROL_MV (1 << 5) /* Row/column exchange */
#define ILI9341_MEMORY_ACCESS_CONTROL_MX (1 << 6) /* Column address order */
#define ILI9341_MEMORY_ACCESS_CONTROL_MY (1 << 7) /* Row address order */
/* Display function control */
#define ILI9341_DISP_FUNC_CTL_REV (1 << 7)
#define ILI9341_DISP_FUNC_CTL_GS (1 << 6)
#define ILI9341_DISP_FUNC_CTL_SS (1 << 5)
#define ILI9341_DISP_FUNC_CTL_SM (1 << 4)
#define ILI9341_DISP_FUNC_CTL_ISC_SHIFT 0
#define ILI9341_DISP_FUNC_CTL_ISC_MASK (15 << 0)
#define ILI9341_DISP_FUNC_CTL_ISC_SHIFT (0)
#define ILI9341_DISP_FUNC_CTL_ISC_MASK (15 << ILI9341_DISP_FUNC_CTL_ISC_SHIFT)
# define ILI9341_DISP_FUNC_CTL_ISC(n) ((n) << ILI9341_DISP_FUNC_CTL_ISC_SHIFT))
#define ILI9341_DISP_FUNC_CTL_SM (1 << 4)
#define ILI9341_DISP_FUNC_CTL_SS (1 << 5)
#define ILI9341_DISP_FUNC_CTL_GS (1 << 6)
#define ILI9341_DISP_FUNC_CTL_REV (1 << 7)
/**************************************************************************************
* Public Types