SAMD20: Beginning of SERCOM UART configuration logic

This commit is contained in:
Gregory Nutt
2014-02-15 14:22:56 -06:00
parent 542e6e7bae
commit 69fd301151
4 changed files with 63 additions and 52 deletions
+34 -34
View File
@@ -7,7 +7,7 @@ ATSAMD20J18A MCU.
The SAMD20 Xplained Pro Starter Kit may be bundled with three modules: The SAMD20 Xplained Pro Starter Kit may be bundled with three modules:
1) I/O1 - An MMC/SD card slot, PWM LED control, ADC light sensor, UART 1) I/O1 - An MMC/SD card slot, PWM LED control, ADC light sensor, USART
loopback, TWI AT30TSE758 Temperature sensor. loopback, TWI AT30TSE758 Temperature sensor.
2) OLED1 - An OLED plus 3 additional switches and 3 additional LEDs 2) OLED1 - An OLED plus 3 additional switches and 3 additional LEDs
3) PROTO1 - A prototyping board with logic on board (other than power-related 3) PROTO1 - A prototyping board with logic on board (other than power-related
@@ -38,7 +38,7 @@ Modules
- microSD card connector (SPI interface) - microSD card connector (SPI interface)
- PWM (LED control) - PWM (LED control)
- ADC (light sensor) - ADC (light sensor)
- UART loopback - USART loopback
- TWI AT30TSE758 Temperature sensor with EEPROM - TWI AT30TSE758 Temperature sensor with EEPROM
SPI is available on two of the SAMD20 Xplained connectors, EXT1 and EXT2. SPI is available on two of the SAMD20 Xplained connectors, EXT1 and EXT2.
@@ -75,12 +75,12 @@ Modules
12 TWI SCL 12 PA09 SERCOM2 PAD[1] 12 PA09 SERCOM2 PAD[1] EXT2, EXT3 and EDBG 12 TWI SCL 12 PA09 SERCOM2 PAD[1] 12 PA09 SERCOM2 PAD[1] EXT2, EXT3 and EDBG
I²C SCL I²C SCL I²C SCL I²C SCL
----------------- ---------------------- ---------------------- ------------------------------------ ----------------- ---------------------- ---------------------- ------------------------------------
13 UART 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 PB13 SERCOM4 PAD[1] The SERCOM4 module is shared between
UART RX UART RX EXT1, 2 and 3 UART's, but uses USART RX USART RX EXT1, 2 and 3 USART's, but uses
different pins different pins
----------------- ---------------------- ---------------------- ------------------------------------ ----------------- ---------------------- ---------------------- ------------------------------------
14 UART 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 PB12 SERCOM4 PAD[0] The SERCOM4 module is shared between
UART TX UART TX EXT1, 2 and 3 UART's, but uses USART TX USART TX EXT1, 2 and 3 USART's, but uses
different pins different pins
----------------- ---------------------- ---------------------- ------------------------------------ ----------------- ---------------------- ---------------------- ------------------------------------
15 microSD_SS 15 PA05 SERCOM0 PAD[1] 15 PA17 SERCOM1 PAD[1] 15 microSD_SS 15 PA05 SERCOM0 PAD[1] 15 PA17 SERCOM1 PAD[1]
@@ -189,11 +189,11 @@ Modules
I²C SCL I²C SCL 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 PB13 SERCOM4 PAD[1] The SERCOM4 module is shared between
UART RX UART RX EXT1, 2 and 3 UART's, but uses USART RX USART RX EXT1, 2 and 3 USART's, but uses
different pins 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 PB12 SERCOM4 PAD[0] The SERCOM4 module is shared between
UART TX UART TX EXT1, 2 and 3 UART's, but uses USART TX USART TX EXT1, 2 and 3 USART's, but uses
different pins different pins
----------------- ---------------------- ---------------------- ------------------------------------ ----------------- ---------------------- ---------------------- ------------------------------------
15 DISPLAY_SS 15 PA05 SERCOM0 PAD[1] 15 PA17 SERCOM1 PAD[1] 15 DISPLAY_SS 15 PA05 SERCOM0 PAD[1] 15 PA17 SERCOM1 PAD[1]
@@ -406,8 +406,8 @@ Serial Consoles
PIN EXT1 EXT3 GPIO Function PIN EXT1 EXT3 GPIO Function
---- ---- ------ ----------- ---- ---- ------ -----------
13 PB09 PB13 SERCOM4 / UART RX 13 PB09 PB13 SERCOM4 / USART RX
14 PB08 PB12 SERCOM4 / UART TX 14 PB08 PB12 SERCOM4 / USART TX
19 19 GND 19 19 GND
20 20 VCC 20 20 VCC
@@ -423,8 +423,8 @@ Serial Consoles
The Embedded debugger also include a Virtual Com port interface over The Embedded debugger also include a Virtual Com port interface over
SERCOM3. Virtual COM port connections: SERCOM3. Virtual COM port connections:
PA24 SERCOM3 / UART TXD PA24 SERCOM3 / USART TXD
PA25 SERCOM3 / UART RXD PA25 SERCOM3 / USART RXD
SAMD20 Xplained Pro-specific Configuration Options SAMD20 Xplained Pro-specific Configuration Options
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -527,25 +527,25 @@ SAMD20 Xplained Pro-specific Configuration Options
Some subsystems can be configured to operate in different ways. The drivers Some subsystems can be configured to operate in different ways. The drivers
need to know how to configure the subsystem. need to know how to configure the subsystem.
CONFIG_SAMD_SERCOM0_ISI2C, CONFIG_SAMD_SERCOM0_ISSPI, or CONFIG_SAMD_SERCOM0_ISUART CONFIG_SAMD_SERCOM0_ISI2C, CONFIG_SAMD_SERCOM0_ISSPI, or CONFIG_SAMD_SERCOM0_ISUSART
CONFIG_SAMD_SERCOM1_ISI2C, CONFIG_SAMD_SERCOM1_ISSPI, or CONFIG_SAMD_SERCOM1_ISUART CONFIG_SAMD_SERCOM1_ISI2C, CONFIG_SAMD_SERCOM1_ISSPI, or CONFIG_SAMD_SERCOM1_ISUSART
CONFIG_SAMD_SERCOM2_ISI2C, CONFIG_SAMD_SERCOM2_ISSPI, or CONFIG_SAMD_SERCOM2_ISUART CONFIG_SAMD_SERCOM2_ISI2C, CONFIG_SAMD_SERCOM2_ISSPI, or CONFIG_SAMD_SERCOM2_ISUSART
CONFIG_SAMD_SERCOM3_ISI2C, CONFIG_SAMD_SERCOM3_ISSPI, or CONFIG_SAMD_SERCOM3_ISUART CONFIG_SAMD_SERCOM3_ISI2C, CONFIG_SAMD_SERCOM3_ISSPI, or CONFIG_SAMD_SERCOM3_ISUSART
CONFIG_SAMD_SERCOM4_ISI2C, CONFIG_SAMD_SERCOM4_ISSPI, or CONFIG_SAMD_SERCOM4_ISUART CONFIG_SAMD_SERCOM4_ISI2C, CONFIG_SAMD_SERCOM4_ISSPI, or CONFIG_SAMD_SERCOM4_ISUSART
CONFIG_SAMD_SERCOM5_ISI2C, CONFIG_SAMD_SERCOM5_ISSPI, or CONFIG_SAMD_SERCOM5_ISUART CONFIG_SAMD_SERCOM5_ISI2C, CONFIG_SAMD_SERCOM5_ISSPI, or CONFIG_SAMD_SERCOM5_ISUSART
SAT91SAMD20 specific device driver settings SAT91SAMD20 specific device driver settings
CONFIG_UARTn_SERIAL_CONSOLE - selects the USARTn (n=0,1,2,..5) for the CONFIG_USARTn_SERIAL_CONSOLE - selects the USARTn (n=0,1,2,..5) for the
console and ttys0 (default is the UART4). console and ttys0 (default is the USART4).
CONFIG_UARTn_RXBUFSIZE - Characters are buffered as received. CONFIG_USARTn_RXBUFSIZE - Characters are buffered as received.
This specific the size of the receive buffer This specific the size of the receive buffer
CONFIG_UARTn_TXBUFSIZE - Characters are buffered before CONFIG_USARTn_TXBUFSIZE - Characters are buffered before
being sent. This specific the size of the transmit buffer being sent. This specific the size of the transmit buffer
CONFIG_UARTn_BAUD - The configure BAUD of the UART. Must be CONFIG_USARTn_BAUD - The configure BAUD of the USART. Must be
CONFIG_UARTn_BITS - The number of bits. Must be either 7 or 8. CONFIG_USARTn_BITS - The number of bits. Must be either 7 or 8.
CONFIG_UARTn_PARTIY - 0=no parity, 1=odd parity, 2=even parity CONFIG_USARTn_PARTIY - 0=no parity, 1=odd parity, 2=even parity
CONFIG_UARTn_2STOP - Two stop bits CONFIG_USARTn_2STOP - Two stop bits
Configurations Configurations
^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^
@@ -601,15 +601,15 @@ Configurations
CONFIG_SAMD_SERCOM4=n CONFIG_SAMD_SERCOM4=n
Device Drivers -> Serial Driver Support -> Serial Console Device Drivers -> Serial Driver Support -> Serial Console
CONFIG_UART3_SERIAL_CONSOLE=y CONFIG_USART3_SERIAL_CONSOLE=y
Device Drivers -> Serial Driver Support -> SERCOM4 Configuration Device Drivers -> Serial Driver Support -> SERCOM4 Configuration
CONFIG_UART3_2STOP=0 CONFIG_USART3_2STOP=0
CONFIG_UART3_BAUD=115200 CONFIG_USART3_BAUD=115200
CONFIG_UART3_BITS=8 CONFIG_USART3_BITS=8
CONFIG_UART3_PARITY=0 CONFIG_USART3_PARITY=0
CONFIG_UART3_RXBUFSIZE=256 CONFIG_USART3_RXBUFSIZE=256
CONFIG_UART3_TXBUFSIZE=256 CONFIG_USART3_TXBUFSIZE=256
3. Unless otherwise stated, the configurations are setup for 3. Unless otherwise stated, the configurations are setup for
Cygwin under Windows: Cygwin under Windows:
@@ -703,7 +703,7 @@ Configuration sub-directories
CONFIG_NSH_ARCHINIT=y : Board has architecture-specific initialization CONFIG_NSH_ARCHINIT=y : Board has architecture-specific initialization
NOTE: If you enable the I/O1 this configuration with SERCOM4 as the 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 UART 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 lookpack on SERCOM4 and NSH will *not*
behave very well (since its outgoing prompts also appear as incoming behave very well (since its outgoing prompts also appear as incoming
commands). commands).
+10
View File
@@ -339,6 +339,16 @@
#define BOARD_FLASH_WAITSTATES 0 #define BOARD_FLASH_WAITSTATES 0
/* SERCOM definitions ***************************************************************/
/* EDBG/CDC USART on SERCOM3 */
#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
#define BOARD_SERCOM3_PINMAP_PAD3 PORT_SERCOM3_PAD3_1
/* LED definitions ******************************************************************/ /* LED definitions ******************************************************************/
/* There are three LEDs on board the SAMD20 Xplained Pro board: The EDBG /* There are three LEDs on board the SAMD20 Xplained Pro board: The EDBG
* controls two of the LEDs, a power LED and a status LED. There is only * controls two of the LEDs, a power LED and a status LED. There is only
+17 -16
View File
@@ -152,8 +152,8 @@ CONFIG_SAMD_HAVE_TC7=y
# CONFIG_SAMD_SERCOM0 is not set # CONFIG_SAMD_SERCOM0 is not set
# CONFIG_SAMD_SERCOM1 is not set # CONFIG_SAMD_SERCOM1 is not set
# CONFIG_SAMD_SERCOM2 is not set # CONFIG_SAMD_SERCOM2 is not set
# CONFIG_SAMD_SERCOM3 is not set CONFIG_SAMD_SERCOM3=y
CONFIG_SAMD_SERCOM4=y # CONFIG_SAMD_SERCOM4 is not set
# CONFIG_SAMD_SERCOM5 is not set # CONFIG_SAMD_SERCOM5 is not set
# CONFIG_SAMD_TC0 is not set # CONFIG_SAMD_TC0 is not set
# CONFIG_SAMD_TC1 is not set # CONFIG_SAMD_TC1 is not set
@@ -167,9 +167,9 @@ CONFIG_SAMD_SERCOM4=y
# CONFIG_SAMD_AC is not set # CONFIG_SAMD_AC is not set
# CONFIG_SAMD_DAC is not set # CONFIG_SAMD_DAC is not set
# CONFIG_SAMD_PTC is not set # CONFIG_SAMD_PTC is not set
# CONFIG_SAMD_SERCOM4_ISI2C is not set # CONFIG_SAMD_SERCOM3_ISI2C is not set
# CONFIG_SAMD_SERCOM4_ISSPI is not set # CONFIG_SAMD_SERCOM3_ISSPI is not set
CONFIG_SAMD_SERCOM4_ISUART=y CONFIG_SAMD_SERCOM3_ISUSART=y
# #
# Architecture Options # Architecture Options
@@ -343,27 +343,28 @@ CONFIG_DEV_NULL=y
CONFIG_SERIAL=y CONFIG_SERIAL=y
# CONFIG_DEV_LOWCONSOLE is not set # CONFIG_DEV_LOWCONSOLE is not set
# CONFIG_16550_UART is not set # CONFIG_16550_UART is not set
CONFIG_ARCH_HAVE_UART4=y CONFIG_ARCH_HAVE_USART3=y
# #
# USART Configuration # USART Configuration
# #
CONFIG_USART3_ISUART=y
CONFIG_MCU_SERIAL=y CONFIG_MCU_SERIAL=y
CONFIG_STANDARD_SERIAL=y CONFIG_STANDARD_SERIAL=y
CONFIG_UART4_SERIAL_CONSOLE=y CONFIG_USART3_SERIAL_CONSOLE=y
# CONFIG_NO_SERIAL_CONSOLE is not set # CONFIG_NO_SERIAL_CONSOLE is not set
# #
# UART4 Configuration # USART3 Configuration
# #
CONFIG_UART4_RXBUFSIZE=256 CONFIG_USART3_RXBUFSIZE=64
CONFIG_UART4_TXBUFSIZE=256 CONFIG_USART3_TXBUFSIZE=64
CONFIG_UART4_BAUD=115200 CONFIG_USART3_BAUD=9600
CONFIG_UART4_BITS=8 CONFIG_USART3_BITS=8
CONFIG_UART4_PARITY=0 CONFIG_USART3_PARITY=0
CONFIG_UART4_2STOP=0 CONFIG_USART3_2STOP=0
# CONFIG_UART4_IFLOWCONTROL is not set # CONFIG_USART3_IFLOWCONTROL is not set
# CONFIG_UART4_OFLOWCONTROL is not set # CONFIG_USART3_OFLOWCONTROL is not set
# CONFIG_SERIAL_IFLOWCONTROL is not set # CONFIG_SERIAL_IFLOWCONTROL is not set
# CONFIG_SERIAL_OFLOWCONTROL is not set # CONFIG_SERIAL_OFLOWCONTROL is not set
# CONFIG_USBDEV is not set # CONFIG_USBDEV is not set
@@ -66,10 +66,10 @@
* I²C SCL I²C SCL * I²C SCL I²C SCL
* ----------------- ---------------------- ---------------------- * ----------------- ---------------------- ----------------------
* 13 N/C 13 PB09 SERCOM4 PAD[1] 13 PB13 SERCOM4 PAD[1] * 13 N/C 13 PB09 SERCOM4 PAD[1] 13 PB13 SERCOM4 PAD[1]
* UART RX UART RX * USART RX USART RX
* ----------------- ---------------------- ---------------------- * ----------------- ---------------------- ----------------------
* 14 N/C 14 PB08 SERCOM4 PAD[0] 14 PB12 SERCOM4 PAD[0] * 14 N/C 14 PB08 SERCOM4 PAD[0] 14 PB12 SERCOM4 PAD[0]
* UART TX UART TX * USART TX USART TX
* ----------------- ---------------------- ---------------------- * ----------------- ---------------------- ----------------------
* 15 DISPLAY_SS 15 PA05 SERCOM0 PAD[1] 15 PA17 SERCOM1 PAD[1] * 15 DISPLAY_SS 15 PA05 SERCOM0 PAD[1] 15 PA17 SERCOM1 PAD[1]
* SPI SS SPI SS * SPI SS SPI SS