configs/lpcxpresso-lpc54628: Add the fb configuration testing the LCD. arch/arm/src/lpc54xx: Various fixes needed to get the fb configuration to build errorfree. The configuration is not functional as of this writing.

This commit is contained in:
Gregory Nutt 2017-12-13 09:18:16 -06:00
parent 48879933a9
commit f215660296
10 changed files with 190 additions and 43 deletions

View File

@ -723,18 +723,18 @@ config LPC54_LCD_BPP24_RGB565
bool "24 BPP, 5:6:5 mode"
depends on !LPC54_LCD_MONOCHROME && LPC54_LCD_TFTPANEL
---help---
16-bit color is, by default, provide on LCD VD0-VD15; 24-bit color
16-bit color is, by default, provided on LCD VD0-VD15; 24-bit color
is provided on VD0-23:
RRRRRGGG GGGB BBBB
........ RRRRRRRR GGGGGGGG BBBBBBBB
16-bit: RRRRRGGG GGGB BBBB
24-bit: ........ RRRRRRRR GGGGGGGG BBBBBBBB
This option selects an alternative pin configuration where 16-bit
RGB565 is provided on VD3-7, VD10-15, and VD19-23. This essentially
accepts 32-bit RGB888 color as input but only uses the RGB565 color
resolution:
........ RRRRR... GGGGGG.. BBBBB...
24-bit: ........ RRRRR... GGGGGG.. BBBBB...
config LPC54_LCD_BPP24
bool "24 BPP, 8:8:8 mode"

View File

