From 065ec805c79122d4a04b0b79d4de638d92bf93d4 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Tue, 19 May 2015 14:32:09 -0600 Subject: [PATCH] SAML21-Xplained: Update the cloned SAMD20-Xplained board configuration for specifics of the SAML21-Xplained --- configs/saml21-xplained/Kconfig | 29 +-- configs/saml21-xplained/README.txt | 210 ++++++++++-------- configs/saml21-xplained/include/board.h | 83 +++---- configs/saml21-xplained/nsh/defconfig | 3 - configs/saml21-xplained/src/sam_autoleds.c | 2 +- configs/saml21-xplained/src/sam_userleds.c | 2 +- configs/saml21-xplained/src/saml21-xplained.h | 29 +-- 7 files changed, 173 insertions(+), 185 deletions(-) diff --git a/configs/saml21-xplained/Kconfig b/configs/saml21-xplained/Kconfig index 1e49610c84..5b92e42a54 100644 --- a/configs/saml21-xplained/Kconfig +++ b/configs/saml21-xplained/Kconfig @@ -52,31 +52,4 @@ endchoice endif endmenu -if USART4_SERIAL_CONSOLE -choice - prompt "USART 4 Connection" - default SAML21_XPLAINED_USART4_EXT3 - -config SAML21_XPLAINED_USART4_EXT1 - bool "EXT1" - depends on !SAML21_XPLAINED_OLED1MODULE_EXT1 && !SAML21_XPLAINED_IOMODULE_EXT1 - ---help--- - Select this option if the serial console is on SERCOM4 connected via - EXT1. The RX will be on PB9 and TX signal will be on PB8. - -config SAML21_XPLAINED_USART4_EXT2 - bool "EXT2" - depends on !SAML21_XPLAINED_OLED1MODULE_EXT2 && !SAML21_XPLAINED_IOMODULE_EXT2 - ---help--- - Select this option if the serial console is on SERCOM4 connected via - EXT2. The RX will be on PB13 and TX signal will be on PB12. - -config SAML21_XPLAINED_USART4_EXT3 - bool "EXT3" - ---help--- - Select this option if the serial console is on SERCOM4 connect via - EXT3. The RX will be on PB11 and TX signal will be on PB10. - -endchoice -endif -endif +endif # ARCH_BOARD_SAML21_XPLAINED diff --git a/configs/saml21-xplained/README.txt b/configs/saml21-xplained/README.txt index 0b18ff593c..dd9dc4b0b7 100644 --- a/configs/saml21-xplained/README.txt +++ b/configs/saml21-xplained/README.txt @@ -1,5 +1,5 @@ README -^^^^^^ +====== This README discusses issues unique to NuttX configurations for the Atmel SAML21 Xplained Pro development board. This board features the @@ -14,21 +14,22 @@ The SAML21 Xplained Pro Starter Kit may be bundled with three modules: logic). Contents -^^^^^^^^ +======== - Modules - Development Environment - GNU Toolchain Options - IDEs - NuttX EABI "buildroot" Toolchain - - LEDs + - LEDs and Buttons - Serial Consoles - Atmel Studio 6.1 - SAML21 Xplained Pro-specific Configuration Options - Configurations Modules -^^^^^^^ +======= + The SAML21 Xplained Pro Starter Kit is bundled with four modules: I/O1 @@ -54,21 +55,21 @@ Modules ----------------- ---------------------- ---------------------- ------------------------------------ 2 GND 2 GND 2 GND ----------------- ---------------------- ---------------------- ------------------------------------ - 3 LIGHTSENSOR 3 PB00 AIN[8] 3 PA10 AIN[18] + 3 LIGHTSENSOR 3 PB05 AIN[13] 3 PA10 AIN[18] ----------------- ---------------------- ---------------------- ------------------------------------ - 4 LP_OUT 4 PB01 AIN[9] 4 PA11 AIN[19] + 4 LP_OUT 4 PA03 AIN[1] 4 PA11 AIN[19] ----------------- ---------------------- ---------------------- ------------------------------------ 5 GPIO1 5 PB06 GPIO 5 PA20 GPIO ----------------- ---------------------- ---------------------- ------------------------------------ 6 GPIO2 6 PB07 GPIO 6 PA21 GPIO ----------------- ---------------------- ---------------------- ------------------------------------ - 7 LED 7 PB02 TC6/WO[0] 7 PA22 TC4/WO[0] + 7 LED 7 PA12 TCC2/WO[0] 7 PB12 TC4/WO[0] ----------------- ---------------------- ---------------------- ------------------------------------ - 8 LP_IN 8 PB03 TC6/WO[1] 8 PA23 TC4/WO[1] + 8 LP_IN 8 PA13 TCC2/WO[1] 8 PB13 TC4/WO[1] ----------------- ---------------------- ---------------------- ------------------------------------ 9 TEMP_ALERT 9 PB04 EXTINT[4] 9 PB14 EXTINT[14] ----------------- ---------------------- ---------------------- ------------------------------------ - 10 microSD_DETECT 10 PB05 GPIO 10 PB15 GPIO + 10 microSD_DETECT 10 PA02 GPIO 10 PB15 GPIO ----------------- ---------------------- ---------------------- ------------------------------------ 11 TWI SDA 11 PA08 SERCOM2 PAD[0] 11 PA08 SERCOM2 PAD[0] EXT1, EXT2, EXT3 and EDBG I²C SDA I²C SDA @@ -76,24 +77,24 @@ Modules 12 TWI SCL 12 PA09 SERCOM2 PAD[1] 12 PA09 SERCOM2 PAD[1] EXT2, EXT3 and EDBG I²C SCL I²C SCL ----------------- ---------------------- ---------------------- ------------------------------------ - 13 USART RX 13 PB09 SERCOM4 PAD[1] 13 PB13 SERCOM4 PAD[1] The SERCOM4 module is shared between + 13 USART RX 13 PB09 SERCOM4 PAD[1] 13 PA19 SERCOM1 PAD[3] The SERCOM4 module is shared between USART RX USART RX EXT1, 2 and 3 USART's, but uses different pins ----------------- ---------------------- ---------------------- ------------------------------------ - 14 USART TX 14 PB08 SERCOM4 PAD[0] 14 PB12 SERCOM4 PAD[0] The SERCOM4 module is shared between + 14 USART TX 14 PB08 SERCOM4 PAD[0] 14 PA18 SERCOM1 PAD[2] The SERCOM4 module is shared between USART TX USART TX EXT1, 2 and 3 USART's, but uses different pins ----------------- ---------------------- ---------------------- ------------------------------------ - 15 microSD_SS 15 PA05 SERCOM0 PAD[1] 15 PA17 SERCOM1 PAD[1] - SPI SS SPI SS + 15 microSD_SS 15 PA05 SERCOM0 PAD[1] 15 PA17 GPIO + SPI SS ----------------- ---------------------- ---------------------- ------------------------------------ - 16 SPI_MOSI 16 PA06 SERCOM0 PAD[2] 16 PA18 SERCOM1 PAD[2] + 16 SPI_MOSI 16 PA06 SERCOM0 PAD[2] 16 PB22 SERCOM5 PAD[2] SPI MOSI SPI MOSI ----------------- ---------------------- ---------------------- ------------------------------------ - 17 SPI_MISO 17 PA04 SERCOM0 PAD[0] 17 PA16 SERCOM1 PAD[0] + 17 SPI_MISO 17 PA04 SERCOM0 PAD[0] 17 PB16 SERCOM5 PAD[0] SPI MISO SPI MISO ----------------- ---------------------- ---------------------- ------------------------------------ - 18 SPI_SCK 18 PA07 SERCOM0 PAD[3] 18 PA19 SERCOM1 PAD[3] + 18 SPI_SCK 18 PA07 SERCOM0 PAD[3] 18 PB23 SERCOM5 PAD[3] SPI SCK SPI SCK ----------------- ---------------------- ---------------------- ------------------------------------ 19 GND 19 GND GND @@ -133,10 +134,10 @@ Modules --- ------------------ ---------------------- ------------------------------------- PIN EXT1 EXT2 Description --- ------------------ ---------------------- ------------------------------------- - 15 PA05 SERCOM0 PAD[1] 15 PA17 SERCOM1 PAD[1] Active low chip select OUTPUT, pulled - SPI SS SPI SS high on board. + 15 PA05 SERCOM0 PAD[1] 15 PA17 GPIO Active low chip select OUTPUT, pulled + SPI SS high on board. --- ------------------ ---------------------- ------------------------------------- - 10 PB05 GPIO 10 PB15 GPIO Active low card detect INPUT, must + 10 PA02 GPIO 10 PB15 GPIO Active low card detect INPUT, must use internal pull-up. --- ------------------ ---------------------- ------------------------------------- @@ -167,21 +168,21 @@ Modules ----------------- ---------------------- ---------------------- ------------------------------------ 2 GND 2 GND 2 GND ----------------- ---------------------- ---------------------- ------------------------------------ - 3 BUTTON2 3 PB00 AIN[8] 3 PA10 AIN[18] + 3 BUTTON2 3 PB05 AIN[13] 3 PA10 AIN[18] ----------------- ---------------------- ---------------------- ------------------------------------ - 4 BUTTON3 4 PB01 AIN[9] 4 PA11 AIN[19] + 4 BUTTON3 4 PA03 AIN[1] 4 PA11 AIN[19] ----------------- ---------------------- ---------------------- ------------------------------------ 5 DATA_CMD_SEL 5 PB06 GPIO 5 PA20 GPIO ----------------- ---------------------- ---------------------- ------------------------------------ 6 LED3 6 PB07 GPIO 6 PA21 GPIO ----------------- ---------------------- ---------------------- ------------------------------------ - 7 LED1 7 PB02 TC6/WO[0] 7 PA22 TC4/WO[0] + 7 LED1 7 PA12 TCC2/WO[0] 7 PB12 TC4/WO[0] ----------------- ---------------------- ---------------------- ------------------------------------ - 8 LED2 8 PB03 TC6/WO[1] 8 PA23 TC4/WO[1] + 8 LED2 8 PA13 TCC2/WO[1] 8 PB13 TC4/WO[1] ----------------- ---------------------- ---------------------- ------------------------------------ 9 BUTTON1 9 PB04 EXTINT[4] 9 PB14 EXTINT[14] ----------------- ---------------------- ---------------------- ------------------------------------ - 10 DISPLAY_RESET 10 PB05 GPIO 10 PB15 GPIO + 10 DISPLAY_RESET 10 PA02 GPIO 10 PB15 GPIO ----------------- ---------------------- ---------------------- ------------------------------------ 11 N/C 11 PA08 SERCOM2 PAD[0] 11 PA08 SERCOM2 PAD[0] EXT1, EXT2, EXT3 and EDBG I²C SDA I²C SDA @@ -189,24 +190,24 @@ Modules 12 N/C 12 PA09 SERCOM2 PAD[1] 12 PA09 SERCOM2 PAD[1] EXT2, EXT3 and EDBG I²C SCL I²C SCL ----------------- ---------------------- ---------------------- ------------------------------------ - 13 N/C 13 PB09 SERCOM4 PAD[1] 13 PB13 SERCOM4 PAD[1] The SERCOM4 module is shared between + 13 N/C 13 PB09 SERCOM4 PAD[1] 13 PA19 SERCOM1 PAD[3] The SERCOM4 module is shared between USART RX USART RX EXT1, 2 and 3 USART's, but uses different pins ----------------- ---------------------- ---------------------- ------------------------------------ - 14 N/C 14 PB08 SERCOM4 PAD[0] 14 PB12 SERCOM4 PAD[0] The SERCOM4 module is shared between + 14 N/C 14 PB08 SERCOM4 PAD[0] 14 PA18 SERCOM1 PAD[2] The SERCOM4 module is shared between USART TX USART TX EXT1, 2 and 3 USART's, but uses different pins ----------------- ---------------------- ---------------------- ------------------------------------ - 15 DISPLAY_SS 15 PA05 SERCOM0 PAD[1] 15 PA17 SERCOM1 PAD[1] - SPI SS SPI SS + 15 DISPLAY_SS 15 PA05 SERCOM0 PAD[1] 15 PA17 GPIO + SPI SS ----------------- ---------------------- ---------------------- ------------------------------------ - 16 SPI_MOSI 16 PA06 SERCOM0 PAD[2] 16 PA18 SERCOM1 PAD[2] + 16 SPI_MOSI 16 PA06 SERCOM0 PAD[2] 16 PB22 SERCOM5 PAD[2] SPI MOSI SPI MOSI ----------------- ---------------------- ---------------------- ------------------------------------ - 17 N/C 17 PA04 SERCOM0 PAD[0] 17 PA16 SERCOM1 PAD[0] + 17 N/C 17 PA04 SERCOM0 PAD[0] 17 PB16 SERCOM5 PAD[0] SPI MISO SPI MISO ----------------- ---------------------- ---------------------- ------------------------------------ - 18 SPI_SCK 18 PA07 SERCOM0 PAD[3] 18 PA19 SERCOM1 PAD[3] + 18 SPI_SCK 18 PA07 SERCOM0 PAD[3] 18 PB23 SERCOM5 PAD[3] SPI SCK SPI SCK ----------------- ---------------------- ---------------------- ------------------------------------ 19 GND 19 GND GND @@ -230,7 +231,7 @@ Modules There is no built-in support for the PROTO1 module. Development Environment -^^^^^^^^^^^^^^^^^^^^^^^ +======================= Either Linux or Cygwin on Windows can be used for the development environment. The source has been built only using the GNU toolchain (see below). Other @@ -238,8 +239,7 @@ Development Environment environment. GNU Toolchain Options -^^^^^^^^^^^^^^^^^^^^^ - +===================== The NuttX make system can be configured to support the various different toolchain options. All testing has been conducted using the NuttX buildroot @@ -294,7 +294,7 @@ GNU Toolchain Options MKDEP = $(TOPDIR)/tools/mknulldeps.sh IDEs -^^^^ +==== NuttX is built using command-line make. It can be used with an IDE, but some effort will be required to create the project. @@ -326,7 +326,7 @@ IDEs startup object needed by an IDE. NuttX EABI "buildroot" Toolchain -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +================================ A GNU GCC-based toolchain is assumed. The files */setenv.sh should be modified to point to the correct path to the Cortex-M0 GCC toolchain (if @@ -362,11 +362,14 @@ NuttX EABI "buildroot" Toolchain details PLUS some special instructions that you will need to follow if you are building a Cortex-M0 toolchain for Cygwin under Windows. -LEDs -^^^^ - There is one yellow LED available on the SAM D20 Xplained Pro board that +LEDs and Buttons +================ + + LED + --- + There is one yellow LED available on the SAML21 Xplained Pro board that can be turned on and off. The LED can be activated by driving the connected - PA14 I/O line to GND. + PB10 I/O line to GND. When CONFIG_ARCH_LEDS is defined in the NuttX configuration, NuttX will control the LED as follows: @@ -386,22 +389,64 @@ LEDs apparently, running normally. If LED is flashing at approximately 2Hz, then a fatal error has been detected and the system has halted. -Serial Consoles -^^^^^^^^^^^^^^^ - - SERCOM4 + Button ------ + SAM L21 Xplained Pro contains one mechanical button on PA02 that can be + controlled by software. When a button is pressed it will drive the I/O + line to GND. Note: There is no pull-up resistor connected to the generic + user button. Remember to enable the internal pull-up in the SAM L21 to + use the button. - SERCOM4 is available on connectors EXT1, EXT2, and EXT3, but using - different PORT pins: + QTouch Button + ------------- + To be provided + +Serial Consoles +=============== + + SERCOM0 + ------- + SERCOM0 is dedicated for use with SPI at the EXT1 connector + + SERCOM1 + ------- + SERCOM1 is available as a USART on EXT2 and EXT3 PIN EXT1 EXT2 EXT3 GPIO Function ---- ---- ---- ---- ------------------ - 13 PB09 PB13 PB11 SERCOM4 / USART RX - 14 PB08 PB12 PB12 SERCOM4 / USART TX + 13 --- PA19 PA19 SERCOM1 / USART RX + 14 --- PA18 PA18 SERCOM1 / USART TX 19 GND GND GND N/A 20 VCC VCC VCC N/A + SERCOM2 + ------- + SERCOM0 is dedicated for use with I2C at the EXT1, EXT2, and EXT3 + connectors. + + SERCOM3 + ------- + SERCOM3 is not available on any EXT connector but is dedicated for + use with Virtual COM (see below). + + SERCOM4 + ------- + SERCOM1 is available as a USART on EXT1 + + PIN EXT1 EXT2 EXT3 GPIO Function + ---- ---- ---- ---- ------------------ + 13 PB09 --- --- SERCOM4 / USART RX + 14 PB08 --- --- SERCOM4 / USART TX + 19 GND GND GND N/A + 20 VCC VCC VCC N/A + + SERCOM5 + ------- + + SERCOM5 is dedicated for use with SPI at the EXT2 and EXT3 connectors + + Configuration + ------------- There are options available in the NuttX configuration to select which connector SERCOM4 is on: SAML21_XPLAINED_USART4_EXTn, where n=1, 2, or 3. @@ -418,11 +463,14 @@ Serial Consoles The Embedded debugger also include a Virtual COM port interface over SERCOM3. Virtual COM port connections: - PA24 SERCOM3 / USART TXD - PA25 SERCOM3 / USART RXD + PA22 SERCOM3 / USART TXD + PA23 SERCOM3 / USART RXD Atmel Studio 6.1 -^^^^^^^^^^^^^^^^ +================ + + NOTE: These instructions are old. The SAML21 requires Atmel Studio 6.2. + They may still prove useful to you, however. Loading Code into FLASH: ----------------------- @@ -443,7 +491,7 @@ Atmel Studio 6.1 - This will reload the nuttx.elf file into FLASH SAML21 Xplained Pro-specific Configuration Options -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +================================================== CONFIG_ARCH - Identifies the arch/ subdirectory. This should be set to: @@ -472,7 +520,7 @@ SAML21 Xplained Pro-specific Configuration Options CONFIG_ARCH_BOARD - Identifies the configs subdirectory and hence, the board that supports the particular chip or SoC. - CONFIG_ARCH_BOARD=saml21-xplained (for the SAML21 Xplained Pro development board) + CONFIG_ARCH_BOARD="saml21-xplained" (for the SAML21 Xplained Pro development board) CONFIG_ARCH_BOARD_name - For use in C code @@ -560,7 +608,7 @@ SAML21 Xplained Pro-specific Configuration Options CONFIG_USARTn_2STOP - Two stop bits Configurations -^^^^^^^^^^^^^^ +============== Each SAML21 Xplained Pro configuration is maintained in a sub-directory and can be selected as follow: @@ -603,39 +651,31 @@ Configurations reconfiguration process. 2. Unless stated otherwise, all configurations generate console - output of on SERCOM4 which is available on EXT1, EXT2, or EXT3 (see - the section "Serial Consoles" above). The virtual COM port could - be used, instead, by reconfiguring to use SERCOM3 instead of - SERCOM4: + output of on SERCOM4 which is available on EXT1 (see the section + "Serial Consoles" above). The SERCOM1 on EXT2 or EXT3 or the + virtual COM port on SERCOME could be used, instead, by + reconfiguring to use SERCOM1 or SERCOM3 instead of SERCOM4: + System Type -> SAMD/L Peripheral Support - CONFIG_SAMDL_SERCOM3=y : Enable one or both + CONFIG_SAMDL_SERCOM1=y : Enable one or both + CONFIG_SAMDL_SERCOM3=y CONFIG_SAMDL_SERCOM4=n Device Drivers -> Serial Driver Support -> Serial Console - CONFIG_USART4_SERIAL_CONSOLE=y : Select only one for the console + CONFIG_USART1_SERIAL_CONSOLE=y : Select only one for the console + CONFIG_USART3_SERIAL_CONSOLE=y : Select only one for the console CONFIG_USART4_SERIAL_CONSOLE=n - Device Drivers -> Serial Driver Support -> SERCOM3 Configuration - CONFIG_USART3_2STOP=0 - CONFIG_USART3_BAUD=115200 - CONFIG_USART3_BITS=8 - CONFIG_USART3_PARITY=0 - CONFIG_USART3_RXBUFSIZE=256 - CONFIG_USART3_TXBUFSIZE=256 + Device Drivers -> Serial Driver Support -> SERCOMn Configuration + where n=1 or 3: - Device Drivers -> Serial Driver Support -> SERCOM4 Configuration - CONFIG_USART4_2STOP=0 - CONFIG_USART4_BAUD=115200 - CONFIG_USART4_BITS=8 - CONFIG_USART4_PARITY=0 - CONFIG_USART4_RXBUFSIZE=256 - CONFIG_USART4_TXBUFSIZE=256 - - Board Selection -> USART4 Connection - CONFIG_SAML21_XPLAINED_USART4_EXT1=n : Pick on if USART4 used - CONFIG_SAML21_XPLAINED_USART4_EXT2=n - CONFIG_SAML21_XPLAINED_USART4_EXT3=y + CONFIG_USARTn_2STOP=0 + CONFIG_USARTn_BAUD=115200 + CONFIG_USARTn_BITS=8 + CONFIG_USARTn_PARITY=0 + CONFIG_USARTn_RXBUFSIZE=256 + CONFIG_USARTn_TXBUFSIZE=256 3. Unless otherwise stated, the configurations are setup for Cygwin under Windows: @@ -740,14 +780,14 @@ Configuration sub-directories Board Selection -> SAML21 Xplained Pro Modules CONFIG_SAML21_XPLAINED_IOMODULE=y : I/O1 module is connected - CONFIG_SAML21_XPLAINED_IOMODULE_EXT1=y : I/O1 modules is in EXT1 + CONFIG_SAML21_XPLAINED_IOMODULE_EXT2=y : I/O1 modules is in EXT2 Application Configuration -> NSH Library CONFIG_NSH_ARCHINIT=y : Board has architecture-specific initialization NOTE: If you enable the I/O1 this configuration with SERCOM4 as the console and with the I/O1 module in EXT1, you *must* remove USART - jumper. Otherwise, you have lookpack on SERCOM4 and NSH will *not* + jumper. Otherwise, you have lookback on SERCOM4 and NSH will *not* behave very well (since its outgoing prompts also appear as incoming commands). @@ -804,7 +844,7 @@ Configuration sub-directories CONFIG_NX=y : Enable graphics support CONFIG_NX_LCDDRIVER=y : Using an LCD driver CONFIG_NX_NPLANES=1 : With a single color plane - CONFIG_NX_WRITEONLY=n : You can read from the LCD (see below**) + CONFIG_NX_WRITEONLY=n : You can read from the LCD (see below*) CONFIG_NX_DISABLE_2BPP=y : Disable all resolutions except 1BPP CONFIG_NX_DISABLE_4BPP=y CONFIG_NX_DISABLE_8BPP=y @@ -817,11 +857,7 @@ Configuration sub-directories CONFIG_NXFONTS_CHARBITS=7 : 7-bit fonts CONFIG_NXFONT_SANS17X23B=y : Pick a font (any that will fit) - * This orientation will put the buttons "above" the LCD. The - reverse landscape configuration (CONFIG_LCD_RLANDSCAPE) will - "flip" the display so that the buttons are "below" the LCD. - - ** The hardware is write only, but the driver maintains a frame buffer + * The hardware is write only, but the driver maintains a frame buffer to support read and read-write-modiry operations on the LCD. Reading from the frame buffer is, however, untested. diff --git a/configs/saml21-xplained/include/board.h b/configs/saml21-xplained/include/board.h index 124233ced1..bb6a8330ea 100644 --- a/configs/saml21-xplained/include/board.h +++ b/configs/saml21-xplained/include/board.h @@ -384,28 +384,28 @@ #define BOARD_SERCOM0_GCLKGEN GCLK_CLKCTRL_GEN0 #define BOARD_SERCOM0_MUXCONFIG (SPI_CTRLA_DOPO_DOPAD231 | SPI_CTRLA_DIPAD0) #define BOARD_SERCOM0_PINMAP_PAD0 PORT_SERCOM0_PAD0_2 /* SPI_MISO */ -#define BOARD_SERCOM0_PINMAP_PAD1 0 /* microSD_SS */ +#define BOARD_SERCOM0_PINMAP_PAD1 0 /* SPI_SS (not used) */ #define BOARD_SERCOM0_PINMAP_PAD2 PORT_SERCOM0_PAD2_2 /* SPI_MOSI */ #define BOARD_SERCOM0_PINMAP_PAD3 PORT_SERCOM0_PAD3_2 /* SPI_SCK */ #define BOARD_SERCOM0_FREQUENCY BOARD_GCLK0_FREQUENCY -/* SERCOM1 SPI is available on EXT2 +/* SERCOM1 USART is available on EXT2 and EXT3 * - * PIN PORT SERCOM FUNCTION - * --- ------------------ ----------- - * 15 PA17 SERCOM1 PAD1 SPI SS - * 16 PA18 SERCOM1 PAD2 SPI MOSI - * 17 PA16 SERCOM1 PAD0 SPI MISO - * 18 PA19 SERCOM1 PAD3 SPI SCK + * PIN EXT1 EXT2 EXT3 GPIO Function + * ---- ---- ---- ---- ------------------ + * 13 --- PA19 PA19 SERCOM1 / USART RX + * 14 --- PA18 PA18 SERCOM1 / USART TX + * 19 GND GND GND N/A + * 20 VCC VCC VCC N/A */ #define BOARD_SERCOM1_GCLKGEN GCLK_CLKCTRL_GEN0 -#define BOARD_SERCOM1_MUXCONFIG (SPI_CTRLA_DOPO_DOPAD231 | SPI_CTRLA_DIPAD0) -#define BOARD_SERCOM1_PINMAP_PAD0 PORT_SERCOM1_PAD0_1 /* SPI_MISO */ -#define BOARD_SERCOM1_PINMAP_PAD1 0 /* microSD_SS */ -#define BOARD_SERCOM1_PINMAP_PAD2 PORT_SERCOM1_PAD2_1 /* SPI_MOSI */ -#define BOARD_SERCOM1_PINMAP_PAD3 PORT_SERCOM1_PAD3_1 /* SPI_SCK */ +#define BOARD_SERCOM1_MUXCONFIG (USART_CTRLA_TXPAD2 | USART_CTRLA_RXPAD3) +#define BOARD_SERCOM1_PINMAP_PAD0 0 /* (not used) */ +#define BOARD_SERCOM1_PINMAP_PAD1 0 /* (not used) */ +#define BOARD_SERCOM1_PINMAP_PAD2 PORT_SERCOM1_PAD2_1 /* USART_TX */ +#define BOARD_SERCOM1_PINMAP_PAD3 PORT_SERCOM1_PAD3_1 /* USART_RX */ #define BOARD_SERCOM1_FREQUENCY BOARD_GCLK0_FREQUENCY @@ -414,59 +414,40 @@ * The Embedded debugger also include a Virtual COM port interface over * SERCOM3. Virtual COM port connections: * - * PA24 SERCOM3 / USART TXD - * PA25 SERCOM3 / USART RXD + * PA22 SERCOM3 PAD[0] / USART TXD + * PA23 SERCOM3 PAD[1] / USART RXD */ #define BOARD_SERCOM3_GCLKGEN GCLK_CLKCTRL_GEN0 -#define BOARD_SERCOM3_MUXCONFIG (USART_CTRLA_RXPAD3 | USART_CTRLA_TXPAD2) -#define BOARD_SERCOM3_PINMAP_PAD0 0 -#define BOARD_SERCOM3_PINMAP_PAD1 0 -#define BOARD_SERCOM3_PINMAP_PAD2 PORT_SERCOM3_PAD2_1 /* USART TX */ -#define BOARD_SERCOM3_PINMAP_PAD3 PORT_SERCOM3_PAD3_1 /* USART RX */ +#define BOARD_SERCOM3_MUXCONFIG (USART_CTRLA_RXPAD1 | USART_CTRLA_TXPAD0_1) +#define BOARD_SERCOM3_PINMAP_PAD0 PORT_SERCOM3_PAD0_1 /* USART TX */ +#define BOARD_SERCOM3_PINMAP_PAD1 PORT_SERCOM3_PAD1_1 /* USART RX */ +#define BOARD_SERCOM3_PINMAP_PAD2 0 /* (not used) */ +#define BOARD_SERCOM3_PINMAP_PAD3 0 /* (not used) */ #define BOARD_SERCOM3_FREQUENCY BOARD_GCLK0_FREQUENCY -/* The SERCOM4 USART is available on connectors EXT1, EXT2, and EXT3 +/* The SERCOM4 USART is available on EXT1 * * PIN EXT1 EXT2 EXT3 GPIO Function * ---- ---- ---- ---- ------------------ - * 13 PB09 PB13 PB11 SERCOM4 / USART RX - * 14 PB08 PB12 PB12 SERCOM4 / USART TX + * 13 PB09 --- --- SERCOM4 PAD[1] / USART RX + * 14 PB08 --- --- SERCOM4 PAD[0] / USART TX * 19 GND GND GND N/A * 20 VCC VCC VCC N/A - * - * If you have a TTL to RS-232 converter then this is the most convenient - * serial console to use (because you don't lose the console device each time - * you lose the USB connection). It is the default in all of the SAML21 - * configurations. */ #define BOARD_SERCOM4_GCLKGEN GCLK_CLKCTRL_GEN0 -#if defined(CONFIG_SAML21_XPLAINED_USART4_EXT1) -# define BOARD_SERCOM4_MUXCONFIG (USART_CTRLA_RXPAD1 | USART_CTRLA_TXPAD0) -# define BOARD_SERCOM4_PINMAP_PAD0 PORT_SERCOM4_PAD0_3 /* USART TX */ -# define BOARD_SERCOM4_PINMAP_PAD1 PORT_SERCOM4_PAD1_3 /* USART RX */ -# define BOARD_SERCOM4_PINMAP_PAD2 0 -# define BOARD_SERCOM4_PINMAP_PAD3 0 -#elif defined(CONFIG_SAML21_XPLAINED_USART4_EXT2) -# define BOARD_SERCOM4_MUXCONFIG (USART_CTRLA_RXPAD1 | USART_CTRLA_TXPAD0) -# define BOARD_SERCOM4_PINMAP_PAD0 PORT_SERCOM4_PAD0_1 /* USART TX */ -# define BOARD_SERCOM4_PINMAP_PAD1 PORT_SERCOM4_PAD1_1 /* USART RX */ -# define BOARD_SERCOM4_PINMAP_PAD2 0 -# define BOARD_SERCOM4_PINMAP_PAD3 0 -#else /* if defined(CONFIG_SAML21_XPLAINED_USART4_EXT3) */ -# define BOARD_SERCOM4_MUXCONFIG (USART_CTRLA_RXPAD3 | USART_CTRLA_TXPAD2) -# define BOARD_SERCOM4_PINMAP_PAD0 0 -# define BOARD_SERCOM4_PINMAP_PAD1 0 -# define BOARD_SERCOM4_PINMAP_PAD2 PORT_SERCOM4_PAD2_3 /* USART TX */ -# define BOARD_SERCOM4_PINMAP_PAD3 PORT_SERCOM4_PAD3_3 /* USART RX */ -#endif +#define BOARD_SERCOM4_MUXCONFIG (USART_CTRLA_RXPAD1 | USART_CTRLA_TXPAD0) +#define BOARD_SERCOM4_PINMAP_PAD0 PORT_SERCOM4_PAD0_3 /* USART TX */ +#define BOARD_SERCOM4_PINMAP_PAD1 PORT_SERCOM4_PAD1_3 /* USART RX */ +#define BOARD_SERCOM4_PINMAP_PAD2 0 +#define BOARD_SERCOM4_PINMAP_PAD3 0 #define BOARD_SERCOM4_FREQUENCY BOARD_GCLK0_FREQUENCY -/* SERCOM5 SPI is available on EXT3 +/* SERCOM5 is dedicated for use with SPI at the EXT2 and EXT3 connectors * * PIN PORT SERCOM FUNCTION * --- ------------------ ----------- @@ -479,7 +460,7 @@ #define BOARD_SERCOM5_GCLKGEN GCLK_CLKCTRL_GEN0 #define BOARD_SERCOM5_MUXCONFIG (SPI_CTRLA_DOPO_DOPAD231 | SPI_CTRLA_DIPAD0) #define BOARD_SERCOM5_PINMAP_PAD0 PORT_SERCOM5_PAD0_1 /* SPI_MISO */ -#define BOARD_SERCOM5_PINMAP_PAD1 0 /* microSD_SS */ +#define BOARD_SERCOM5_PINMAP_PAD1 0 /* SPI_SS (not used) */ #define BOARD_SERCOM5_PINMAP_PAD2 PORT_SERCOM5_PAD2_4 /* SPI_MOSI */ #define BOARD_SERCOM5_PINMAP_PAD3 PORT_SERCOM5_PAD3_4 /* SPI_SCK */ @@ -492,7 +473,7 @@ * connector. * * This LED is controlled by PC07 and the LED can be activated by driving the - * PA14 to GND. + * PB10 to GND. */ /* LED index values for use with sam_setled() */ @@ -527,7 +508,7 @@ * RESET button connected to the SAML21 reset line and the other is a generic user * configurable button. When a button is pressed it will drive the I/O line to GND. * - * PA15 SW0 + * PA02 SW0 */ /* The SAML21 Xplained Pro supports one button: */ diff --git a/configs/saml21-xplained/nsh/defconfig b/configs/saml21-xplained/nsh/defconfig index cb3a9a92f3..a8d5d53aee 100644 --- a/configs/saml21-xplained/nsh/defconfig +++ b/configs/saml21-xplained/nsh/defconfig @@ -262,9 +262,6 @@ CONFIG_NSH_MMCSDMINOR=0 # # CONFIG_SAML21_XPLAINED_IOMODULE is not set # CONFIG_SAML21_XPLAINED_OLED1MODULE is not set -# CONFIG_SAML21_XPLAINED_USART4_EXT1 is not set -# CONFIG_SAML21_XPLAINED_USART4_EXT2 is not set -CONFIG_SAML21_XPLAINED_USART4_EXT3=y # CONFIG_LIB_BOARDCTL is not set # diff --git a/configs/saml21-xplained/src/sam_autoleds.c b/configs/saml21-xplained/src/sam_autoleds.c index 41aabb789e..36f5fd3dbc 100644 --- a/configs/saml21-xplained/src/sam_autoleds.c +++ b/configs/saml21-xplained/src/sam_autoleds.c @@ -37,7 +37,7 @@ * one user controllable LED, a yellow LED labelled STATUS near the SAML21 USB * connector. * - * This LED is controlled by PA14 and the LED can be activated by driving PA14 + * This LED is controlled by PB10 and the LED can be activated by driving PB10 * to GND. * * When CONFIG_ARCH_LEDS is defined in the NuttX configuration, NuttX will diff --git a/configs/saml21-xplained/src/sam_userleds.c b/configs/saml21-xplained/src/sam_userleds.c index 038b82e1db..71bc2222ec 100644 --- a/configs/saml21-xplained/src/sam_userleds.c +++ b/configs/saml21-xplained/src/sam_userleds.c @@ -37,7 +37,7 @@ * one user controllable LED, a yellow LED labeled STATUS near the SAML21 USB * connector. * - * This LED is controlled by PA14 and the LED can be activated by driving PA14 + * This LED is controlled by PB10 and the LED can be activated by driving PB10 * to GND. * * When CONFIG_ARCH_LEDS is defined in the NuttX configuration, NuttX will diff --git a/configs/saml21-xplained/src/saml21-xplained.h b/configs/saml21-xplained/src/saml21-xplained.h index f30a9eb13d..8489d14299 100644 --- a/configs/saml21-xplained/src/saml21-xplained.h +++ b/configs/saml21-xplained/src/saml21-xplained.h @@ -59,7 +59,7 @@ * one user controllable LED, a yellow LED labelled STATIS near the SAML21 USB * connector. * - * This LED is controlled by PA14 and the LED can be activated by driving PA14 + * This LED is controlled by PB10 and the LED can be activated by driving PB10 * to GND. * * When CONFIG_ARCH_LEDS is defined in the NuttX configuration, NuttX will @@ -82,7 +82,7 @@ */ #define PORT_STATUS_LED (PORT_OUTPUT | PORT_PULL_NONE | PORT_OUTPUT_SET | \ - PORTA | PORT_PIN14) + PORTB | PORT_PIN10) /* Mechanical buttons: * @@ -90,11 +90,11 @@ * RESET button connected to the SAML21 reset line and the other is a generic user * configurable button. When a button is pressed it will drive the I/O line to GND. * - * PA15 SW0 + * PA02 SW0 */ -#define PORT_SW0 (PORT_INTERRUPT | PORT_PULL_UP | PORTA | PORT_PIN15) -#define IRQ_SW0 SAM_IRQ_PA15 +#define PORT_SW0 (PORT_INTERRUPT | PORT_PULL_UP | PORTA | PORT_PIN2) +#define IRQ_SW0 SAM_IRQ_PA2 /* I/O1 * @@ -105,11 +105,10 @@ * --- ------------------ ---------------------- ------------------------------- * PIN EXT1 EXT2 Description * --- ------------------ ---------------------- ------------------------------- - * 15 PA05 SERCOM0 PAD[1] 15 PA17 SERCOM1 PAD[1] Active low chip select OUTPUT, - * SPI SS SPI SS pulled high on board. - * --- ------------------ ---------------------- ------------------------------- - * 10 PB05 PORT 10 PB15 PORT Active low card detect INPUT, - * must use internal pull-up. + * 15 PA05 SERCOM0 PAD[1] 15 PA17 GPIO] Active low chip select OUTPUT, + * SPI SS pulled high on board. + * 10 PA02 GPIO 10 PB15 GPIO Active low card detect INPUT, + * must use internal pull-up. * --- ------------------ ---------------------- ------------------------------- */ @@ -127,7 +126,7 @@ # endif # define PORT_SD_CD (PORT_INTERRUPT | PORT_INT_CHANGE | PORT_PULL_UP | \ - PORTB | PORT_PIN5) + PORTA | PORT_PIN2) # define PORT_SD_CS (PORT_OUTPUT | PORT_PULL_NONE | PORT_OUTPUT_SET | \ PORTA | PORT_PIN5) @@ -157,12 +156,14 @@ * is installed on the EXT1 or EXT2 connector: * * + * --- ------------------- -------------------- ------------------------------------- * PIN EXT1 EXT2 Description * --- ------------------- -------------------- ------------------------------------- - * 5 PB06 PORT PA20 PORT DATA_CMD_SEL - * 10 PB05 PORT PB15 PORT DISPLAY_RESET. Active low. + * 5 PB06 PA02 PA20 PA02 DATA_CMD_SEL + * 10 PA02 PA02 PB15 PA02 DISPLAY_RESET. Active low. * 15 PA05 SERCOM0 PAD[1] PA17 SERCOM1 PAD[1] DISPLAY_SS. Active low. * SPI SS SPI SS + * --- ------------------- -------------------- ------------------------------------- */ #ifdef CONFIG_SAML21_XPLAINED_OLED1MODULE @@ -193,7 +194,7 @@ # define PORT_OLED_DATA (PORT_OUTPUT | PORT_PULL_NONE | PORT_OUTPUT_CLEAR | \ PORTB | PORT_PIN6) # define PORT_OLED_RST (PORT_OUTPUT | PORT_PULL_NONE | PORT_OUTPUT_CLEAR | \ - PORTB | PORT_PIN5) + PORTA | PORT_PIN2) # define PORT_OLED_CS (PORT_OUTPUT | PORT_PULL_NONE | PORT_OUTPUT_SET | \ PORTA | PORT_PIN5)