From e7b29c3eacdc97c409d5354b87d93067eb35d3b9 Mon Sep 17 00:00:00 2001 From: px4dev Date: Fri, 7 Sep 2012 02:35:58 -0700 Subject: [PATCH] Fix receive DMA for the console device. Now maybe MAVLink will work better. --- nuttx/arch/arm/src/stm32/stm32_serial.c | 7 +++++++ nuttx/configs/px4fmu/nsh/defconfig | 6 +++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/nuttx/arch/arm/src/stm32/stm32_serial.c b/nuttx/arch/arm/src/stm32/stm32_serial.c index 265abfbf35..83acc676bb 100644 --- a/nuttx/arch/arm/src/stm32/stm32_serial.c +++ b/nuttx/arch/arm/src/stm32/stm32_serial.c @@ -1835,6 +1835,13 @@ void up_serialinit(void) #if CONSOLE_UART > 0 (void)uart_register("/dev/console", &uart_devs[CONSOLE_UART - 1]->dev); (void)uart_register("/dev/ttyS0", &uart_devs[CONSOLE_UART - 1]->dev); + + /* If we need to re-initialise the console (e.g. to enable DMA) do that here. */ + +# if CONFIG_SERIAL_CONSOLE_REINIT + uart_devs[CONSOLE_UART - 1]->dev.ops->setup(&uart_devs[CONSOLE_UART - 1]->dev); +# endif + #endif /* Register all remaining USARTs */ diff --git a/nuttx/configs/px4fmu/nsh/defconfig b/nuttx/configs/px4fmu/nsh/defconfig index 89322daf98..4d2b254bd0 100755 --- a/nuttx/configs/px4fmu/nsh/defconfig +++ b/nuttx/configs/px4fmu/nsh/defconfig @@ -221,6 +221,9 @@ CONFIG_AT24XX_MTD_BLOCKSIZE=256 # tcflush, etc.). If this is not defined, then the terminal settings (baud, # parity, etc.) are not configurable at runtime; serial streams cannot be # flushed, etc. +# CONFIG_SERIAL_CONSOLE_REINIT - re-initializes the console serial port +# immediately after creating the /dev/console device. This is required +# if the console serial port has RX DMA enabled. # # CONFIG_USARTn_SERIAL_CONSOLE - selects the USARTn for the # console and ttys0 (default is the USART1). @@ -234,6 +237,7 @@ CONFIG_AT24XX_MTD_BLOCKSIZE=256 # CONFIG_USARTn_2STOP - Two stop bits # CONFIG_SERIAL_TERMIOS=y +CONFIG_SERIAL_CONSOLE_REINIT=y CONFIG_USART1_SERIAL_CONSOLE=y CONFIG_USART2_SERIAL_CONSOLE=n @@ -285,7 +289,7 @@ CONFIG_USART4_2STOP=0 CONFIG_USART5_2STOP=0 CONFIG_USART6_2STOP=0 -CONFIG_USART1_RXDMA=n +CONFIG_USART1_RXDMA=y CONFIG_USART2_RXDMA=y CONFIG_USART3_RXDMA=n CONFIG_USART4_RXDMA=n