@ -46,6 +46,7 @@
#include <nuttx/arch.h>
#include <nuttx/board.h>
#include <nuttx/kmalloc.h>
#include <nuttx/userspace.h>
#include "up_arch.h"
@ -103,7 +104,7 @@
# if defined(CONFIG_LPC54_EMC_STATIC_CS1) && CONFIG_LPC54_EMC_STATIC_CS1_SIZE > 0
# define HAVE_STATIC_CS1 1
# endif
# if defined(CONFIG_LPC54_EMC_STATIC_CS0) && CONFIG_LPC54_EMC_STATIC_CS0_SIZE > 0
# if defined(CONFIG_LPC54_EMC_STATIC_CS2) && CONFIG_LPC54_EMC_STATIC_CS2_SIZE > 0
# define HAVE_STATIC_CS2 1
# endif
# if defined(CONFIG_LPC54_EMC_STATIC_CS3) && CONFIG_LPC54_EMC_STATIC_CS3_SIZE > 0
@ -117,7 +118,7 @@
# if defined(CONFIG_LPC54_EMC_DYNAMIC_CS1) && CONFIG_LPC54_EMC_DYNAMIC_CS1_SIZE > 0
# define HAVE_DYNAMIC_CS1 1
# endif
# if defined(CONFIG_LPC54_EMC_DYNAMIC_CS0) && CONFIG_LPC54_EMC_DYNAMIC_CS0_SIZE > 0
# if defined(CONFIG_LPC54_EMC_DYNAMIC_CS2) && CONFIG_LPC54_EMC_DYNAMIC_CS2_SIZE > 0
# define HAVE_DYNAMIC_CS2 1
# endif
# if defined(CONFIG_LPC54_EMC_DYNAMIC_CS3) && CONFIG_LPC54_EMC_DYNAMIC_CS3_SIZE > 0
@ -126,7 +127,6 @@
# endif /* CONFIG_LPC54_EMC_DYNAMIC */
#endif /* CONFIG_LPC54_EMC */
/****************************************************************************
* Public Data
****************************************************************************/
@ -271,7 +271,7 @@ void up_addregion(void)
heapstart = (FAR void *)(LPC54_SRAMCS0_BASE + CONFIG_LPC54_EMC_STATIC_CS0_OFFSET);
heapsize = CONFIG_LPC54_EMC_STATIC_CS0_SIZE;
mem_addregion(heapstart, heapsize);
kumm_addregion(heapstart, heapsize);
#if defined(CONFIG_BUILD_PROTECTED) && defined(CONFIG_MM_KERNEL_HEAP)
/* Allow user-mode access to the SDRAM heap */
@ -289,7 +289,7 @@ void up_addregion(void)
heapstart = (FAR void *)(LPC54_SRAMCS1_BASE + CONFIG_LPC54_EMC_STATIC_CS1_OFFSET);
heapsize = CONFIG_LPC54_EMC_STATIC_CS1_SIZE;
mem_addregion(heapstart, heapsize);
kumm_addregion(heapstart, heapsize);
#if defined(CONFIG_BUILD_PROTECTED) && defined(CONFIG_MM_KERNEL_HEAP)
/* Allow user-mode access to the SDRAM heap */
@ -307,7 +307,7 @@ void up_addregion(void)
heapstart = (FAR void *)(LPC54_SRAMCS2_BASE + CONFIG_LPC54_EMC_STATIC_CS2_OFFSET);
heapsize = CONFIG_LPC54_EMC_STATIC_CS2_SIZE;
mem_addregion(heapstart, heapsize);
kumm_addregion(heapstart, heapsize);
#if defined(CONFIG_BUILD_PROTECTED) && defined(CONFIG_MM_KERNEL_HEAP)
/* Allow user-mode access to the SDRAM heap */
@ -325,7 +325,7 @@ void up_addregion(void)
heapstart = (FAR void *)(LPC54_SRAMCS3_BASE + CONFIG_LPC54_EMC_STATIC_CS3_OFFSET);
heapsize = CONFIG_LPC54_EMC_STATIC_CS3_SIZE;
mem_addregion(heapstart, heapsize);
kumm_addregion(heapstart, heapsize);
#if defined(CONFIG_BUILD_PROTECTED) && defined(CONFIG_MM_KERNEL_HEAP)
/* Allow user-mode access to the SDRAM heap */
@ -341,9 +341,9 @@ void up_addregion(void)
{
/* Add the SDRAM to the user heap */
heapstart = (FAR void *)(LPC54_DRAMCS2_BASE + CONFIG_LPC54_EMC_DYNAMIC_CS0_OFFSET);
heapstart = (FAR void *)(LPC54_DRAMCS0_BASE + CONFIG_LPC54_EMC_DYNAMIC_CS0_OFFSET);
heapsize = CONFIG_LPC54_EMC_DYNAMIC_CS0_SIZE;
mem_addregion(heapstart, heapsize);
kumm_addregion(heapstart, heapsize);
#if defined(CONFIG_BUILD_PROTECTED) && defined(CONFIG_MM_KERNEL_HEAP)
/* Allow user-mode access to the SDRAM heap */
@ -361,7 +361,7 @@ void up_addregion(void)
heapstart = (FAR void *)(LPC54_DRAMCS1_BASE + CONFIG_LPC54_EMC_DYNAMIC_CS1_OFFSET);
heapsize = CONFIG_LPC54_EMC_DYNAMIC_CS1_SIZE;
mem_addregion(heapstart, heapsize);
kumm_addregion(heapstart, heapsize);
#if defined(CONFIG_BUILD_PROTECTED) && defined(CONFIG_MM_KERNEL_HEAP)
/* Allow user-mode access to the SDRAM heap */
@ -379,7 +379,7 @@ void up_addregion(void)
heapstart = (FAR void *)(LPC54_DRAMCS2_BASE + CONFIG_LPC54_EMC_DYNAMIC_CS2_OFFSET);
heapsize = CONFIG_LPC54_EMC_DYNAMIC_CS2_SIZE;
mem_addregion(heapstart, heapsize);
kumm_addregion(heapstart, heapsize);
#if defined(CONFIG_BUILD_PROTECTED) && defined(CONFIG_MM_KERNEL_HEAP)
/* Allow user-mode access to the SDRAM heap */
@ -397,7 +397,7 @@ void up_addregion(void)
heapstart = (FAR void *)(LPC54_DRAMCS3_BASE + CONFIG_LPC54_EMC_DYNAMIC_CS3_OFFSET);
heapsize = CONFIG_LPC54_EMC_DYNAMIC_CS3_SIZE;
mem_addregion(heapstart, heapsize);
kumm_addregion(heapstart, heapsize);
#if defined(CONFIG_BUILD_PROTECTED) && defined(CONFIG_MM_KERNEL_HEAP)
/* Allow user-mode access to the SDRAM heap */

View File

@ -4,6 +4,9 @@
* Copyright (C) 2017 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* This driver derives from the LPC1788 LCD driver. The LPC1788 LCD is
* identical tot he LPC54628 LCD other than some minor clocking differences.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@ -45,13 +48,15 @@
#include <debug.h>
#include <nuttx/video/fb.h>
#include <arch/board/board.h>
#include "up_arch.h"
#include "chip/lpc54_syscon.h"
#include "chip/lpc54_pinmux.h"
#include "lpc54_gpio.h"
#include "lpc54_lcd.h"
#include <arch/board/board.h>
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
@ -474,8 +479,6 @@ int up_fbinitialize(int display)
uint32_t lcddiv;
int i;
lcdinfo("Entry\n");
/* Configure pins */
/* LCD panel data. Pins used depend on the panel configuration */
@ -503,12 +506,12 @@ int up_fbinitialize(int display)
lpc54_gpio_config(GPIO_LCD_VD14);
lpc54_gpio_config(GPIO_LCD_VD15);
#if LPC54_BPP > 16 && !defined(CONFIG_LPC54_LCD_BPP24_RGB565)
#if LPC54_BPP > 16
#ifndef CONFIG_LPC54_LCD_BPP24_RGB565
lpc54_gpio_config(GPIO_LCD_VD16);
lpc54_gpio_config(GPIO_LCD_VD17);
lpc54_gpio_config(GPIO_LCD_VD18);
#endif
#if LPC54_BPP > 16
lpc54_gpio_config(GPIO_LCD_VD19);
lpc54_gpio_config(GPIO_LCD_VD20);
lpc54_gpio_config(GPIO_LCD_VD21);
@ -531,7 +534,7 @@ int up_fbinitialize(int display)
lpc54_gpio_config(GPIO_LCD_CLKIN); /* Optional clock input */
#endif
/* Route Main clock (or LCK CLKIN) to LCD. */
/* Route Main clock (or LCK CLKIN) to the LCD. */
#ifdef CONFIG_LPC54_LCD_USE_CLKIN
putreg32(SYSCON_LCDCLKSEL_LCDCLKIN, LPC54_SYSCON_LCDCLKSEL);
@ -551,7 +554,7 @@ int up_fbinitialize(int display)
putreg32(LCD_INTCLR_ALL, LPC54_LCD_INTCLR);
/* Disable GLCD controller */
/* Disable the LCD controller */
putreg32(0, LPC54_LCD_CTRL);
@ -559,9 +562,9 @@ int up_fbinitialize(int display)
#ifdef CONFIG_LPC54_LCD_USE_CLKIN
lcddiv = ((uint32_t)CONFIG_LPC54_LCD_CLKIN_FREQUENCY /
(uint32_t)LPC54_LCD_PIXEL_CLOCK) + 1
(uint32_t)LPC54_LCD_PIXEL_CLOCK) + 1;
#else
lcddiv = ((uint32_t)BOARD_MAIN_CLK / (uint32_t)LPC54_LCD_PIXEL_CLOCK) + 1
lcddiv = ((uint32_t)BOARD_MAIN_CLK / (uint32_t)LPC54_LCD_PIXEL_CLOCK) + 1;
#endif
putreg32(lcddiv, LPC54_SYSCON_LCDCLKDIV);
putreg32(lcddiv | SYSCON_LCDCLKDIV_REQFLAG, LPC54_SYSCON_LCDCLKDIV);
@ -654,7 +657,10 @@ int up_fbinitialize(int display)
(CONFIG_LPC54_LCD_VBACKPORCH) << LCD_TIMV_VBP_SHIFT);
putreg32(regval, LPC54_LCD_TIMV);
/* Initialize clock and signal polarity */
/* Initialize clock and signal polarity.
*
* REVISIT: These need to be configurable.
*/
regval = getreg32(LPC54_LCD_POL);
@ -681,10 +687,6 @@ int up_fbinitialize(int display)
/* LCD_ENAB_M is active high */
regval &= ~LCD_POL_IOE;
/* Select CCLK for the LCD block clock source */
regval &= ~LCD_POL_CLKSEL;
putreg32(regval, LPC54_LCD_POL);
/* Frame base address doubleword aligned */

