summaryrefslogtreecommitdiff
path: root/nuttx/configs
diff options
context:
space:
mode:
Diffstat (limited to 'nuttx/configs')
-rw-r--r--nuttx/configs/stm32f4discovery/README.txt67
-rw-r--r--nuttx/configs/stm32f4discovery/include/board.h2
-rw-r--r--nuttx/configs/stm32f4discovery/nxlines/defconfig2
-rw-r--r--nuttx/configs/stm32f4discovery/src/stm32f4discovery-internal.h25
-rw-r--r--nuttx/configs/stm32f4discovery/src/up_spi.c86
-rw-r--r--nuttx/configs/stm32f4discovery/src/up_ug2864ambag01.c114
6 files changed, 204 insertions, 92 deletions
diff --git a/nuttx/configs/stm32f4discovery/README.txt b/nuttx/configs/stm32f4discovery/README.txt
index c193a1f42..896bf3662 100644
--- a/nuttx/configs/stm32f4discovery/README.txt
+++ b/nuttx/configs/stm32f4discovery/README.txt
@@ -2,7 +2,7 @@ README
======
This README discusses issues unique to NuttX configurations for the
-STMicro STM32F4 Discovery development board.
+STMicro STM32F4Discovery development board.
Contents
========
@@ -20,6 +20,7 @@ Contents
- FPU
- FSMC SRAM
- SSD1289
+ - UG-2864AMBAG01
- STM32F4Discovery-specific Configuration Options
- Configurations
@@ -564,7 +565,7 @@ by the "Lite" version of the Atollic toolchain.
SSD1289
=======
-I purchased an LCD display on eBay from china. The LCD is 320x240 RGB565 and
+I purchased an LCD display on eBay from China. The LCD is 320x240 RGB565 and
is based on an SSD1289 LCD controller and an XPT2046 touch IC. The pin out
from the 2x16 connect on the LCD is labeled as follows:
@@ -702,6 +703,31 @@ The following summarize the bit banging oprations:
WriteData(data);
}
+UG-2864AMBAG01
+==============
+
+I purchased an OLED display on eBay. The OLDE is 128x64 monochrome and
+is based on an UG-2864AMBAG01 OLED controller. The OLED can run in either
+parallel or SPI mode. I am using SPI mode. In SPI mode, the OLED is
+write only so the driver keeps a 128*64/8 = 1KB framebuffer to remember
+the display contents:
+
+Here is how I have the OLED connected. But you can change this with the
+settings in include/board.h and src/stm324fdiscovery-internal.h:
+
+ Connector CON10 J1: STM32F4Discovery
+
+ 1 3v3 P2 3V
+ 3 RESET P2 PB6 (Arbitrary selection)
+ 5 CS P3 PB7 (Arbitrary selection)
+ 7 A0 P2 PB8 (Arbitrary selection)
+ 9 LED+ (N/C) -----
+ 2 5V Vcc P2 5V
+ 4 DI P1 PA7 (GPIO_SPI1_MOSI == GPIO_SPI1_MOSI_1)
+ 6 SCLK P1 PA5 (GPIO_SPI1_SCK == GPIO_SPI1_SCK_1)
+ 8 LED- (N/C) ------
+ 10 GND P2 GND
+
STM32F4Discovery-specific Configuration Options
===============================================
@@ -1318,6 +1344,43 @@ Where <subdir> is one of the following:
b. Execute 'make menuconfig' in nuttx/ in order to start the
reconfiguration process.
+ 3. This configured can be re-configured to use the UG-2864AMBAG01
+ 0.96 inch OLED by adding or changing the following items int
+ the configuration (using 'make menuconfig'):
+
+ +CONFIG_SPI_CMDDATA=y
+
+ -CONFIG_LCD_MAXCONTRAST=1
+ -CONFIG_LCD_MAXPOWER=255
+ +CONFIG_LCD_MAXCONTRAST=255
+ +CONFIG_LCD_MAXPOWER=1
+
+ -CONFIG_LCD_SSD1289=y
+ -CONFIG_SSD1289_PROFILE1=y
+ +CONFIG_LCD_UG2864AMBAG01=y
+ +CONFIG_UG2864AMBAG01_SPIMODE=3
+ +CONFIG_UG2864AMBAG01_FREQUENCY=3500000
+ +CONFIG_UG2864AMBAG01_NINTERFACES=1
+
+ -CONFIG_NX_DISABLE_1BPP=y
+ +CONFIG_NX_DISABLE_16BPP=y
+
+ -CONFIG_EXAMPLES_NXLINES_BGCOLOR=0x0320
+ -CONFIG_EXAMPLES_NXLINES_LINEWIDTH=16
+ -CONFIG_EXAMPLES_NXLINES_LINECOLOR=0xffe0
+ -CONFIG_EXAMPLES_NXLINES_BORDERWIDTH=4
+ -CONFIG_EXAMPLES_NXLINES_BORDERCOLOR=0xffe0
+ -CONFIG_EXAMPLES_NXLINES_CIRCLECOLOR=0xf7bb
+ -CONFIG_EXAMPLES_NXLINES_BPP=16
+ +CONFIG_EXAMPLES_NXLINES_BGCOLOR=0x00
+ +CONFIG_EXAMPLES_NXLINES_LINEWIDTH=4
+ +CONFIG_EXAMPLES_NXLINES_LINECOLOR=0x01
+ +CONFIG_EXAMPLES_NXLINES_BORDERWIDTH=2
+ +CONFIG_EXAMPLES_NXLINES_BORDERCOLOR=0x01
+ +CONFIG_EXAMPLES_NXLINES_CIRCLECOLOR=0x00
+ +CONFIG_EXAMPLES_NXLINES_BPP=1
+ +CONFIG_EXAMPLES_NXLINES_EXTERNINIT=y
+
pm:
--
This is a configuration that is used to test STM32 power management, i.e.,
diff --git a/nuttx/configs/stm32f4discovery/include/board.h b/nuttx/configs/stm32f4discovery/include/board.h
index 01ae56b30..6171c3e40 100644
--- a/nuttx/configs/stm32f4discovery/include/board.h
+++ b/nuttx/configs/stm32f4discovery/include/board.h
@@ -224,7 +224,7 @@
#define GPIO_TIM4_CH2OUT GPIO_TIM4_CH2OUT_2
-/* SPI */
+/* SPI - There is a MEMS device on SPI1 using these pins: */
#define GPIO_SPI1_MISO GPIO_SPI1_MISO_1
#define GPIO_SPI1_MOSI GPIO_SPI1_MOSI_1
diff --git a/nuttx/configs/stm32f4discovery/nxlines/defconfig b/nuttx/configs/stm32f4discovery/nxlines/defconfig
index be71de2ad..286dd55ed 100644
--- a/nuttx/configs/stm32f4discovery/nxlines/defconfig
+++ b/nuttx/configs/stm32f4discovery/nxlines/defconfig
@@ -148,7 +148,7 @@ CONFIG_STM32_FSMC=y
# CONFIG_STM32_I2C2 is not set
# CONFIG_STM32_I2C3 is not set
# CONFIG_STM32_IWDG is not set
-CONFIG_STM32_OTGFS=y
+# CONFIG_STM32_OTGFS is not set
# CONFIG_STM32_OTGHS is not set
CONFIG_STM32_PWR=y
# CONFIG_STM32_RNG is not set
diff --git a/nuttx/configs/stm32f4discovery/src/stm32f4discovery-internal.h b/nuttx/configs/stm32f4discovery/src/stm32f4discovery-internal.h
index 2824cd2bd..0539442ca 100644
--- a/nuttx/configs/stm32f4discovery/src/stm32f4discovery-internal.h
+++ b/nuttx/configs/stm32f4discovery/src/stm32f4discovery-internal.h
@@ -113,6 +113,31 @@
# define GPIO_OTGFS_OVER (GPIO_INPUT|GPIO_FLOAT|GPIO_SPEED_100MHz|GPIO_PUSHPULL|GPIO_PORTD|GPIO_PIN5)
#endif
+/* UG-2864AMBAG01 OLED Display:
+ *
+ * Connector CON10 J1: STM32F4Discovery
+ *
+ * 1 3v3 P2 3V
+ * 3 RESET P2 PB6 (Arbitrary selection)
+ * 5 CS P3 PB7 (Arbitrary selection)
+ * 7 A0 P2 PB8 (Arbitrary selection)
+ * 9 LED+ (N/C) -----
+ * 2 5V Vcc P2 5V
+ * 4 DI P1 PA7 (GPIO_SPI1_MOSI == GPIO_SPI1_MOSI_1)
+ * 6 SCLK P1 PA5 (GPIO_SPI1_SCK == GPIO_SPI1_SCK_1)
+ * 8 LED- (N/C) ------
+ * 10 GND P2 GND
+ */
+
+#ifdef CONFIG_LCD_UG2864AMBAG01
+# define GPIO_OLED_RESET (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_50MHz|\
+ GPIO_OUTPUT_CLEAR|GPIO_PORTB|GPIO_PIN6)
+# define GPIO_OLED_CS (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_50MHz|\
+ GPIO_OUTPUT_SET|GPIO_PORTB|GPIO_PIN7)
+# define GPIO_OLED_A0 (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_50MHz|\
+ GPIO_OUTPUT_CLEAR|GPIO_PORTB|GPIO_PIN8)
+#endif
+
/****************************************************************************************************
* Public Types
****************************************************************************************************/
diff --git a/nuttx/configs/stm32f4discovery/src/up_spi.c b/nuttx/configs/stm32f4discovery/src/up_spi.c
index 3cf7d38b5..7ef3138fd 100644
--- a/nuttx/configs/stm32f4discovery/src/up_spi.c
+++ b/nuttx/configs/stm32f4discovery/src/up_spi.c
@@ -42,6 +42,7 @@
#include <stdint.h>
#include <stdbool.h>
+#include <errno.h>
#include <debug.h>
#include <nuttx/spi.h>
@@ -95,7 +96,11 @@
void weak_function stm32_spiinitialize(void)
{
#ifdef CONFIG_STM32_SPI1
- stm32_configgpio(GPIO_CS_MEMS);
+ (void)stm32_configgpio(GPIO_CS_MEMS);
+#endif
+#ifdef CONFIG_LCD_UG2864AMBAG01
+ (void)stm32_configgpio(GPIO_OLED_CS); /* OLED chip select */
+ (void)stm32_configgpio(GPIO_OLED_A0); /* OLED Command/Data */
#endif
}
@@ -129,12 +134,21 @@ void stm32_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool sele
{
spidbg("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
- stm32_gpiowrite(GPIO_CS_MEMS, !selected);
+#ifdef CONFIG_LCD_UG2864AMBAG01
+ if (devid == SPIDEV_DISPLAY)
+ {
+ stm32_gpiowrite(GPIO_OLED_CS, !selected);
+ }
+ else
+#endif
+ {
+ stm32_gpiowrite(GPIO_CS_MEMS, !selected);
+ }
}
uint8_t stm32_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
{
- return SPI_STATUS_PRESENT;
+ return 0;
}
#endif
@@ -146,7 +160,7 @@ void stm32_spi2select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool sele
uint8_t stm32_spi2status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
{
- return SPI_STATUS_PRESENT;
+ return 0;
}
#endif
@@ -158,8 +172,70 @@ void stm32_spi3select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool sele
uint8_t stm32_spi3status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
{
- return SPI_STATUS_PRESENT;
+ return 0;
+}
+#endif
+
+/****************************************************************************
+ * Name: stm32_spi1cmddata
+ *
+ * Description:
+ * Set or clear the SD1329 D/Cn bit to select data (true) or command
+ * (false). This function must be provided by platform-specific logic.
+ * This is an implementation of the cmddata method of the SPI
+ * interface defined by struct spi_ops_s (see include/nuttx/spi.h).
+ *
+ * Input Parameters:
+ *
+ * spi - SPI device that controls the bus the device that requires the CMD/
+ * DATA selection.
+ * devid - If there are multiple devices on the bus, this selects which one
+ * to select cmd or data. NOTE: This design restricts, for example,
+ * one one SPI display per SPI bus.
+ * cmd - true: select command; false: select data
+ *
+ * Returned Value:
+ * None
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_SPI_CMDDATA
+#ifdef CONFIG_STM32_SPI1
+int stm32_spi1cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+{
+#ifdef CONFIG_LCD_UG2864AMBAG01
+ if (devid == SPIDEV_DISPLAY)
+ {
+ /* "This is the Data/Command control pad which determines whether the
+ * data bits are data or a command.
+ *
+ * A0 = “H”: the inputs at D0 to D7 are treated as display data.
+ * A0 = “L”: the inputs at D0 to D7 are transferred to the command
+ * registers."
+ */
+
+ (void)stm32_gpiowrite(GPIO_OLED_A0, !cmd);
+ return OK;
+ }
+#endif
+
+ return -ENODEV;
+}
+#endif
+
+#ifdef CONFIG_STM32_SPI2
+int stm32_spi2cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+{
+ return -ENODEV;
+}
+#endif
+
+#ifdef CONFIG_STM32_SPI3
+int stm32_spi3cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+{
+ return -ENODEV;
}
#endif
+#endif /* CONFIG_SPI_CMDDATA */
#endif /* CONFIG_STM32_SPI1 || CONFIG_STM32_SPI2 */
diff --git a/nuttx/configs/stm32f4discovery/src/up_ug2864ambag01.c b/nuttx/configs/stm32f4discovery/src/up_ug2864ambag01.c
index 111ec8003..a012d7384 100644
--- a/nuttx/configs/stm32f4discovery/src/up_ug2864ambag01.c
+++ b/nuttx/configs/stm32f4discovery/src/up_ug2864ambag01.c
@@ -40,23 +40,22 @@
#include <nuttx/config.h>
-#include <stdio.h>
#include <debug.h>
-#include <errno.h>
#include <nuttx/spi.h>
#include <nuttx/lcd/lcd.h>
#include <nuttx/lcd/ug-2864ambag01.h>
+#include "stm32_gpio.h"
#include "stm32f4discovery-internal.h"
+#ifdef CONFIG_LCD_UG2864AMBAG01
+
/****************************************************************************
* Pre-Processor Definitions
****************************************************************************/
/* Configuration ************************************************************/
-/* This module is only built if CONFIG_NX_LCDDRIVER is selected. In this
- * case, it would be an error if SSP1 is not also enabled.
- */
+/* The pin configurations here require that SPI1 is selected */
#ifndef CONFIG_STM32_SPI1
# error "The OLED driver requires CONFIG_STM32_SPI1 in the configuration"
@@ -67,42 +66,32 @@
#endif
/* Pin Configuration ********************************************************/
-/* Connector CON10 J1:
+/* Connector CON10 J1: STM32F4Discovery
*
- * 1 3v3 2 5V Vcc
- * 3 RESET 4 DI
- * 5 CS 6 SCLK
- * 7 A0 8 LED- (N/C)
- * 9 LED+ (N/C) 9 GND
- */
-
-#define STM32_OLED_RESET
-#define STM32_OLED_A0
-
-/* Debug ********************************************************************/
-/* Define the CONFIG_DEBUG_LCD to enable detailed debug output (stuff you
- * would never want to see unless you are debugging this file).
+ * 1 3v3 P2 3V
+ * 3 RESET P2 PB6 (Arbitrary selection)
+ * 5 CS P3 PB7 (Arbitrary selection)
+ * 7 A0 P2 PB8 (Arbitrary selection)
+ * 9 LED+ (N/C) -----
+ * 2 5V Vcc P2 5V
+ * 4 DI P1 PA7 (GPIO_SPI1_MOSI == GPIO_SPI1_MOSI_1)
+ * 6 SCLK P1 PA5 (GPIO_SPI1_SCK == GPIO_SPI1_SCK_1)
+ * 8 LED- (N/C) ------
+ * 10 GND P2 GND
*
- * Verbose debug must also be enabled
+ * Note that the OLED CS and A0 are managed in the up_spi.c file.
*/
-#ifndef CONFIG_DEBUG
-# undef CONFIG_DEBUG_VERBOSE
-# undef CONFIG_DEBUG_GRAPHICS
-#endif
+/* Definitions in stm32f4discovery-internal.h */
-#ifndef CONFIG_DEBUG_VERBOSE
-# undef CONFIG_DEBUG_LCD
-#endif
+/* Debug ********************************************************************/
#ifdef CONFIG_DEBUG_LCD
-# define lcddbg(format, arg...) vdbg(format, ##arg)
-# define oleddc_dumpgpio(m) stm32_dumpgpio(STM32_OLED_POWER, m)
-# define oledcs_dumpgpio(m) stm32_dumpgpio(STM32_OLED_CS, m)
+# define lcddbg(format, arg...) dbg(format, ##arg)
+# define lcdvdbg(format, arg...) vdbg(format, ##arg)
#else
# define lcddbg(x...)
-# define oleddc_dumpgpio(m)
-# define oledcs_dumpgpio(m)
+# define lcdvdbg(x...)
#endif
/****************************************************************************
@@ -122,42 +111,36 @@ FAR struct lcd_dev_s *up_nxdrvinit(unsigned int devno)
FAR struct spi_dev_s *spi;
FAR struct lcd_dev_s *dev;
- /* Configure the OLED GPIOs. For the SPI interface, insert jumpers in J42,
- * J43, J45 pin1-2 and J46 pin 1-2.
+ /* Configure the OLED GPIOs. This initial configuration is RESET low,
+ * putting the OLED into reset state.
*/
- oledcs_dumpgpio("up_nxdrvinit: After OLED CS setup");
- oleddc_dumpgpio("up_nxdrvinit: On entry");
-
- (void)stm32_configgpio(STM32_OLED_RESET); /* OLED reset */
- (void)stm32_configgpio(STM32_OLED_A0); /* OLED Command/Data */
-
- oleddc_dumpgpio("up_nxdrvinit: After OLED GPIO setup");
+ (void)stm32_configgpio(GPIO_OLED_RESET);
/* Wait a bit then release the OLED from the reset state */
up_mdelay(20);
- stm32_gpiowrite(STM32_OLED_A0, true);
+ stm32_gpiowrite(GPIO_OLED_RESET, true);
- /* Get the SSI port (configure as a Freescale SPI port) */
+ /* Get the SPI1 port interface */
spi = up_spiinitialize(1);
if (!spi)
{
- glldbg("Failed to initialize SSI port 1\n");
+ lcddbg("Failed to initialize SPI port 1\n");
}
else
{
- /* Bind the SSI port to the OLED */
+ /* Bind the SPI port to the OLED */
dev = ug2864ambag01_initialize(spi, devno);
if (!dev)
{
- glldbg("Failed to bind SSI port 1 to OLED %d: %d\n", devno);
+ lcddbg("Failed to bind SPI port 1 to OLED %d: %d\n", devno);
}
else
{
- gllvdbg("Bound SSI port 1 to OLED %d\n", devno);
+ lcdvdbg("Bound SPI port 1 to OLED %d\n", devno);
/* And turn the OLED on */
@@ -168,39 +151,4 @@ FAR struct lcd_dev_s *up_nxdrvinit(unsigned int devno)
return NULL;
}
-
-/****************************************************************************
- * Name: stm32_ssp1cmddata
- *
- * Description:
- * Set or clear the SD1329 D/Cn bit to select data (true) or command
- * (false). This function must be provided by platform-specific logic.
- * This is an implementation of the cmddata method of the SPI
- * interface defined by struct spi_ops_s (see include/nuttx/spi.h).
- *
- * Input Parameters:
- *
- * spi - SPI device that controls the bus the device that requires the CMD/
- * DATA selection.
- * devid - If there are multiple devices on the bus, this selects which one
- * to select cmd or data. NOTE: This design restricts, for example,
- * one one SPI display per SPI bus.
- * cmd - true: select command; false: select data
- *
- * Returned Value:
- * None
- *
- ****************************************************************************/
-
-int stm32_ssp1cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
-{
- if (devid == SPIDEV_DISPLAY)
- {
- /* Set GPIO to 1 for data, 0 for command */
-
- (void)stm32_gpiowrite(STM32_OLED_A0, !cmd);
- return OK;
- }
-
- return -ENODEV;
-}
+#endif /* CONFIG_LCD_UG2864AMBAG01 */