STM32L4: Correct USART1/2 definitions. Use default mbed UART4 settings

This commit is contained in:
Sebastien Lorquet 2016-12-01 09:00:59 -06:00 committed by Gregory Nutt
parent 8b3a6d1eca
commit db24f237d7
5 changed files with 28 additions and 11 deletions

View File

@ -77,7 +77,7 @@
# define STM32L4_NBTIM 2 /* Two basic timers, TIM6-7 */ # define STM32L4_NBTIM 2 /* Two basic timers, TIM6-7 */
# define STM32L4_NLPTIM 2 /* Two low-power timers, LPTIM1-2 */ # define STM32L4_NLPTIM 2 /* Two low-power timers, LPTIM1-2 */
# define STM32L4_NRNG 1 /* Random number generator (RNG) */ # define STM32L4_NRNG 1 /* Random number generator (RNG) */
# define STM32L4_NUART 4 /* UART 4-5 */ # define STM32L4_NUART 2 /* UART 4-5 */
# define STM32L4_NUSART 3 /* USART 1-3 */ # define STM32L4_NUSART 3 /* USART 1-3 */
# define STM32L4_NLPUART 1 /* LPUART 1 */ # define STM32L4_NLPUART 1 /* LPUART 1 */
# define STM32L4_NSPI 3 /* SPI1-3 */ # define STM32L4_NSPI 3 /* SPI1-3 */

View File

@ -44,6 +44,8 @@ config STM32L4_STM32L476XX
select ARCH_HAVE_DPFPU # REVISIT select ARCH_HAVE_DPFPU # REVISIT
select ARMV7M_HAVE_ITCM select ARMV7M_HAVE_ITCM
select ARMV7M_HAVE_DTCM select ARMV7M_HAVE_DTCM
select STM32L4_HAVE_USART1
select STM32L4_HAVE_USART2
select STM32L4_HAVE_USART3 select STM32L4_HAVE_USART3
select STM32L4_HAVE_UART4 select STM32L4_HAVE_UART4
select STM32L4_HAVE_UART5 select STM32L4_HAVE_UART5
@ -55,6 +57,8 @@ config STM32L4_STM32L486XX
select ARCH_HAVE_DPFPU # REVISIT select ARCH_HAVE_DPFPU # REVISIT
select ARMV7M_HAVE_ITCM select ARMV7M_HAVE_ITCM
select ARMV7M_HAVE_DTCM select ARMV7M_HAVE_DTCM
select STM32L4_HAVE_USART1
select STM32L4_HAVE_USART2
select STM32L4_HAVE_USART3 select STM32L4_HAVE_USART3
select STM32L4_HAVE_UART4 select STM32L4_HAVE_UART4
select STM32L4_HAVE_UART5 select STM32L4_HAVE_UART5
@ -408,15 +412,17 @@ config STM32L4_SPI3
config STM32L4_USART1 config STM32L4_USART1
bool "USART1" bool "USART1"
default n default n
select USART1_SERIALDRIVER depends on STM32L4_HAVE_USART1
select ARCH_HAVE_SERIAL_TERMIOS select ARCH_HAVE_SERIAL_TERMIOS
select USART1_SERIALDRIVER
select STM32L4_USART select STM32L4_USART
config STM32L4_USART2 config STM32L4_USART2
bool "USART2" bool "USART2"
default n default n
select USART2_SERIALDRIVER depends on STM32L4_HAVE_USART2
select ARCH_HAVE_SERIAL_TERMIOS select ARCH_HAVE_SERIAL_TERMIOS
select USART2_SERIALDRIVER
select STM32L4_USART select STM32L4_USART
config STM32L4_USART3 config STM32L4_USART3
@ -2517,6 +2523,14 @@ config STM32L4_DAC_DMA_BUFFER_SIZE
endmenu endmenu
config STM32L4_HAVE_USART1
bool
default n
config STM32L4_HAVE_USART2
bool
default n
config STM32L4_HAVE_USART3 config STM32L4_HAVE_USART3
bool bool
default n default n

View File

@ -731,7 +731,7 @@ static struct stm32l4_serial_s g_uart5priv =
/* This table lets us iterate over the configured USARTs */ /* This table lets us iterate over the configured USARTs */
FAR static struct stm32l4_serial_s * const uart_devs[STM32L4_NUSART] = FAR static struct stm32l4_serial_s * const uart_devs[STM32L4_NUSART+STM32L4_NUART] =
{ {
#ifdef CONFIG_STM32L4_USART1 #ifdef CONFIG_STM32L4_USART1
[0] = &g_usart1priv, [0] = &g_usart1priv,
@ -2407,7 +2407,7 @@ void up_earlyserialinit(void)
/* Disable all USART interrupts */ /* Disable all USART interrupts */
for (i = 0; i < STM32L4_NUSART; i++) for (i = 0; i < STM32L4_NUSART+STM32L4_NUART; i++)
{ {
if (uart_devs[i]) if (uart_devs[i])
{ {
@ -2476,7 +2476,7 @@ void up_serialinit(void)
strcpy(devname, "/dev/ttySx"); strcpy(devname, "/dev/ttySx");
for (i = 0; i < STM32L4_NUSART; i++) for (i = 0; i < STM32L4_NUSART+STM32L4_NUART; i++)
{ {
/* Don't create a device for non-configured ports. */ /* Don't create a device for non-configured ports. */

View File

@ -57,19 +57,19 @@
* device. * device.
*/ */
#if STM32L4_NUSART < 5 || !defined(CONFIG_STM32L4_HAVE_UART5) #if !defined(CONFIG_STM32L4_HAVE_UART5)
# undef CONFIG_STM32L4_UART5 # undef CONFIG_STM32L4_UART5
#endif #endif
#if STM32L4_NUSART < 4 || !defined(CONFIG_STM32L4_HAVE_UART4) #if !defined(CONFIG_STM32L4_HAVE_UART4)
# undef CONFIG_STM32L4_UART4 # undef CONFIG_STM32L4_UART4
#endif #endif
#if STM32L4_NUSART < 3 || !defined(CONFIG_STM32L4_HAVE_USART3) #if !defined(CONFIG_STM32L4_HAVE_USART3)
# undef CONFIG_STM32L4_USART3 # undef CONFIG_STM32L4_USART3
#endif #endif
#if STM32L4_NUSART < 2 #if !defined(CONFIG_STM32L4_HAVE_USART2)
# undef CONFIG_STM32L4_USART2 # undef CONFIG_STM32L4_USART2
#endif #endif
#if STM32L4_NUSART < 1 #if !defined(CONFIG_STM32L4_HAVE_USART1)
# undef CONFIG_STM32L4_USART1 # undef CONFIG_STM32L4_USART1
#endif #endif

View File

@ -102,6 +102,9 @@
#define GPIO_USART2_RTS GPIO_USART2_RTS_2 #define GPIO_USART2_RTS GPIO_USART2_RTS_2
#define GPIO_USART2_CTS GPIO_USART2_CTS_2 #define GPIO_USART2_CTS GPIO_USART2_CTS_2
#define GPIO_UART4_RX GPIO_UART4_RX_1 /* PA1 */
#define GPIO_UART4_TX GPIO_UART4_TX_1 /* PA0 */
/* I2C /* I2C
* *
* The optional _GPIO configurations allow the I2C driver to manually * The optional _GPIO configurations allow the I2C driver to manually