From ac77cce3913f23574d31a16c562bab35743af25a Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Tue, 31 Mar 2015 09:01:38 -0600 Subject: SAMV71-XULT: Add option to support connection of the maXTouch Xplained Pro on the 50-pin LCD connector --- nuttx/arch/arm/src/samv7/chip/samv71_pinmap.h | 4 +- nuttx/configs/samv71-xult/Kconfig | 7 +- nuttx/configs/samv71-xult/README.txt | 104 +++++++- nuttx/configs/samv71-xult/include/board.h | 84 ++++++- nuttx/configs/samv71-xult/src/atmxt-xpro.h | 345 ++++++++++++++++++++++++++ nuttx/configs/samv71-xult/src/sam_maxtouch.c | 1 + nuttx/configs/samv71-xult/src/samv71-xult.h | 169 ------------- 7 files changed, 524 insertions(+), 190 deletions(-) create mode 100644 nuttx/configs/samv71-xult/src/atmxt-xpro.h (limited to 'nuttx') diff --git a/nuttx/arch/arm/src/samv7/chip/samv71_pinmap.h b/nuttx/arch/arm/src/samv7/chip/samv71_pinmap.h index b49cde7f5..95b7a7c29 100644 --- a/nuttx/arch/arm/src/samv7/chip/samv71_pinmap.h +++ b/nuttx/arch/arm/src/samv7/chip/samv71_pinmap.h @@ -69,8 +69,6 @@ #define GPIO_AFE1_AD0 (GPIO_ALTERNATE | GPIO_PORT_PIOB | GPIO_PIN1) #define GPIO_AFE1_AD1 (GPIO_ALTERNATE | GPIO_PORT_PIOC | GPIO_PIN13) -#define GPIO_AFE1_AD10 (GPIO_ALTERNATE | GPIO_PORT_PIOE | GPIO_PIN3) -#define GPIO_AFE1_AD11 (GPIO_ALTERNATE | GPIO_PORT_PIOE | GPIO_PIN0) #define GPIO_AFE1_AD2 (GPIO_ALTERNATE | GPIO_PORT_PIOC | GPIO_PIN15) #define GPIO_AFE1_AD3 (GPIO_ALTERNATE | GPIO_PORT_PIOC | GPIO_PIN12) #define GPIO_AFE1_AD4 (GPIO_ALTERNATE | GPIO_PORT_PIOC | GPIO_PIN29) @@ -79,6 +77,8 @@ #define GPIO_AFE1_AD7 (GPIO_ALTERNATE | GPIO_PORT_PIOC | GPIO_PIN26) #define GPIO_AFE1_AD8 (GPIO_ALTERNATE | GPIO_PORT_PIOC | GPIO_PIN27) #define GPIO_AFE1_AD9 (GPIO_ALTERNATE | GPIO_PORT_PIOC | GPIO_PIN0) +#define GPIO_AFE1_AD10 (GPIO_ALTERNATE | GPIO_PORT_PIOE | GPIO_PIN3) +#define GPIO_AFE1_AD11 (GPIO_ALTERNATE | GPIO_PORT_PIOE | GPIO_PIN0) #define GPIO_DAC0 (GPIO_ALTERNATE | GPIO_PORT_PIOB | GPIO_PIN13) #define GPIO_DAC1 (GPIO_ALTERNATE | GPIO_PORT_PIOD | GPIO_PIN0) diff --git a/nuttx/configs/samv71-xult/Kconfig b/nuttx/configs/samv71-xult/Kconfig index 1730e1c70..b1e2cd175 100644 --- a/nuttx/configs/samv71-xult/Kconfig +++ b/nuttx/configs/samv71-xult/Kconfig @@ -16,10 +16,13 @@ choice default SAMV71XULT_MXTXPLND_EXT1 config SAMV71XULT_MXTXPLND_EXT1 - bool "Connected on EXT1" + bool "Connected on EXT1 (2x10 pin)" config SAMV71XULT_MXTXPLND_EXT2 - bool "Connected on EXT2" + bool "Connected on EXT2 (2x10 pin)" + +config SAMV71XULT_MXTXPLND_LCD + bool "Connected on LCD (50-pin)" endchoice # MaXTouch Xplained connection diff --git a/nuttx/configs/samv71-xult/README.txt b/nuttx/configs/samv71-xult/README.txt index 4549f11b3..a6ec3ec1a 100644 --- a/nuttx/configs/samv71-xult/README.txt +++ b/nuttx/configs/samv71-xult/README.txt @@ -697,12 +697,17 @@ additional settings. maXTouch Xplained Pro ===================== -Connectivity ------------- Testing has also been performed using the maXTouch Xplained Pro LCD -(ATMXT-XPRO). That LCD could be connected either via EXT1 or EXT2 using the 2x10 -20-pin cable and the maXTouch Xplained Pro standard extension header. Access -this then performed in SPI mode. +(ATMXT-XPRO). + +maXTouch Xplained Pro Standard Extension Header +----------------------------------------------- +The LCD could be connected either via EXT1 or EXT2 using the 2x10 20-pin +cable and the maXTouch Xplained Pro standard extension header. Access is +then performed in SPI mode. + +NOTE the 3 switch mode selector on the back of the maXtouch. All switches +should be in the ON position to select 4-wire SPI mode. ---- -------- ---- ----------- ---- ----------- ------------------------------------------ SAMV71-XULT maxTouch Xplained Pro @@ -731,15 +736,83 @@ this then performed in SPI mode. ---- -------- ---- ----------- ---- ----------- ------------------------------------------ NOTE: Use of EXT1 conflicts with the Arduino RXD pin (PD28). You cannot -put the maXTouch Xplained in EXT1 and also use the Arduion RXD/TXD pins +put the maXTouch Xplained in EXT1 and also use the Arduino RXD/TXD pins as your serial console. -It ought be possible to connect the LCD via the flat cable to the EXT4 LCD -connector. In this case, you would use the SMC to communicate with the LCD. -I have not tried this configuration. - -Configuration Options ---------------------- +maXTouch Xplained Pro Xplained Pro LCD Connector +------------------------------------------------ +It is also possible to connect the LCD via the flat cable to the EXT4 LCD +connector. In this case, you would use the SMC/EBI to communicate with the +LCD. + +NOTE: (1) Only the RGB interface is supported by the SAMV71-XULT and (2) the +3 switch mode selector on the back of the maXtouch. These switches should be +in the OFF-ON-OFF positions to select 16-bit color mode. + + ----------------- ------------- ----------------------------------------------------------- + LCD SAMV71 Description + Pin Function Pin Function + ---- ------------ ---- -------- ----------------------------------------------------------- + 1 ID - - Communication line to ID chip on extension board + 2 GND - GND Ground + 3 D0 PC0 D0 Data line + 4 D1 PC1 D1 Data line + 5 D2 PC2 D2 Data line + 6 D3 PC3 D3 Data line + 7 GND - GND Ground + 8 D4 PC4 D4 Data line + 9 D5 PC5 D5 Data line + 10 D6 PC6 D6 Data line + 11 D7 PC7 D7 Data line + 12 GND - GND Ground + 13 D8 PE0 D8 Data line + 14 D9 PE1 D9 Data line + 15 D10 PE2 D10 Data line + 16 D11 PE3 D11 Data line + 17 GND - GND Ground + 18 D12 PE4 D12 Data line + 19 D13 PE5 D13 Data line + 20 D14 PA15 D14 Data line + 21 D15 PA16 D15 Data line + 22 GND - GND Ground + 23 D16 - - Data line + 24 D17 - - Data line + 25 N/C - - + 26 N/C - - + 27 GND - GND Ground + 28 N/C - - + 29 N/C - - + 30 N/C - - + 31 N/C - - + 32 GND - GND Ground + 33 PCLK/ PC30 GPIO RGB: Pixel clock Display RAM select. + CMD_DATA_SEL MCU: One address line of the MCU for displays where it + is possible to select either the register or the + data interface + 34 VSYNC/CS PD19 NCS3 RGB: Vertical synchronization. + MCU: Chip select + 35 HSYNC/WE PC8 NWE RGB: Horizontal synchronization + MCU: Write enable signal + 36 DATA ENABLE/ PC11 NRD RGB: Data enable signal + RE MCU: Read enable signal + 37 SPI SCK - - MCU: Clock for SPI + 38 SPI MOSI - - MCU: Master out slave in line of SPI + 39 SPI MISO - - MCU: Master in slave out line of SPI + 40 SPI SS - - MCU: Slave select for SPI + 41 N/C - - + 42 TWI SDA PA3 TWD0 I2C data line (maXTouch®) + 43 TWI SCL PA4 TWCK0 I2C clock line (maXTouch) + 44 IRQ1 PD28 WKUP5 maXTouch interrupt line + 45 N/C PA2 WKUP2 + 46 PWM PC9 TIOB7 Backlight control + 47 RESET PC13 GPIO Reset for both display and maxTouch + 48 VCC - - 3.3V power supply for extension board + 49 VCC - - 3.3V power supply for extension board + 50 GND - - Ground + ---- ------------ ---- -------- ----------------------------------------------------------- + +MXI Configuration Options +------------------------- System Type -> SAMV7 Peripheral Support CONFIG_SAMV7_TWIHS0=y : Needed by the MaXTouch controller @@ -748,7 +821,8 @@ Configuration Options Board Selection -> CONFIG_SAMV71XULT_MXTXPLND=y : MaXTouch Xplained is connected CONFIG_SAMV71XULT_MXTXPLND_EXT1=y : Connected on EXT1, or - CONFIG_SAMV71XULT_MXTXPLND_EXT2=y : Connected on EXT2 + CONFIG_SAMV71XULT_MXTXPLND_EXT2=y : Connected on EXT2, or + CONFIG_SAMV71XULT_MXTXPLND_LCD=y : Connected on LCD CONFIG_SAMV71XULT_MXT_DEVMINOR=0 : Register as /dev/input0 CONFIG_SAMV71XULT_MXT_I2CFREQUENCY=400000 @@ -914,6 +988,10 @@ Configuration sub-directories CP2100CP programmable PLL, and 0x57 and 0x5f are the addresses of the AT2 EEPROM. I am not sure what the other address, 0x37, is). + STATUS: + 2015-03-30: Currently contains on a touchscreen test. The touchscreen + does not yet work. + netnsh: Configures the NuttShell (nsh) located at examples/nsh. There are three diff --git a/nuttx/configs/samv71-xult/include/board.h b/nuttx/configs/samv71-xult/include/board.h index 57f1a6703..64a07adab 100644 --- a/nuttx/configs/samv71-xult/include/board.h +++ b/nuttx/configs/samv71-xult/include/board.h @@ -339,9 +339,11 @@ /* maXTouch Xplained Pro LCD * + * maXTouch Xplained Pro Standard Extension Header + * ----------------------------------------------- * This LCD could be connected either via EXT1 or EXT2 using the 2x10 * 20-pin cable and the maXTouch Xplained Pro standard extension - * header. Access this then performed in SPI mode. + * header. Access is then performed in SPI mode. * * ---- -------- ---- ----------- ---- ----------- ------------------------------------------ * SAMV71-XULT maxTouch Xplained Pro @@ -374,19 +376,93 @@ */ #ifdef CONFIG_SAMV71XULT_MXTXLND -# ifdef CONFIG_SAMV71XULT_MXTXLND_EXT1 +# if defined(CONFIG_SAMV71XULT_MXTXLND_EXT1) # define GPIO_PWMC0_H0 GPIO_PWMC0_H0_1 # define GPIO_MXTXLND_PWM GPIO_PWMC0_H0_1 # define GPIO_SPI0_NPCS1 GPIO_SPI0_NPCS1_2 -# else /* CONFIG_SAMV71XULT_MXTXLND_EXT2 */ +# elif defined(CONFIG_SAMV71XULT_MXTXLND_EXT2) # define GPIO_PWMC0_H2 GPIO_PWMC0_H2_5 # define GPIO_MXTXLND_PWM GPIO_PWMC0_H2_5 +/* maXTouch Xplained Pro Xplained Pro LCD Connector + * ------------------------------------------------ + * It is also possible to connect the LCD via the flat cable to the EXT4 LCD + * connector. In this case, you would use the SMC/EBI to communicate with the + * LCD. + * + * ---- ------------ ---- -------- ----------------------------------------------------------- + * LCD SAMV71 Description + * Pin Function Pin Function + * ---- ------------ ---- -------- ----------------------------------------------------------- + * 1 ID - - Communication line to ID chip on extension board + * 2 GND - GND Ground + * 3 D0 PC0 D0 Data line + * 4 D1 PC1 D1 Data line + * 5 D2 PC2 D2 Data line + * 6 D3 PC3 D3 Data line + * 7 GND - GND Ground + * 8 D4 PC4 D4 Data line + * 9 D5 PC5 D5 Data line + * 10 D6 PC6 D6 Data line + * 11 D7 PC7 D7 Data line + * 12 GND - GND Ground + * 13 D8 PE0 D8 Data line + * 14 D9 PE1 D9 Data line + * 15 D10 PE2 D10 Data line + * 16 D11 PE3 D11 Data line + * 17 GND - GND Ground + * 18 D12 PE4 D12 Data line + * 19 D12 PE5 D13 Data line + * 20 D14 PA15 D14 Data line + * 21 D15 PA16 D15 Data line + * 22 GND - GND Ground + * 23 D16 - - Data line + * 24 D17 - - Data line + * 25 N/C - - + * 26 N/C - - + * 27 GND - GND Ground + * 28 N/C - - + * 29 N/C - - + * 30 N/C - - + * 31 N/C - - + * 32 GND - GND Ground + * 33 PCLK/ PC30 GPIO RGB: Pixel clock Display RAM select. + * CMD_DATA_SEL MCU: One address line of the MCU for displays where it + * is possible to select either the register or the + * data interface + * 34 VSYNC/CS PD19 NCS3 RGB: Vertical synchronization + * MCU: Chip select + * 35 HSYNC/WE PC8 NWE RGB: Horizontal synchronization + * MCU: Write enable signal + * 36 DATA ENABLE/ PC11 NRD RGB: Data enable signal + * RE MCU: Read enable signal + * 37 SPI SCK - - MCU: Clock for SPI + * 38 SPI MOSI - - MCU: Master out slave in line of SPI + * 39 SPI MISO - - MCU: Master in slave out line of SPI + * 40 SPI SS - - MCU: Slave select for SPI + * 41 N/C - - + * 42 TWI SDA PA3 TWD0 I2C data line (maXTouch®) + * 43 TWI SCL PA4 TWCK0 I2C clock line (maXTouch) + * 44 IRQ1 PD28 WKUP5 maXTouch interrupt line + * 45 N/C PA2 WKUP2 + * 46 PWM PC9 TIOB7 Backlight control + * 47 RESET PC13 GPIO Reset for both display and maxTouch + * 48 VCC - - 3.3V power supply for extension board + * 49 VCC - - 3.3V power supply for extension board + * 50 GND - - Ground + * ---- ------------ ---- -------- ----------------------------------------------------------- + * + * There are no alternatives for SMC/EBI, TWI0, or TIOB pins. No pin disambiguration + * is necessary. + */ + +# elif defined(CONFIG_SAMV71XULT_MXTXLND_LCD) + # endif -#endif +#endif /* CONFIG_SAMV71XULT_MXTXLND */ /************************************************************************************ * Public Types diff --git a/nuttx/configs/samv71-xult/src/atmxt-xpro.h b/nuttx/configs/samv71-xult/src/atmxt-xpro.h new file mode 100644 index 000000000..9eb018b42 --- /dev/null +++ b/nuttx/configs/samv71-xult/src/atmxt-xpro.h @@ -0,0 +1,345 @@ +/************************************************************************************ + * configs/samv71-xult/src/atmxt-xpro.h + * + * Copyright (C) 2015 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ************************************************************************************/ + +#ifndef __CONFIGS_ATMXT_XPRO_SRC_ATMXT_XPRO_H +#define __CONFIGS_ATMXT_XPRO_SRC_ATMXT_XPRO_H + +/************************************************************************************ + * Included Files + ************************************************************************************/ + +#include + +/************************************************************************************ + * Pre-processor Definitions + ************************************************************************************/ +/* Configuration ********************************************************************/ + +#define HAVE_MAXTOUCH 1 +#define HAVE_ILI9488_RGB 1 +#define HAVE_ILI9488_MCU 1 + +/* maXTouch and LCD only available if the maXTouch Xplained Pro is connected */ + +#ifndef CONFIG_SAMV71XULT_MXTXPLND +# undef HAVE_MAXTOUCH +# undef HAVE_ILI9488_RGB +# undef HAVE_ILI9488_MCU +#endif + +/* maXTouch is only available if the maXTouch driver is enabled */ + +#if defined(HAVE_MAXTOUCH) && !defined(CONFIG_INPUT_MXT) +# warning maXTouch support not enabled (CONFIG_INPUT_MXT) +# undef HAVE_MAXTOUCH +#endif + +/* The maXTouch interface requires TWIHS0 */ + +#if defined(HAVE_MAXTOUCH) && !defined(CONFIG_SAMV7_TWIHS0) +# warning maXTouch support requires TWIHS0 +# undef HAVE_MAXTOUCH +#endif + +/* Verify the maXTouch connector configuration */ + +#ifdef HAVE_MAXTOUCH +# if defined(CONFIG_SAMV71XULT_MXTXPLND_EXT1) +# ifndef CONFIG_SAMV7_GPIOD_IRQ +# warning maXTouch on EXT1 requires CONFIG_SAMV7_GPIOD_IRQ +# undef HAVE_MAXTOUCH +# endif +# elif defined(CONFIG_SAMV71XULT_MXTXPLND_EXT2) +# ifndef CONFIG_SAMV7_GPIOA_IRQ +# warning maXTouch on EXT1 requires CONFIG_SAMV7_GPIOA_IRQ +# undef HAVE_MAXTOUCH +# endif +# else +# warning maXTouch requires CONFIG_SAMV71XULT_MXTXPLND_EXT1 or EXT2 +# undef HAVE_MAXTOUCH +# endif +#endif + +/* LCD supports requires the ILI9488 driver */ + +#if (defined(HAVE_ILI9488_RGB) || defined(HAVE_ILI9488_MCU)) && !defined(CONFIG_LCD_ILI9488) +# undef HAVE_ILI9488_RGB +# undef HAVE_ILI9488_MCU +#endif + +/* ILI9488 RGB support requires the SMC/EBI interface */ + +#if defined(HAVE_ILI9488_RGB) && !defined(CONFIG_SAMV7_SMC) +# warning ILI9488 RGB support requires SMC +# undef HAVE_ILI9488_RGB +#endif + +/* ILI9488 MCU support requires SPI0 */ + +#if defined(HAVE_ILI9488_MCU) && !defined(CONFIG_SAMV7_SPI0) +# warning ILI9488 MCU support requires SPI0 +# undef HAVE_ILI9488_MCU +#endif + +/* Verify the ILI9488 MCU/SPI connector configuration */ + +#ifdef HAVE_ILI9488_MCU +# if !defined(CONFIG_SAMV71XULT_MXTXPLND_EXT1) && !defined(CONFIG_SAMV71XULT_MXTXPLND_EXT2) +# warning ILI9488 MCU requires CONFIG_SAMV71XULT_MXTXPLND_EXT1 or EXT2 +# undef HAVE_ILI9488_MCU +# endif +# ifdef CONFIG_SAMV71XULT_MXTXPLND_LCD +# warning ILI9488 MCU not available at the LCD connector +# undef HAVE_ILI9488_MCU +# endif +#endif + +/* Verify the ILI9488 RGB/SMC connector configuration */ + +#ifdef HAVE_ILI9488_RGB +# ifndef CONFIG_SAMV71XULT_MXTXPLND_LCD +# warning ILI9488 RGB requires CONFIG_SAMV71XULT_MXTXPLND_LCD +# undef HAVE_ILI9488_MCU +# endif +# if defined(CONFIG_SAMV71XULT_MXTXPLND_EXT1) ||defined(CONFIG_SAMV71XULT_MXTXPLND_EXT2) +# warning ILI9488 MCU not available at the EXT1 or EXT2 connectors +# undef HAVE_ILI9488_MCU +# endif +#endif + +/* SAMV71-XULT GPIO Pin Definitions *************************************************/ + +/* maXTouch Xplained Pro LCD + * + * maXTouch Xplained Pro Standard Extension Header + * ----------------------------------------------- + * This LCD could be connected either via EXT1 or EXT2 using the 2x10 + * 20-pin cable and the maXTouch Xplained Pro standard extension + * header. Access is then performed in SPI mode. + * + * ---- -------- ---- ----------- ---- ----------- ------------------------------------------ + * SAMV71-XULT maxTouch Xplained Pro + * PIN FUNCTION EXT1 FUNC EXT2 FUNC Description + * ---- -------- ---- ----------- ---- ----------- ------------------------------------------ + * 1 ID - - - - Communication line to ID chip + * 2 GND - - - - Ground + * 3 N/C PC31 - PD30 - + * 4 N/C PA19 - PC13 - + * 5 GPIO PB3 GPIO PA6 GPIO Command/Data Select + * 6 N/C PB2 - PD11 - + * 7 PWM PA0 PWMC0_PWMH0 PC19 PWMC0_PMWH2 Backlight control + * 8 N/C PC30 - PD26 - + * 9 GPIO/IRQ PD28 GPIO PA2 GPIO IRQ from maXTouch controller + * 10 GPIO PA5 GPIO PA24 GPIO RESET signal for maXTouch and LCD controller + * 11 I2C SDA PA3 TWID0 PA3 TWID0 I2C Data line for maXTouch controller + * 12 I2C SCL PA4 TWICK0 PA4 TWICK0 I2C Clock line for maXTouch controller + * 13 N/C PB0 - PA21 - + * 14 N/C PB1 - PB4 - + * 15 CS PD25 GPIO PD27 GPIO CS line for LCD controller + * 16 SPI MOSI PD21 SPI0_MOSI PD21 SPI0_MOSI SPI Data to LCD controller + * 17 SPI MISO PD20 SPI0_MISO PD20 SPI0_MISO SPI Data from LCD controller + * 18 SPI SCK PD22 SPI0_SPCK PD22 SPI0_SPCK SPI Clock line + * 19 GND - - - - Ground + * 20 VCC - - - - Target supply voltage + * ---- -------- ---- ----------- ---- ----------- ------------------------------------------ + */ + +#ifdef CONFIG_SAMV71XULT_MXTXPLND +# if defined(CONFIG_SAMV71XULT_MXTXPLND_EXT1) +# define GPIO_MXTXPLND_RESET \ + (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_SET | \ + GPIO_PORT_PIOA | GPIO_PIN5) +# define GPIO_ILI9488_BLOFF \ + (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_CLEAR | \ + GPIO_PORT_PIOA | GPIO_PIN0) + +# ifdef HAVE_MAXTOUCH +# define GPIO_MXT_CHG \ + (GPIO_INPUT | GPIO_CFG_PULLUP | GPIO_CFG_DEGLITCH | GPIO_INT_FALLING | \ + GPIO_PORT_PIOD | GPIO_PIN28) +# define IRQ_MXT_CHG \ + SAM_IRQ_PD28 +# endif /* HAVE_MAXTOUCH */ + +# ifdef HAVE_ILI9488_MCU +# define GPIO_ILI9488_CMDDAT \ + (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_CLEAR | \ + GPIO_PORT_PIOB | GPIO_PIN3) + +# define GPIO_ILI9488_CS \ + (PIO_OUTPUT | GPIO_CFG_PULLUP | GPIO_OUTPUT_SET | \ + GPIO_PORT_PIOD | GPIO_PIN25) +# define ILI9488_PORT \ + SPI0_CS1 +# endif /* HAVE_ILI9488_MCU */ + +# elif defined(CONFIG_SAMV71XULT_MXTXPLND_EXT2) +# define GPIO_MXTXPLND_RESET \ + (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_SET | \ + GPIO_PORT_PIOA | GPIO_PIN24) + +# define GPIO_ILI9488_BLOFF \ + (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_CLEAR | \ + GPIO_PORT_PIOC | GPIO_PIN19) + +# ifdef HAVE_MAXTOUCH +# define GPIO_MXT_CHG \ + (GPIO_INPUT | GPIO_CFG_PULLUP | GPIO_CFG_DEGLITCH | GPIO_INT_FALLING | \ + GPIO_PORT_PIOA | GPIO_PIN2) +# define IRQ_MXT_CHG \ + SAM_IRQ_PA2 +# endif /* HAVE_MAXTOUCH */ + +# ifdef HAVE_ILI9488_MCU +# define GPIO_ILI9488_CMDDAT \ + (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_CLEAR | \ + GPIO_PORT_PIOA | GPIO_PIN6) + +# define GPIO_ILI9488_CS \ + (PIO_OUTPUT | GPIO_CFG_PULLUP | GPIO_OUTPUT_SET | \ + GPIO_PORT_PIOD | GPIO_PIN27) +# define MXTXLPND_PORT \ + SPI0_CS3 +# endif /* HAVE_ILI9488_MCU */ + +/* maXTouch Xplained Pro Xplained Pro LCD Connector + * ------------------------------------------------ + * It is also possible to connect the LCD via the flat cable to the EXT4 LCD + * connector. In this case, you would use the SMC/EBI to communicate with the + * LCD. + * + * ---- ------------ ---- -------- ----------------------------------------------------------- + * LCD SAMV71 Description + * Pin Function Pin Function + * ---- ------------ ---- -------- ----------------------------------------------------------- + * 1 ID - - Communication line to ID chip on extension board + * 2 GND - GND Ground + * 3 D0 PC0 D0 Data line + * 4 D1 PC1 D1 Data line + * 5 D2 PC2 D2 Data line + * 6 D3 PC3 D3 Data line + * 7 GND - GND Ground + * 8 D4 PC4 D4 Data line + * 9 D5 PC5 D5 Data line + * 10 D6 PC6 D6 Data line + * 11 D7 PC7 D7 Data line + * 12 GND - GND Ground + * 13 D8 PE0 D8 Data line + * 14 D9 PE1 D9 Data line + * 15 D10 PE2 D10 Data line + * 16 D11 PE3 D11 Data line + * 17 GND - GND Ground + * 18 D12 PE4 D12 Data line + * 19 D12 PE5 D13 Data line + * 20 D14 PA15 D14 Data line + * 21 D15 PA16 D15 Data line + * 22 GND - GND Ground + * 23 D16 - - Data line + * 24 D17 - - Data line + * 25 N/C - - + * 26 N/C - - + * 27 GND - GND Ground + * 28 N/C - - + * 29 N/C - - + * 30 N/C - - + * 31 N/C - - + * 32 GND - GND Ground + * 33 PCLK/ PC30 GPIO RGB: Pixel clock Display RAM select. + * CMD_DATA_SEL MCU: One address line of the MCU for displays where it + * is possible to select either the register or the + * data interface + * 34 VSYNC/CS PD19 NCS3 RGB: Vertical synchronization + * MCU: Chip select + * 35 HSYNC/WE PC8 NWE RGB: Horizontal synchronization + * MCU: Write enable signal + * 36 DATA ENABLE/ PC11 NRD RGB: Data enable signal + * RE MCU: Read enable signal + * 37 SPI SCK - - MCU: Clock for SPI + * 38 SPI MOSI - - MCU: Master out slave in line of SPI + * 39 SPI MISO - - MCU: Master in slave out line of SPI + * 40 SPI SS - - MCU: Slave select for SPI + * 41 N/C - - + * 42 TWI SDA PA3 TWD0 I2C data line (maXTouch®) + * 43 TWI SCL PA4 TWCK0 I2C clock line (maXTouch) + * 44 IRQ1 PD28 WKUP5 maXTouch interrupt line + * 45 N/C PA2 WKUP2 + * 46 PWM PC9 TIOB7 Backlight control + * 47 RESET PC13 GPIO Reset for both display and maxTouch + * 48 VCC - - 3.3V power supply for extension board + * 49 VCC - - 3.3V power supply for extension board + * 50 GND - - Ground + * ---- ------------ ---- -------- ----------------------------------------------------------- + */ + +# elif defined(CONFIG_SAMV71XULT_MXTXLND_LCD) +# define GPIO_MXTXPLND_RESET \ + (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_SET | \ + GPIO_PORT_PIOC | GPIO_PIN13) +# define GPIO_ILI9488_BLOFF \ + (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_CLEAR | \ + GPIO_PORT_PIOC | GPIO_PIN9) + +# ifdef HAVE_MAXTOUCH +# define GPIO_MXT_CHG \ + (GPIO_INPUT | GPIO_CFG_PULLUP | GPIO_CFG_DEGLITCH | GPIO_INT_FALLING | \ + GPIO_PORT_PIOD | GPIO_PIN28) +# define IRQ_MXT_CHG \ + SAM_IRQ_PD28 +# endif /* HAVE_MAXTOUCH */ +# endif /* CONFIG_SAMV71XULT_MXTXLND_xyz */ + +/* In any event, touchscreen communicates on TWI0, I2C address 0x4a */ + +# define MXT_TWI_BUS 0 +# define MXT_I2C_ADDRESS 0x4a + +#endif /* CONFIG_SAMV71XULT_MXTXPLND */ + +/************************************************************************************ + * Public Types + ************************************************************************************/ + +/************************************************************************************ + * Public data + ************************************************************************************/ + +#ifndef __ASSEMBLY__ + +/************************************************************************************ + * Public Functions + ************************************************************************************/ + +#endif /* __ASSEMBLY__ */ +#endif /* __CONFIGS_ATMXT_XPRO_SRC_ATMXT_XPRO_H */ diff --git a/nuttx/configs/samv71-xult/src/sam_maxtouch.c b/nuttx/configs/samv71-xult/src/sam_maxtouch.c index e1eb8b2a5..b0559b325 100644 --- a/nuttx/configs/samv71-xult/src/sam_maxtouch.c +++ b/nuttx/configs/samv71-xult/src/sam_maxtouch.c @@ -54,6 +54,7 @@ #include "sam_twihs.h" #include "samv71-xult.h" +#include "atmxt-xpro.h" #ifdef HAVE_MAXTOUCH diff --git a/nuttx/configs/samv71-xult/src/samv71-xult.h b/nuttx/configs/samv71-xult/src/samv71-xult.h index e3cb1f753..51b71a9d2 100644 --- a/nuttx/configs/samv71-xult/src/samv71-xult.h +++ b/nuttx/configs/samv71-xult/src/samv71-xult.h @@ -61,59 +61,6 @@ #define HAVE_NETWORK 1 #define HAVE_MACADDR 1 #define HAVE_MTDCONFIG 1 -#define HAVE_MAXTOUCH 1 -#define HAVE_ILI9488 1 - -/* LCD */ - -#ifndef CONFIG_SAMV71XULT_MXTXPLND -# undef HAVE_MAXTOUCH -# undef HAVE_ILI9488 -#endif - -#if defined(HAVE_MAXTOUCH) && !defined(CONFIG_INPUT_MXT) -# warning maXTouch support not enabled (CONFIG_INPUT_MXT) -# undef HAVE_MAXTOUCH -#endif - -#if defined(HAVE_MAXTOUCH) && !defined(CONFIG_SAMV7_TWIHS0) -# warning maXTouch support requires TWIHS0 -# undef HAVE_MAXTOUCH -#endif - -#ifdef HAVE_MAXTOUCH -# if defined(CONFIG_SAMV71XULT_MXTXPLND_EXT1) -# ifndef CONFIG_SAMV7_GPIOD_IRQ -# warning maXTouch on EXT1 requires CONFIG_SAMV7_GPIOD_IRQ -# undef HAVE_MAXTOUCH -# endif -# elif defined(CONFIG_SAMV71XULT_MXTXPLND_EXT2) -# ifndef CONFIG_SAMV7_GPIOA_IRQ -# warning maXTouch on EXT1 requires CONFIG_SAMV7_GPIOA_IRQ -# undef HAVE_MAXTOUCH -# endif -# else -# warning maXTouch requires CONFIG_SAMV71XULT_MXTXPLND_EXT1 or EXT2 -# undef HAVE_MAXTOUCH -# endif -#endif - -#if defined(HAVE_ILI9488) && !defined(CONFIG_LCD_ILI9488) -# warning ILI9488 support not enabled (CONFIG_LCD_ILI9488) -# undef HAVE_ILI9488 -#endif - -#if defined(HAVE_ILI9488) && !defined(CONFIG_SAMV7_SPI0) -# warning ILI9488 support requires SPI0 -# undef HAVE_ILI9488 -#endif - -#ifdef HAVE_ILI9488 -# if !defined(CONFIG_SAMV71XULT_MXTXPLND_EXT1) && !defined(CONFIG_SAMV71XULT_MXTXPLND_EXT2) -# warning ILI9488 requires CONFIG_SAMV71XULT_MXTXPLND_EXT1 or EXT2 -# undef HAVE_ILI9488 -# endif -#endif /* HSMCI */ /* Can't support MMC/SD if the card interface is not enabled */ @@ -234,122 +181,6 @@ /* SAMV71-XULT GPIO Pin Definitions *************************************************/ -/* maXTouch Xplained Pro LCD - * - * This LCD could be connected either via EXT1 or EXT2 using the 2x10 - * 20-pin cable and the maXTouch Xplained Pro standard extension - * header. Access this then performed in SPI mode. - * - * ---- -------- ---- ----------- ---- ----------- ------------------------------------------ - * SAMV71-XULT maxTouch Xplained Pro - * PIN FUNCTION EXT1 FUNC EXT2 FUNC Description - * ---- -------- ---- ----------- ---- ----------- ------------------------------------------ - * 1 ID - - - - Communication line to ID chip - * 2 GND - - - - Ground - * 3 N/C PC31 - PD30 - - * 4 N/C PA19 - PC13 - - * 5 GPIO PB3 GPIO PA6 GPIO Command/Data Select - * 6 N/C PB2 - PD11 - - * 7 PWM PA0 PWMC0_PWMH0 PC19 PWMC0_PMWH2 Backlight control - * 8 N/C PC30 - PD26 - - * 9 GPIO/IRQ PD28 GPIO PA2 GPIO IRQ from maXTouch controller - * 10 GPIO PA5 GPIO PA24 GPIO RESET signal for maXTouch and LCD controller - * 11 I2C SDA PA3 TWID0 PA3 TWID0 I2C Data line for maXTouch controller - * 12 I2C SCL PA4 TWICK0 PA4 TWICK0 I2C Clock line for maXTouch controller - * 13 N/C PB0 - PA21 - - * 14 N/C PB1 - PB4 - - * 15 CS PD25 GPIO PD27 GPIO CS line for LCD controller - * 16 SPI MOSI PD21 SPI0_MOSI PD21 SPI0_MOSI SPI Data to LCD controller - * 17 SPI MISO PD20 SPI0_MISO PD20 SPI0_MISO SPI Data from LCD controller - * 18 SPI SCK PD22 SPI0_SPCK PD22 SPI0_SPCK SPI Clock line - * 19 GND - - - - Ground - * 20 VCC - - - - Target supply voltage - * ---- -------- ---- ----------- ---- ----------- ------------------------------------------ - */ - -#ifdef CONFIG_SAMV71XULT_MXTXPLND -/* Common maXTouch Xplained Pro board definitions */ - -# ifdef CONFIG_SAMV71XULT_MXTXPLND_EXT1 - -# define GPIO_MXTXPLND_RESET \ - (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_SET | \ - GPIO_PORT_PIOA | GPIO_PIN5) - -# define GPIO_ILI9488_BLOFF \ - (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_CLEAR | \ - GPIO_PORT_PIOA | GPIO_PIN0) - -# else /* CONFIG_SAMV71XULT_MXTXPLND_EXT2 */ - -# define GPIO_MXTXPLND_RESET \ - (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_SET | \ - GPIO_PORT_PIOA | GPIO_PIN24) - -# define GPIO_ILI9488_BLOFF \ - (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_CLEAR | \ - GPIO_PORT_PIOC | GPIO_PIN19) - -# endif /* CONFIG_SAMV71XULT_MXTXPLND_EXT1 */ - -# ifdef HAVE_MAXTOUCH -/* maXTouch touchscreen controller definitions */ - -# ifdef CONFIG_SAMV71XULT_MXTXPLND_EXT1 - -# define GPIO_MXT_CHG \ - (GPIO_INPUT | GPIO_CFG_PULLUP | GPIO_CFG_DEGLITCH | GPIO_INT_FALLING | \ - GPIO_PORT_PIOD | GPIO_PIN28) -# define IRQ_MXT_CHG \ - SAM_IRQ_PD28 - -# else /* if CONFIG_SAMV71XULT_MXTXPLND_EXT2 */ - -# define GPIO_MXT_CHG \ - (GPIO_INPUT | GPIO_CFG_PULLUP | GPIO_CFG_DEGLITCH | GPIO_INT_FALLING | \ - GPIO_PORT_PIOA | GPIO_PIN2) -# define IRQ_MXT_CHG \ - SAM_IRQ_PA2 - -# endif /* CONFIG_SAMV71XULT_MXTXPLND_EXT1 */ - -/* The touchscreen communicates on TWI0, I2C address 0x4a */ - -# define MXT_TWI_BUS 0 -# define MXT_I2C_ADDRESS 0x4a - -# endif /* HAVE_MAXTOUCH */ - -# ifdef HAVE_ILI9488 -/* ILI9488 LCD definitions */ - -# ifdef CONFIG_SAMV71XULT_MXTXPLND_EXT1 -# define GPIO_ILI9488_CMDDAT \ - (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_CLEAR | \ - GPIO_PORT_PIOA | GPIO_PIN23) - -# define GPIO_ILI9488_CS \ - (PIO_OUTPUT | GPIO_CFG_PULLUP | GPIO_OUTPUT_SET | \ - GPIO_PORT_PIOD | GPIO_PIN25) -# define ILI9488_PORT \ - SPI0_CS1 - -# else /* if CONFIG_SAMV71XULT_MXTXPLND_EXT2 */ - -# define GPIO_ILI9488_CMDDAT \ - (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_CLEAR | \ - GPIO_PORT_PIOA | GPIO_PIN23) - -# define GPIO_ILI9488_CS \ - (PIO_OUTPUT | GPIO_CFG_PULLUP | GPIO_OUTPUT_SET | \ - GPIO_PORT_PIOD | GPIO_PIN27) -# define MXTXLPND_PORT \ - SPI0_CS3 - -# endif /* CONFIG_SAMV71XULT_MXTXPLND_EXT1 */ -# endif /* HAVE_ILI9488 */ -#endif /* CONFIG_SAMV71XULT_MXTXPLND */ - /* Ethernet MAC. * * KSZ8061RNBVA Connections -- cgit v1.2.3