diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2011-07-04 22:38:45 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2011-07-04 22:38:45 +0000 |
commit | 27654586d00c4fb566ce1f218d52bd1f0282a6cd (patch) | |
tree | 8081c21f09fa32ac906c1b0a07b51c85d4c0b4ea | |
parent | 935109930f10485e622386010fe03e0ef0e34497 (diff) | |
download | nuttx-27654586d00c4fb566ce1f218d52bd1f0282a6cd.tar.gz nuttx-27654586d00c4fb566ce1f218d52bd1f0282a6cd.tar.bz2 nuttx-27654586d00c4fb566ce1f218d52bd1f0282a6cd.zip |
Correct several errors in STM32 serial port configuration
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3744 42af7a65-404d-4744-a932-0658087f49c3
-rw-r--r-- | apps/nshlib/README.txt | 6 | ||||
-rw-r--r-- | apps/nshlib/nsh_serial.c | 2 | ||||
-rw-r--r-- | nuttx/ChangeLog | 11 | ||||
-rw-r--r-- | nuttx/Documentation/NuttShell.html | 6 | ||||
-rw-r--r-- | nuttx/arch/arm/src/stm32/stm32_lowputc.c | 6 | ||||
-rw-r--r-- | nuttx/arch/arm/src/stm32/stm32_serial.c | 8 | ||||
-rwxr-xr-x | nuttx/configs/stm3210e-eval/README.txt | 13 | ||||
-rw-r--r-- | nuttx/configs/stm3210e-eval/nsh2/defconfig | 2 |
8 files changed, 41 insertions, 13 deletions
diff --git a/apps/nshlib/README.txt b/apps/nshlib/README.txt index f64f39cf9..a678824e3 100644 --- a/apps/nshlib/README.txt +++ b/apps/nshlib/README.txt @@ -901,6 +901,12 @@ NSH-Specific Configuration Settings the system console is used to provide debug output. Default: stdin and stdout (probably "/dev/console") + NOTE: 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 set + your terminal program to account for this. And (2) input is + not automatically echoed so you will have to turn local echo on. + * CONFIG_NSH_TELNET If CONFIG_NSH_TELNET is set to 'y', then a TELENET server front-end is selected. When this option is provided, diff --git a/apps/nshlib/nsh_serial.c b/apps/nshlib/nsh_serial.c index 29e60d9e3..ccb25477d 100644 --- a/apps/nshlib/nsh_serial.c +++ b/apps/nshlib/nsh_serial.c @@ -476,7 +476,7 @@ int nsh_consolemain(int argc, char *argv[]) /* Present a greeting */ - fprintf(pstate->ss_outstream, g_nshgreeting); + fputs(g_nshgreeting, pstate->ss_outstream); fflush(pstate->ss_outstream); /* Execute the startup script */ diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index 48331aa84..296747089 100644 --- a/nuttx/ChangeLog +++ b/nuttx/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/nuttx/Documentation/NuttShell.html b/nuttx/Documentation/NuttShell.html index ab470ee11..4ee51a48c 100644 --- a/nuttx/Documentation/NuttShell.html +++ b/nuttx/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: <code>stdin</code> and <code>stdout</code> (probably "<code>/dev/console</code>") + <ul><small> + NOTE: When any other device other than <code>/dev/console</code> is used for a user interface, + (1) linefeeds (<code>\n</code>) will not be expanded to carriage return / linefeeds (<code>\r\n</code>). + 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. + </small></ul> </td> <tr> <td valign="top"><b><code>CONFIG_NSH_TELNET</code></b></td> diff --git a/nuttx/arch/arm/src/stm32/stm32_lowputc.c b/nuttx/arch/arm/src/stm32/stm32_lowputc.c index fe6f51386..4d7527962 100644 --- a/nuttx/arch/arm/src/stm32/stm32_lowputc.c +++ b/nuttx/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/nuttx/arch/arm/src/stm32/stm32_serial.c b/nuttx/arch/arm/src/stm32/stm32_serial.c index a529285f4..7255ef491 100644 --- a/nuttx/arch/arm/src/stm32/stm32_serial.c +++ b/nuttx/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/nuttx/configs/stm3210e-eval/README.txt b/nuttx/configs/stm3210e-eval/README.txt index 33a04ceaa..f26dbc5d1 100755 --- a/nuttx/configs/stm3210e-eval/README.txt +++ b/nuttx/configs/stm3210e-eval/README.txt @@ -430,13 +430,13 @@ Where <subdir> 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 <subdir> 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/nuttx/configs/stm3210e-eval/nsh2/defconfig b/nuttx/configs/stm3210e-eval/nsh2/defconfig index 32b40bce9..f91fe10ee 100644 --- a/nuttx/configs/stm3210e-eval/nsh2/defconfig +++ b/nuttx/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 |