diff --git a/ChangeLog b/ChangeLog index 48331aa847..296747089d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1856,4 +1856,15 @@ Storage Demo Board," Model DB-DP11215 (http://www.sureelectronics.net/goods.php?id=1168). This board features the MicroChip PIC32MX440F512H MCU. (Untested on initial check-in). + * configs/stm3210e-eval/nsh2: Add another NSH configuration for the STM32 with + some different properties. + * CONFIG_NSH_CONDEV: Add a configuration option to allow using a different character + device (such a a different UART) for the NSH interface. This allows, for example, + debug output to come from the console device while using another device for NSH. + There are some issues on initial check-in: NuttX doesn't have termios and the + console device has special properties that make using NSH awkward. Examples: + No CR-LF expansion, no character echoing, no command line editting. + * arch/arm/src/stm32/stm32_lowputc.c and stm32_serial.c. Correct severl bugs + involving serial port configuration. These bugs are only critical if you + are trying to using multiple UARTs on STM32. diff --git a/Documentation/NuttShell.html b/Documentation/NuttShell.html index ab470ee115..4ee51a48ce 100644 --- a/Documentation/NuttShell.html +++ b/Documentation/NuttShell.html @@ -2155,6 +2155,12 @@ nsh> This is useful, for example, to separate the NSH command line from the system console when the system console is used to provide debug output. Default: stdin and stdout (probably "/dev/console") + CONFIG_NSH_TELNET diff --git a/arch/arm/src/stm32/stm32_lowputc.c b/arch/arm/src/stm32/stm32_lowputc.c index fe6f513867..4d75279625 100644 --- a/arch/arm/src/stm32/stm32_lowputc.c +++ b/arch/arm/src/stm32/stm32_lowputc.c @@ -162,9 +162,9 @@ #define STM32_USARTDIV32 (STM32_APBCLOCK / (STM32_CONSOLE_BAUD >> 1)) -/* The mantissa is then usartdiv32 * 32: +/* The mantissa is then usartdiv32 / 32: * - * mantissa = 32 * usartdiv32 + * mantissa = usartdiv32 / 32/ * * Eg. usartdiv32=1250, mantissa = 39 */ @@ -247,7 +247,7 @@ void stm32_lowsetup(void) uint32_t cr; #endif - /* Enable the selected USARTs and configure GPIO pins need byed the + /* Enable the selected USARTs and configure GPIO pins need by the * the selected USARTs. NOTE: The serial driver later depends on * this pin configuration -- whether or not a serial console is selected. * diff --git a/arch/arm/src/stm32/stm32_serial.c b/arch/arm/src/stm32/stm32_serial.c index a529285f45..7255ef491f 100644 --- a/arch/arm/src/stm32/stm32_serial.c +++ b/arch/arm/src/stm32/stm32_serial.c @@ -425,8 +425,8 @@ static inline void up_disableusartint(struct up_dev_s *priv, uint16_t *ie) static int up_setup(struct uart_dev_s *dev) { struct up_dev_s *priv = (struct up_dev_s*)dev->priv; -#ifdef CONFIG_SUPPRESS_UART_CONFIG - uint32_t uartdiv32; +#ifndef CONFIG_SUPPRESS_UART_CONFIG + uint32_t usartdiv32; uint32_t mantissa; uint32_t fraction; uint32_t brr; @@ -483,7 +483,7 @@ static int up_setup(struct uart_dev_s *dev) /* Configure hardware flow control -- Not yet supported */ - up_serialout(priv, STM32_USART_CR1_OFFSET, regval); + up_serialout(priv, STM32_USART_CR3_OFFSET, regval); /* Configure the USART Baud Rate. The baud rate for the receiver and * transmitter (Rx and Tx) are both set to the same value as programmed @@ -521,7 +521,7 @@ static int up_setup(struct uart_dev_s *dev) up_serialout(priv, STM32_USART_CR1_OFFSET, regval); #endif - /* Set up the cache interrupt enables value */ + /* Set up the cached interrupt enables value */ priv->ie = 0; return OK; diff --git a/configs/stm3210e-eval/README.txt b/configs/stm3210e-eval/README.txt index 33a04ceaa2..f26dbc5d1d 100755 --- a/configs/stm3210e-eval/README.txt +++ b/configs/stm3210e-eval/README.txt @@ -430,13 +430,13 @@ Where is one of the following: =========== ======================= ================================ nsh nsh2 =========== ======================= ================================ - Toolchain: NuttX buildroot for Codesourcery for Windows* - Linux or Cygwin*,** + Toolchain: NuttX buildroot for Codesourcery for Windows * + Linux or Cygwin *,** ----------- ----------------------- -------------------------------- Loader: DfuSe DfuSe ----------- ----------------------- -------------------------------- Serial Debug output: USART1 Debug output: USART1 - Console: NSH output: USART1 NSH output: USART2 + Console: NSH output: USART1 NSH output: USART2 *** ----------- ----------------------- -------------------------------- I2C1 Disabled Enabled =========== ======================= ================================ @@ -445,7 +445,12 @@ Where is one of the following: to set up the correct PATH variable for whichever toolchain you may use. ** Since DfuSe is assumed, this configuration may only work under - Cygwin. + Cygwin without modification. + *** When any other device other than /dev/console is used for a user + interface, (1) linefeeds (\n) will not be expanded to carriage return + / linefeeds \r\n). You will need to configure your terminal program + to account for this. And (2) input is not automatically echoed so + you will have to turn local echo on. ostest: ------ diff --git a/configs/stm3210e-eval/nsh2/defconfig b/configs/stm3210e-eval/nsh2/defconfig index 32b40bce92..f91fe10ee8 100644 --- a/configs/stm3210e-eval/nsh2/defconfig +++ b/configs/stm3210e-eval/nsh2/defconfig @@ -727,7 +727,7 @@ CONFIG_NSH_DISABLESCRIPT=n CONFIG_NSH_DISABLEBG=n CONFIG_NSH_ROMFSETC=n CONFIG_NSH_CONSOLE=y -#CONFIG_NSH_CONDEV="/dev/ttyS1" +CONFIG_NSH_CONDEV="/dev/ttyS1" CONFIG_NSH_TELNET=n CONFIG_NSH_ARCHINIT=y CONFIG_NSH_IOBUFFER_SIZE=512