9
0
Fork 0

Correct several errors in STM32 serial port configuration

git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@3744 7fd9a85b-ad96-42d3-883c-3090e2eb8679
This commit is contained in:
patacongo 2011-07-04 22:38:45 +00:00
parent ba776e228d
commit fb7618620c
8 changed files with 41 additions and 13 deletions

View File

@ -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,

View File

@ -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 */

View File

@ -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.

View File

@ -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 &quot;<code>/dev/console</code>&quot;)
<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>

View File

@ -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.
*

View File

@ -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;

View File

@ -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:
------

View File

@ -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