summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2014-07-12 08:05:22 -0600
committerGregory Nutt <gnutt@nuttx.org>2014-07-12 08:05:22 -0600
commit9565a80fb8b2d64660ba2354b63d69475bfa30e4 (patch)
tree9c42fc03dd4a25886fdcfc5dda8b50a71eaa5dee
parent1a9552fd99b76cd489eebc4dee82ceceee362515 (diff)
downloadnuttx-9565a80fb8b2d64660ba2354b63d69475bfa30e4.tar.gz
nuttx-9565a80fb8b2d64660ba2354b63d69475bfa30e4.tar.bz2
nuttx-9565a80fb8b2d64660ba2354b63d69475bfa30e4.zip
SAMA5D4-EK LCDC: Adding a delay after enabling the LCD solves lots of start-up timing issues
-rw-r--r--nuttx/arch/arm/src/sama5/sam_lcd.c14
-rw-r--r--nuttx/configs/sama5d4-ek/include/board.h11
2 files changed, 24 insertions, 1 deletions
diff --git a/nuttx/arch/arm/src/sama5/sam_lcd.c b/nuttx/arch/arm/src/sama5/sam_lcd.c
index 8674368ef..bd7fba9d0 100644
--- a/nuttx/arch/arm/src/sama5/sam_lcd.c
+++ b/nuttx/arch/arm/src/sama5/sam_lcd.c
@@ -1,7 +1,7 @@
/****************************************************************************
* arch/arm/src/sama5/sam_lcd.c
*
- * Copyright (C) 2013 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2013-2014 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* References:
@@ -2973,6 +2973,18 @@ int up_fbinitialize(void)
sam_show_hcr();
#endif
+#if defined(BOARD_LCDC_ENABLE_DELAY) && BOARD_LCDC_ENABLE_DELAY > 0
+ /* Delay a bit after enabling the LDC. I presume that a delay of a few
+ * frame times allows some unstable clocking to synchronize before we
+ * tart thrashing the framebuffer? But I am not sure why this is
+ * necessary and, in fact, is certainly not necessary in most LCDC
+ * configurations. Perhaps this delay would not be necessary if timings
+ * were more precise?
+ */
+
+ usleep(BOARD_LCDC_ENABLE_DELAY);
+#endif
+
/* Enable the backlight.
*
* REVISIT: Backlight level could be dynamically adjustable
diff --git a/nuttx/configs/sama5d4-ek/include/board.h b/nuttx/configs/sama5d4-ek/include/board.h
index 033b7ec1a..f9b51df65 100644
--- a/nuttx/configs/sama5d4-ek/include/board.h
+++ b/nuttx/configs/sama5d4-ek/include/board.h
@@ -203,6 +203,17 @@
#define BOARD_LCDC_PIXELCLOCK \
(BOARD_LCDC_HSPERIOD * BOARD_LCDC_VSPERIOD * BOARD_LCDC_FRAMERATE)
+/* This specifies a delay after enabling the LCDC. This was found
+ * experimentally and is very much a kludge. I presume that a delay of a
+ * couple of frame times allows some unstable clocking to synchronize before
+ * we start thrashing the framebuffer? But I am not sure why this is
+ * necessary and, in fact, is certainly not necessary in other LCDC
+ * configurations. Perhaps the delay would not be necessary if timings were
+ * more precise?
+ */
+
+#define BOARD_LCDC_ENABLE_DELAY (50*1000)
+
/* Backlight prescaler value and PWM output polarity */
#define BOARD_LCDC_PWMPS LCDC_LCDCFG6_PWMPS_DIV1