Updates from Darcy Gong for UG-2864SWEG01 OLED

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5469 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo
2013-01-01 14:55:01 +00:00
parent e0eda5a191
commit bdc36db6a0
5 changed files with 39 additions and 23 deletions
+13 -8
View File
@@ -20,7 +20,7 @@ Contents
- FPU - FPU
- FSMC SRAM - FSMC SRAM
- SSD1289 - SSD1289
- UG-2864AMBAG01 - UG-2864AMBAG01 / UG-2964SWEG01
- STM32F4Discovery-specific Configuration Options - STM32F4Discovery-specific Configuration Options
- Configurations - Configurations
@@ -696,10 +696,10 @@ The following summarize the bit banging oprations:
WriteData(data); WriteData(data);
} }
UG-2864AMBAG01 UG-2864AMBAG01 / UG-2964SWEG01
============== ==============================
I purchased an OLED display on eBay. The OLDE is 128x64 monochrome and I purchased an OLED display on eBay. The OLED is 128x64 monochrome and
is based on an UG-2864AMBAG01 OLED controller. The OLED can run in either 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 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 write only so the driver keeps a 128*64/8 = 1KB framebuffer to remember
@@ -729,6 +729,10 @@ that I am using:
(1) Required because of on-board MEMS (1) Required because of on-board MEMS
------------------------------------------------------------------------- -------------------------------------------------------------------------
Darcy Gong recently added support for the UG-2964SWEG01 OLED which is also
an option with this configuratin. I have little technical information about
the UG-2964SWEG01 interface (see configs/stm32f4discovery/src/up_ug2864sweg01.c).
STM32F4Discovery-specific Configuration Options STM32F4Discovery-specific Configuration Options
=============================================== ===============================================
@@ -1347,9 +1351,10 @@ Where <subdir> is one of the following:
b. Execute 'make menuconfig' in nuttx/ in order to start the b. Execute 'make menuconfig' in nuttx/ in order to start the
reconfiguration process. reconfiguration process.
3. This configured can be re-configured to use the UG-2864AMBAG01 3. This configured can be re-configured to use either the
0.96 inch OLED by adding or changing the following items int UG-2864AMBAG01 or UG-2864SWEG01 0.96 inch OLEDs by adding
the configuration (using 'make menuconfig'): or changing the following items in the configuration (using
'make menuconfig'):
+CONFIG_SPI_CMDDATA=y +CONFIG_SPI_CMDDATA=y
@@ -1360,7 +1365,7 @@ Where <subdir> is one of the following:
-CONFIG_LCD_SSD1289=y -CONFIG_LCD_SSD1289=y
-CONFIG_SSD1289_PROFILE1=y -CONFIG_SSD1289_PROFILE1=y
+CONFIG_LCD_UG2864AMBAG01=y +CONFIG_LCD_UG2864AMBAG01=y : For the UG-2964AMBAG01
+CONFIG_UG2864AMBAG01_SPIMODE=3 +CONFIG_UG2864AMBAG01_SPIMODE=3
+CONFIG_UG2864AMBAG01_FREQUENCY=3500000 +CONFIG_UG2864AMBAG01_FREQUENCY=3500000
+CONFIG_UG2864AMBAG01_NINTERFACES=1 +CONFIG_UG2864AMBAG01_NINTERFACES=1
@@ -113,7 +113,7 @@
# define GPIO_OTGFS_OVER (GPIO_INPUT|GPIO_FLOAT|GPIO_SPEED_100MHz|GPIO_PUSHPULL|GPIO_PORTD|GPIO_PIN5) # define GPIO_OTGFS_OVER (GPIO_INPUT|GPIO_FLOAT|GPIO_SPEED_100MHz|GPIO_PUSHPULL|GPIO_PORTD|GPIO_PIN5)
#endif #endif
/* UG-2864AMBAG01 or UG-2864HSWEG01 OLED Display: /* UG-2864AMBAG01 or UG-2864HSWEG01 OLED Display (SPI 4-wire):
* *
* --------------------------+---------------------------------------------- * --------------------------+----------------------------------------------
* Connector CON10 J1: | STM32F4Discovery * Connector CON10 J1: | STM32F4Discovery
@@ -123,7 +123,7 @@
* 1 3v3 | 3,4 3v3 | P2 3V * 1 3v3 | 3,4 3v3 | P2 3V
* 3 /RESET | 8 /RESET | P2 PB6 (Arbitrary selection) * 3 /RESET | 8 /RESET | P2 PB6 (Arbitrary selection)
* 5 /CS | 7 /CS | P2 PB7 (Arbitrary selection) * 5 /CS | 7 /CS | P2 PB7 (Arbitrary selection)
* 7 A0 | 9 A0 | P2 PB8 (Arbitrary selection) * 7 A0|D/C | 9 A0|D/C | P2 PB8 (Arbitrary selection)
* 9 LED+ (N/C) | ----- | ----- * 9 LED+ (N/C) | ----- | -----
* 2 5V Vcc | 1,2 Vcc | P2 5V * 2 5V Vcc | 1,2 Vcc | P2 5V
* 4 DI | 18 D1/SI | P1 PA7 (GPIO_SPI1_MOSI == GPIO_SPI1_MOSI_1 (1)) * 4 DI | 18 D1/SI | P1 PA7 (GPIO_SPI1_MOSI == GPIO_SPI1_MOSI_1 (1))
@@ -142,6 +142,7 @@
GPIO_OUTPUT_SET|GPIO_PORTB|GPIO_PIN7) GPIO_OUTPUT_SET|GPIO_PORTB|GPIO_PIN7)
# define GPIO_OLED_A0 (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_50MHz|\ # define GPIO_OLED_A0 (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_50MHz|\
GPIO_OUTPUT_CLEAR|GPIO_PORTB|GPIO_PIN8) GPIO_OUTPUT_CLEAR|GPIO_PORTB|GPIO_PIN8)
# define GPIO_OLED_DC GPIO_OLED_A0
#endif #endif
/**************************************************************************************************** /****************************************************************************************************
+19 -9
View File
@@ -96,11 +96,16 @@
void weak_function stm32_spiinitialize(void) void weak_function stm32_spiinitialize(void)
{ {
#ifdef CONFIG_STM32_SPI1 #ifdef CONFIG_STM32_SPI1
(void)stm32_configgpio(GPIO_CS_MEMS); (void)stm32_configgpio(GPIO_CS_MEMS); /* MEMS chip select */
#endif #endif
#ifdef CONFIG_LCD_UG2864AMBAG01 #if defined(CONFIG_LCD_UG2864AMBAG01) || defined(CONFIG_LCD_UG2864HSWEG01)
(void)stm32_configgpio(GPIO_OLED_CS); /* OLED chip select */ (void)stm32_configgpio(GPIO_OLED_CS); /* OLED chip select */
# if defined(CONFIG_LCD_UG2864AMBAG01)
(void)stm32_configgpio(GPIO_OLED_A0); /* OLED Command/Data */ (void)stm32_configgpio(GPIO_OLED_A0); /* OLED Command/Data */
# endif
# if defined(CONFIG_LCD_UG2864HSWEG01)
(void)stm32_configgpio(GPIO_OLED_DC); /* OLED Command/Data */
# endif
#endif #endif
} }
@@ -134,7 +139,7 @@ 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"); spidbg("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
#ifdef CONFIG_LCD_UG2864AMBAG01 #if defined(CONFIG_LCD_UG2864AMBAG01) || defined(CONFIG_LCD_UG2864HSWEG01)
if (devid == SPIDEV_DISPLAY) if (devid == SPIDEV_DISPLAY)
{ {
stm32_gpiowrite(GPIO_OLED_CS, !selected); stm32_gpiowrite(GPIO_OLED_CS, !selected);
@@ -180,9 +185,9 @@ uint8_t stm32_spi3status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
* Name: stm32_spi1cmddata * Name: stm32_spi1cmddata
* *
* Description: * Description:
* Set or clear the SD1329 D/Cn bit to select data (true) or command * Set or clear the SH1101A A0 or SD1306 D/C n bit to select data (true)
* (false). This function must be provided by platform-specific logic. * or command (false). This function must be provided by platform-specific
* This is an implementation of the cmddata method of the SPI * logic. This is an implementation of the cmddata method of the SPI
* interface defined by struct spi_ops_s (see include/nuttx/spi.h). * interface defined by struct spi_ops_s (see include/nuttx/spi.h).
* *
* Input Parameters: * Input Parameters:
@@ -203,18 +208,23 @@ uint8_t stm32_spi3status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
#ifdef CONFIG_STM32_SPI1 #ifdef CONFIG_STM32_SPI1
int stm32_spi1cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd) int stm32_spi1cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
{ {
#ifdef CONFIG_LCD_UG2864AMBAG01 #if defined(CONFIG_LCD_UG2864AMBAG01) || defined(CONFIG_LCD_UG2864HSWEG01)
if (devid == SPIDEV_DISPLAY) if (devid == SPIDEV_DISPLAY)
{ {
/* "This is the Data/Command control pad which determines whether the /* "This is the Data/Command control pad which determines whether the
* data bits are data or a command. * data bits are data or a command.
* *
* A0 = “H”: the inputs at D0 to D7 are treated as display data. * 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 * A0 = "L": the inputs at D0 to D7 are transferred to the command
* registers." * registers."
*/ */
# if defined(CONFIG_LCD_UG2864AMBAG01)
(void)stm32_gpiowrite(GPIO_OLED_A0, !cmd); (void)stm32_gpiowrite(GPIO_OLED_A0, !cmd);
# endif
# if defined(CONFIG_LCD_UG2864HSWEG01)
(void)stm32_gpiowrite(GPIO_OLED_DC, !cmd);
# endif
return OK; return OK;
} }
#endif #endif
@@ -66,7 +66,7 @@
#endif #endif
/* Pin Configuration ********************************************************/ /* Pin Configuration ********************************************************/
/* UG-2864AMBAG01 OLED Display: /* UG-2864AMBAG01 OLED Display (SPI 4-wire):
* *
* --------------------------+---------------------------------------------- * --------------------------+----------------------------------------------
* Connector CON10 J1: | STM32F4Discovery * Connector CON10 J1: | STM32F4Discovery
@@ -66,7 +66,7 @@
#endif #endif
/* Pin Configuration ********************************************************/ /* Pin Configuration ********************************************************/
/* UG-2864AMBAG01 or UG-2864HSWEG01 OLED Display: /* UG-2864HSWEG01 OLED Display (SPI 4-wire):
* *
* --------------------------+---------------------------------------------- * --------------------------+----------------------------------------------
* Connector CON10 J1: | STM32F4Discovery * Connector CON10 J1: | STM32F4Discovery
@@ -76,7 +76,7 @@
* 1 3v3 | 3,4 3v3 | P2 3V * 1 3v3 | 3,4 3v3 | P2 3V
* 3 /RESET | 8 /RESET | P2 PB6 (Arbitrary selection) * 3 /RESET | 8 /RESET | P2 PB6 (Arbitrary selection)
* 5 /CS | 7 /CS | P2 PB7 (Arbitrary selection)(2) * 5 /CS | 7 /CS | P2 PB7 (Arbitrary selection)(2)
* 7 A0 | 9 A0 | P2 PB8 (Arbitrary selection)(2) * 7 D/C | 9 D/C | P2 PB8 (Arbitrary selection)(2)
* 9 LED+ (N/C) | ----- | ----- * 9 LED+ (N/C) | ----- | -----
* 2 5V Vcc | 1,2 Vcc | P2 5V * 2 5V Vcc | 1,2 Vcc | P2 5V
* 4 DI | 18 D1/SI | P1 PA7 (GPIO_SPI1_MOSI == GPIO_SPI1_MOSI_1 (1)) * 4 DI | 18 D1/SI | P1 PA7 (GPIO_SPI1_MOSI == GPIO_SPI1_MOSI_1 (1))
@@ -85,7 +85,7 @@
* 10 GND | 20 GND | P2 GND * 10 GND | 20 GND | P2 GND
* --------------+-----------+---------------------------------------------- * --------------+-----------+----------------------------------------------
* (1) Required because of on-board MEMS * (1) Required because of on-board MEMS
* (2) Note that the OLED CS and A0 are managed in the up_spi.c file. * (2) Note that the OLED CS and D/C are managed in the up_spi.c file.
* ------------------------------------------------------------------------- * -------------------------------------------------------------------------
*/ */