From 3c2fbe3d9cc48719dea91f14fc698d0186486a60 Mon Sep 17 00:00:00 2001 From: Adam Feuer Date: Tue, 31 Dec 2019 06:10:46 -0800 Subject: [PATCH] sama3 sam_serial.c USART selection fixes (#13) arch/arm/src/sama5/sam_serial.c: uart2port in sam_serial, fix the rest of the uarts in sam_serial boards/arm/sama5/sama5d2-xult/README.txt: Fix some minor typos boards/arm/sama5/sama5d2-xult/include/board.h: Update UART pin disambiguation with default UARTn_RXD, _TXD --- arch/arm/src/sama5/sam_serial.c | 38 +++++++++---------- boards/arm/sama5/sama5d2-xult/README.txt | 6 +-- boards/arm/sama5/sama5d2-xult/include/board.h | 28 ++++++++++++++ 3 files changed, 50 insertions(+), 22 deletions(-) diff --git a/arch/arm/src/sama5/sam_serial.c b/arch/arm/src/sama5/sam_serial.c index a368140eb5..aaf26e7aee 100644 --- a/arch/arm/src/sama5/sam_serial.c +++ b/arch/arm/src/sama5/sam_serial.c @@ -119,16 +119,16 @@ # define TTYS0_DEV g_uart1port /* UART1 is ttyS0 */ # define UART1_ASSIGNED 1 #elif defined(CONFIG_UART2_SERIAL_CONSOLE) -# define CONSOLE_DEV g_uart1port /* UART2 is console */ -# define TTYS0_DEV g_uart1port /* UART2 is ttyS0 */ +# define CONSOLE_DEV g_uart2port /* UART2 is console */ +# define TTYS0_DEV g_uart2port /* UART2 is ttyS0 */ # define UART2_ASSIGNED 1 #elif defined(CONFIG_UART3_SERIAL_CONSOLE) -# define CONSOLE_DEV g_uart1port /* UART3 is console */ -# define TTYS0_DEV g_uart1port /* UART3 is ttyS0 */ +# define CONSOLE_DEV g_uart3port /* UART3 is console */ +# define TTYS0_DEV g_uart3port /* UART3 is ttyS0 */ # define UART3_ASSIGNED 1 #elif defined(CONFIG_UART4_SERIAL_CONSOLE) -# define CONSOLE_DEV g_uart1port /* UART4 is console */ -# define TTYS0_DEV g_uart1port /* UART4 is ttyS0 */ +# define CONSOLE_DEV g_uart4port /* UART4 is console */ +# define TTYS0_DEV g_uart4port /* UART4 is ttyS0 */ # define UART4_ASSIGNED 1 #elif defined(CONFIG_USART0_SERIAL_CONSOLE) # define CONSOLE_DEV g_usart0port /* USART0 is console */ @@ -159,13 +159,13 @@ # define TTYS0_DEV g_uart1port /* UART1 is ttyS0 */ # define UART1_ASSIGNED 1 # elif defined(CONFIG_SAMA5_UART2) -# define TTYS0_DEV g_uart1port /* UART2 is ttyS0 */ +# define TTYS0_DEV g_uart2port /* UART2 is ttyS0 */ # define UART2_ASSIGNED 1 # elif defined(CONFIG_SAMA5_UART3) -# define TTYS0_DEV g_uart1port /* UART3 is ttyS0 */ +# define TTYS0_DEV g_uart3port /* UART3 is ttyS0 */ # define UART3_ASSIGNED 1 # elif defined(CONFIG_SAMA5_UART4) -# define TTYS0_DEV g_uart1port /* UART4 is ttyS0 */ +# define TTYS0_DEV g_uart4port /* UART4 is ttyS0 */ # define UART4_ASSIGNED 1 # elif defined(CONFIG_USART0_SERIALDRIVER) # define TTYS0_DEV g_usart0port /* USART0 is ttyS0 */ @@ -194,13 +194,13 @@ # define TTYS1_DEV g_uart1port /* UART1 is ttyS1 */ # define UART1_ASSIGNED 1 #elif defined(CONFIG_SAMA5_UART2) && !defined(UART2_ASSIGNED) -# define TTYS1_DEV g_uart1port /* UART2 is ttyS1 */ +# define TTYS1_DEV g_uart2port /* UART2 is ttyS1 */ # define UART2_ASSIGNED 1 #elif defined(CONFIG_SAMA5_UART3) && !defined(UART3_ASSIGNED) -# define TTYS1_DEV g_uart1port /* UART3 is ttyS1 */ +# define TTYS1_DEV g_uart3port /* UART3 is ttyS1 */ # define UART3_ASSIGNED 1 #elif defined(CONFIG_SAMA5_UART4) && !defined(UART4_ASSIGNED) -# define TTYS1_DEV g_uart1port /* UART4 is ttyS1 */ +# define TTYS1_DEV g_uart4port /* UART4 is ttyS1 */ # define UART4_ASSIGNED 1 #elif defined(CONFIG_USART0_SERIALDRIVER) && !defined(USART0_ASSIGNED) # define TTYS1_DEV g_usart0port /* USART0 is ttyS1 */ @@ -228,13 +228,13 @@ # define TTYS2_DEV g_uart1port /* UART1 is ttyS2 */ # define UART1_ASSIGNED 1 #elif defined(CONFIG_SAMA5_UART2) && !defined(UART2_ASSIGNED) -# define TTYS2_DEV g_uart1port /* UART2 is ttyS2 */ +# define TTYS2_DEV g_uart2port /* UART2 is ttyS2 */ # define UART2_ASSIGNED 1 #elif defined(CONFIG_SAMA5_UART3) && !defined(UART3_ASSIGNED) -# define TTYS2_DEV g_uart1port /* UART3 is ttyS2 */ +# define TTYS2_DEV g_uart2port /* UART3 is ttyS2 */ # define UART3_ASSIGNED 1 #elif defined(CONFIG_SAMA5_UART4) && !defined(UART4_ASSIGNED) -# define TTYS2_DEV g_uart1port /* UART4 is ttyS2 */ +# define TTYS2_DEV g_uart4port /* UART4 is ttyS2 */ # define UART4_ASSIGNED 1 #elif defined(CONFIG_USART0_SERIALDRIVER) && !defined(USART0_ASSIGNED) # define TTYS2_DEV g_usart0port /* USART0 is ttyS2 */ @@ -259,10 +259,10 @@ */ #if defined(CONFIG_SAMA5_UART2) && !defined(UART2_ASSIGNED) -# define TTYS3_DEV g_uart1port /* UART2 is ttyS3 */ +# define TTYS3_DEV g_uart2port /* UART2 is ttyS3 */ # define UART2_ASSIGNED 1 #elif defined(CONFIG_SAMA5_UART3) && !defined(UART3_ASSIGNED) -# define TTYS3_DEV g_uart1port /* UART3 is ttyS3 */ +# define TTYS3_DEV g_uart3port /* UART3 is ttyS3 */ # define UART3_ASSIGNED 1 #elif defined(CONFIG_SAMA5_UART4) && !defined(UART4_ASSIGNED) # define TTYS3_DEV g_uart1port /* UART4 is ttyS3 */ @@ -290,10 +290,10 @@ */ #if defined(CONFIG_SAMA5_UART3) && !defined(UART3_ASSIGNED) -# define TTYS4_DEV g_uart1port /* UART3 is ttyS4 */ +# define TTYS4_DEV g_uart3port /* UART3 is ttyS4 */ # define UART3_ASSIGNED 1 #elif defined(CONFIG_SAMA5_UART4) && !defined(UART4_ASSIGNED) -# define TTYS4_DEV g_uart1port /* UART4 is ttyS4 */ +# define TTYS4_DEV g_uart4port /* UART4 is ttyS4 */ # define UART4_ASSIGNED 1 #elif defined(CONFIG_USART0_SERIALDRIVER) && !defined(USART0_ASSIGNED) # define TTYS4_DEV g_usart0port /* USART0 is ttyS4 */ diff --git a/boards/arm/sama5/sama5d2-xult/README.txt b/boards/arm/sama5/sama5d2-xult/README.txt index ea42732b36..f0e3b99de4 100644 --- a/boards/arm/sama5/sama5d2-xult/README.txt +++ b/boards/arm/sama5/sama5d2-xult/README.txt @@ -64,7 +64,7 @@ DRAMBOOT, AT25BOOT, SRAMBOOT The boards/arm/sama5/sama5d4-xult/README.txt also describes variants AT25BOOT and SRAMBOOT. This have not yet been ported to the SAMA5D2-XULT, but are - available if they are usefult too you. + available if they are useful too you. Running NuttX from SDRAM ======================== @@ -203,7 +203,7 @@ REVISIT: Unverified, cloned text from the SAMA5D4-EK README.txt http://www.at91.com/linux4sam/bin/view/Linux4SAM/U-Boot#Build_U_Boot_from_sources - A pre-Built binay image is available here: + A pre-Built binary image is available here: ftp://www.at91.com/pub/uboot/u-boot-v2013.07/u-boot-sama5d3_xplained-v2013.07-at91-r1.bin @@ -237,7 +237,7 @@ REVISIT: Unverified, cloned text from the SAMA5D4-EK README.txt - Press the "Send File" button - Close SAM-BA, remove the USB Device cable. - You should now be able to interrupt with U-Boot vie the DBGU interface. + You should now be able to interrupt with U-Boot via the DBGU interface. Load NuttX with U-Boot on AT91 boards ------------------------------------- diff --git a/boards/arm/sama5/sama5d2-xult/include/board.h b/boards/arm/sama5/sama5d2-xult/include/board.h index dd813233a4..5680c90b2a 100644 --- a/boards/arm/sama5/sama5d2-xult/include/board.h +++ b/boards/arm/sama5/sama5d2-xult/include/board.h @@ -228,6 +228,34 @@ #define PIO_UART1_RXD PIO_UART1_RXD_1 #define PIO_UART1_TXD PIO_UART1_TXD_1 +/* Standard UART on Arduino connector (J22) is UART2. + * + * ---- ------- ------------- + * J22 BOARD SAMA5D2 + * PIN NAME PIO FUNCTION + * ---- ------- ------------- + * 7 URXD2 PD4 UART2 URXD2 + * 8 UTXD2 PD5 UART2 UTXD2 + * ---- ------- ------------- + */ + +#define PIO_UART2_RXD PIO_UART2_RXD_2 +#define PIO_UART2_TXD PIO_UART2_TXD_2 + +/* Standard UART on Arduino connector (J17) is UART3. + * + * ---- ------- ------------- + * J17 BOARD SAMA5D2 + * PIN NAME PIO FUNCTION + * ---- ------- ------------- + * 27 URXD3 PB11 UART3 URXD3 + * 28 UTXD3 PB12 UART3 UTXD3 + * ---- ------- ------------- + */ + +#define PIO_UART3_RXD PIO_UART3_RXD_1 +#define PIO_UART3_TXD PIO_UART3_TXD_1 + /* Standard UART on Arduino connector (J21) is FLEXCOM4. * * ---- ------- -------------