View File

@ -321,10 +321,10 @@ static const struct uart_config_s g_console_config=
static void lp54_setbaud(uintptr_t base, FAR const struct uart_config_s *config)
{
uint32_t bestdiff = (uint32_t)-1;
uint32_t bestosr = 15;
uint32_t bestbrg = (uint32_t)-1;
uint32_t lastosr;
uint32_t lastbrg;
uint32_t bestosr = 15;
uint32_t bestbrg = (uint32_t)-1;
uint32_t lastosr = 0; /* Initialized only to avoid warnings */
uint32_t lastbrg = 0;
uint32_t osr;
uint32_t brg;
uint32_t diff;

View File

@ -38,8 +38,11 @@ STATUS
external SDRAM to the system heap. Brought in the LPC1788 LCD driver.
The LPC1788 LCD registers are identical to the LPC54xx (other than a
minor clock source setting). That port required modifications only
for differences in some SYSCON and pin-related settings. No testing
has yet been performed.
for differences in some SYSCON and pin-related settings.
2017-12-13: Created the fb configuration for testing the LCD. Only
minimal testing has been performed. As of this writing, there is
no video output from the apps/examples/fb test: The backlight is on
but the display is blank/white.
Configurations
==============
@ -100,6 +103,29 @@ Configurations
Configuration sub-directories
-----------------------------
fb:
A simple NSH configuration used for some basic debug of LCD using the
framebuffer character drivers. This configuration provides the test
programs:
- apps/examples/pdcurses, and
- apps/examples/fb
as NSH built-in applications.
NOTES:
1, This configuration enables SDRAM to hold the LCD framebuffer and
enables the LPC54xx LCD driver in order to support the LPCXpresso's
TFT panel. In this configuration, the framebuffer resides in the
the lower half megabyte of SDRAM beginning at address 0xa0000000
(only 522,240 bytes actually used for the framebuffer). The
remainder of the SDRAM from 0xa0080000 up to 0xa1000000 is added
to the heap.
2. The pdcurses test relies on some positional input device and so
is not yet usable.
nsh:
Configures the NuttShell (nsh) application located at examples/nsh.

View File

@ -0,0 +1,63 @@
# CONFIG_ARCH_FPU is not set
CONFIG_ARCH_BOARD_LPCXPRESSO_LPC54628=y
CONFIG_ARCH_BOARD="lpcxpresso-lpc54628"
CONFIG_ARCH_CHIP_LPC54628=y
CONFIG_ARCH_CHIP_LPC54XX=y
CONFIG_ARCH_STACKDUMP=y
CONFIG_ARCH_STDARG_H=y
CONFIG_ARCH="arm"
CONFIG_BOARD_LOOPSPERMSEC=18535
CONFIG_BUILTIN=y
CONFIG_DRIVERS_VIDEO=y
CONFIG_EXAMPLES_FB=y
CONFIG_EXAMPLES_NSH=y
CONFIG_EXAMPLES_PDCURSES=y
CONFIG_FAT_LCNAMES=y
CONFIG_FAT_LFN=y
CONFIG_FS_FAT=y
CONFIG_FS_PROCFS=y
CONFIG_GRAPHICS_PDCURSES=y
CONFIG_LPC54_EMC_DYNAMIC_CS0_OFFSET=0x00080000
CONFIG_LPC54_EMC_DYNAMIC_CS0_SIZE=0x00f80000
CONFIG_LPC54_EMC_DYNAMIC_CS0=y
CONFIG_LPC54_EMC=y
CONFIG_LPC54_LCD_BPP24_RGB565=y
CONFIG_LPC54_LCD_HBACKPORCH=43
CONFIG_LPC54_LCD_HFRONTPORCH=8
CONFIG_LPC54_LCD_VBACKPORCH=12
CONFIG_LPC54_LCD_VFRONTPORCH=4
CONFIG_LPC54_LCD_VPULSE=10
CONFIG_LPC54_LCD_VRAMBASE=0xa0000000
CONFIG_LPC54_LCD=y
CONFIG_LPC54_USART0=y
CONFIG_MAX_TASKS=16
CONFIG_MAX_WDOGPARMS=2
CONFIG_MM_REGIONS=2
CONFIG_NFILE_DESCRIPTORS=8
CONFIG_NFILE_STREAMS=8
CONFIG_NSH_ARCHINIT=y
CONFIG_NSH_BUILTIN_APPS=y
CONFIG_NSH_DISABLE_IFUPDOWN=y
CONFIG_NSH_FILEIOSIZE=512
CONFIG_NSH_LINELEN=64
CONFIG_NSH_READLINE=y
CONFIG_PDCURSES_COLORFMT_RGB888=y
CONFIG_PDCURSES_FONT_6X9=y
CONFIG_PREALLOC_MQ_MSGS=4
CONFIG_PREALLOC_TIMERS=4
CONFIG_PREALLOC_WDOGS=4
CONFIG_RAM_SIZE=32768
CONFIG_RAM_START=0x10000000
CONFIG_RAW_BINARY=y
CONFIG_RR_INTERVAL=200
CONFIG_SCHED_WAITPID=y
CONFIG_SDCLONE_DISABLE=y
CONFIG_START_DAY=13
CONFIG_START_MONTH=12
CONFIG_SYMTAB_ORDEREDBYNAME=y
CONFIG_SYSTEM_RAMTEST=y
CONFIG_TASK_NAME_SIZE=0
CONFIG_USART0_SERIAL_CONSOLE=y
CONFIG_USER_ENTRYPOINT="nsh_main"
CONFIG_VIDEO_FB=y
CONFIG_WDOG_INTRESERVE=0

View File

@ -237,7 +237,28 @@
*/
/* Button definitions *******************************************************/
/* To be provided */
/* The LPCXpresso has four switches:
*
* SW2 ISP2 P0.6
* SW3 ISP1 P0.5
* SW4 ISP0 P0.4
* SW5 User Button P1.1
*
* In all cased, the signal is low when the button is pressed.
*
* SW2, SW3, SW4 can be used to force the LPC546xx in to ISP boot modes.
* After boot these buttons could be used as user buttons. However, they are
* not available when the on-board SRDRAM is used because P0.4, P0.5, and
* P0.6 are also used as EMC_D2, EMC_D3, and EMC_D4, respectively.
*
* So SW5 is really the only button that that is generally available for
* software usage.
*/
#define BOARD_BUTTON_USER 0
#define BOARD_NUM_BUTTONS 1
#define BOARD_BUTTON_USER_BIT (1 << BOARD_BUTTON_USER)
/* Pin Disambiguation *******************************************************/
/* Flexcomm0/USART0
@ -249,10 +270,17 @@
* BRIDGE_UART_TXD <- P0_30-ISP_FC0_TXD <- P0.30 GPIO_FC0_TXD_SCL_MISO_2
*/
#ifdef CONFIG_LPC54_USART0
# define GPIO_USART0_RXD (GPIO_FC0_RXD_SDA_MOSI_2 | GPIO_FILTER_OFF)
# define GPIO_USART0_TXD (GPIO_FC0_TXD_SCL_MISO_2 | GPIO_FILTER_OFF)
#endif
#define GPIO_USART0_RXD (GPIO_FC0_RXD_SDA_MOSI_2 | GPIO_FILTER_OFF)
#define GPIO_USART0_TXD (GPIO_FC0_TXD_SCL_MISO_2 | GPIO_FILTER_OFF)
/* LCD
*
* There are no alternatives for LCD pins except for the VD0-VD3 pins.
* VD0-VD2 are not used in this hardware configuration. VD3 is on
* P2.21.
*/
#define GPIO_LCD_VD3 GPIO_LCD_VD3_1
/****************************************************************************
* Public Types

View File

@ -43,6 +43,8 @@
#include <sys/mount.h>
#include <syslog.h>
#include <nuttx/video/fb.h>
#include "lpcxpresso-lpc54628.h"
/****************************************************************************
@ -77,6 +79,16 @@ int lpc54_bringup(void)
}
#endif
#ifdef CONFIG_VIDEO_FB
/* Initialize and register the framebuffer driver */
ret = fb_register(0, 0);
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: fb_register() failed: %d\n", ret);
}
#endif
UNUSED(ret);
return OK;
}

View File

@ -67,7 +67,23 @@
GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_PUSHPULL | GPIO_PULLUP)
/* Button definitions *******************************************************/
/* to be provided */
/* The LPCXpresso has four switches:
*
* SW2 ISP2 P0.6
* SW3 ISP1 P0.5
* SW4 ISP0 P0.4
* SW5 User Button P1.1
*
* In all cased, the signal is low when the button is pressed.
*
* SW2, SW3, SW4 can be used to force the LPC546xx in to ISP boot modes.
* After boot these buttons could be used as user buttons. However, they are
* not available when the on-board SRDRAM is used because P0.4, P0.5, and
* P0.6 are also used as EMC_D2, EMC_D3, and EMC_D4, respectively.
*
* So SW5 is really the only button that that is generally available for
* software usage.
*/
/* LCD/TSC definitions ******************************************************/
/* The backlight is controlled by P3.31 and is intended to connect via PWM

View File

@ -375,7 +375,7 @@
#define GPIO_LCD_VD6 GPIO_LCD_VD6_2
#define GPIO_LCD_VD7 GPIO_LCD_VD7_2
/* LED G:
/* LCD G:
*
* VD8 --- Connected to P0[6]
* VD9 --- Connected to P0[7]