stm32: serial use 115200 baud rate

115200 is a much more sane "default" than 38400.
Instead of a mix of 38400 and 115200, just use 115200 in all places.
There's no reason for modern 32bit cpus to be using such old slow
baudrates.

Tested on f1, f4, l1.  Replaced some old f1 code that predated some
library support code for this.
This commit is contained in:
Karl Palsson
2019-06-02 16:08:13 +00:00
parent e0f377fec0
commit be1d296e2f
32 changed files with 37 additions and 45 deletions

View File

@@ -8,4 +8,4 @@ ADC\_IN1 input, and prints it to the serial port.
| Port | Function | Description |
| ----- | ----------- | --------------------------------- |
| `PA1` | `(ADC_IN1)` | Analog input |
| `PA9` | `(USART1)` | TTL serial output `(38400,8,N,1)` |
| `PA9` | `(USART1)` | TTL serial output `(115200,8,N,1)` |

View File

@@ -68,7 +68,7 @@ static void usart_setup(void)
gpio_set_af(GPIOA, GPIO_AF1, GPIO9);
/* Setup UART parameters. */
usart_set_baudrate(USART1, 38400);
usart_set_baudrate(USART1, 115200);
usart_set_databits(USART1, 8);
usart_set_stopbits(USART1, USART_CR2_STOPBITS_1);
usart_set_mode(USART1, USART_MODE_TX);

View File

@@ -9,4 +9,4 @@ The sending is done in a blocking way.
| Port | Function | Description |
| ----- | ------------- | --------------------------------- |
| `PA9` | `(USART1_TX)` | TTL serial output `(38400,8,N,1)` |
| `PA9` | `(USART1_TX)` | TTL serial output `(115200,8,N,1)` |

View File

@@ -35,7 +35,7 @@ static void clock_setup(void)
static void usart_setup(void)
{
/* Setup USART2 parameters. */
usart_set_baudrate(USART1, 38400);
usart_set_baudrate(USART1, 115200);
usart_set_databits(USART1, 8);
usart_set_parity(USART1, USART_PARITY_NONE);
usart_set_stopbits(USART1, USART_CR2_STOPBITS_1);

View File

@@ -9,4 +9,4 @@ The sending is done using newlib library in a blocking way.
| Port | Function | Description |
| ----- | ------------- | --------------------------------- |
| `PA9` | `(USART1_TX)` | TTL serial output `(38400,8,N,1)` |
| `PA9` | `(USART1_TX)` | TTL serial output `(115200,8,N,1)` |

View File

@@ -55,7 +55,7 @@ static ssize_t _iowr(void *_cookie, const char *_buf, size_t _n)
static FILE *usart_setup(uint32_t dev)
{
/* Setup USART2 parameters. */
usart_set_baudrate(dev, 38400);
usart_set_baudrate(dev, 115200);
usart_set_databits(dev, 8);
usart_set_parity(dev, USART_PARITY_NONE);
usart_set_stopbits(dev, USART_CR2_STOPBITS_1);

View File

@@ -3,7 +3,7 @@
This example program sends some characters on USART2 on
[Lisa/M 2.0 board](see http://paparazzi.enac.fr/wiki/LisaM for details).
The terminal settings for the receiving device/PC are 38400 8n1.
The terminal settings for the receiving device/PC are 115200 8n1.
The sending is done in a blocking way in the code, see the usart\_irq example
for a more elaborate USART example.

View File

@@ -41,7 +41,7 @@ static void usart_setup(void)
GPIO_CNF_OUTPUT_ALTFN_PUSHPULL, GPIO_USART2_TX);
/* Setup UART parameters. */
usart_set_baudrate(USART2, 38400);
usart_set_baudrate(USART2, 115200);
usart_set_databits(USART2, 8);
usart_set_stopbits(USART2, USART_STOPBITS_1);
usart_set_mode(USART2, USART_MODE_TX);

View File

@@ -48,7 +48,7 @@ static void usart_setup(void)
GPIO_CNF_INPUT_FLOAT, GPIO_USART2_RX);
/* Setup UART parameters. */
usart_set_baudrate(USART2, 38400);
usart_set_baudrate(USART2, 115200);
usart_set_databits(USART2, 8);
usart_set_stopbits(USART2, USART_STOPBITS_1);
usart_set_mode(USART2, USART_MODE_TX_RX);

View File

@@ -43,7 +43,7 @@ static void usart_setup(void)
GPIO_CNF_OUTPUT_ALTFN_PUSHPULL, GPIO_USART1_TX);
/* Setup UART parameters. */
usart_set_baudrate(USART1, 38400);
usart_set_baudrate(USART1, 115200);
usart_set_databits(USART1, 8);
usart_set_stopbits(USART1, USART_STOPBITS_1);
usart_set_mode(USART1, USART_MODE_TX);

View File

@@ -3,7 +3,7 @@
This example program sends some characters on USART3 on the ST STM32-based
[Olimex STM32-H103 eval board](http://olimex.com/dev/stm32-h103.html).
The terminal settings for the receiving device/PC are 38400 8n1.
The terminal settings for the receiving device/PC are 115200 8n1.
The sending is done in a blocking way in the code, see the usart\_irq example
for a more elaborate USART example.

View File

@@ -43,7 +43,7 @@ static void usart_setup(void)
GPIO_CNF_OUTPUT_ALTFN_PUSHPULL, GPIO_USART1_TX);
/* Setup UART parameters. */
usart_set_baudrate(USART1, 38400);
usart_set_baudrate(USART1, 115200);
usart_set_databits(USART1, 8);
usart_set_stopbits(USART1, USART_STOPBITS_1);
usart_set_mode(USART1, USART_MODE_TX);
@@ -58,7 +58,7 @@ static void usart_setup(void)
GPIO_CNF_OUTPUT_ALTFN_PUSHPULL, GPIO_USART2_TX);
/* Setup UART parameters. */
usart_set_baudrate(USART2, 38400);
usart_set_baudrate(USART2, 115200);
usart_set_databits(USART2, 8);
usart_set_stopbits(USART2, USART_STOPBITS_1);
usart_set_mode(USART2, USART_MODE_TX);
@@ -73,7 +73,7 @@ static void usart_setup(void)
GPIO_CNF_OUTPUT_ALTFN_PUSHPULL, GPIO_USART3_TX);
/* Setup UART parameters. */
usart_set_baudrate(USART3, 38400);
usart_set_baudrate(USART3, 115200);
usart_set_databits(USART3, 8);
usart_set_stopbits(USART3, USART_STOPBITS_1);
usart_set_mode(USART3, USART_MODE_TX);

View File

@@ -3,7 +3,7 @@
This example program sends some characters on USART3 on the ST STM32-based
[Olimex STM32-H103 eval board](http://olimex.com/dev/stm32-h103.html).
The terminal settings for the receiving device/PC are 38400 8n1.
The terminal settings for the receiving device/PC are 115200 8n1.
The sending is done in a blocking way in the code, see the usart\_irq example
for a more elaborate USART example.

View File

@@ -39,7 +39,7 @@ static void usart_setup(void)
GPIO_CNF_OUTPUT_ALTFN_PUSHPULL, GPIO_USART2_TX);
/* Setup UART parameters. */
usart_set_baudrate(USART2, 38400);
usart_set_baudrate(USART2, 115200);
usart_set_databits(USART2, 8);
usart_set_stopbits(USART2, USART_STOPBITS_1);
usart_set_mode(USART2, USART_MODE_TX);

View File

@@ -48,7 +48,7 @@ static void usart_setup(void)
GPIO_CNF_INPUT_FLOAT, GPIO_USART2_RX);
/* Setup UART parameters. */
usart_set_baudrate(USART2, 38400);
usart_set_baudrate(USART2, 115200);
usart_set_databits(USART2, 8);
usart_set_stopbits(USART2, USART_STOPBITS_1);
usart_set_parity(USART2, USART_PARITY_NONE);

View File

@@ -3,5 +3,5 @@
This is a small RTC example project.
It blinks the ST STM32VLDISCOVERY's blue LED at 1Hz, and sends the value of
the RTC counter register down the serial line (PA9) at 38400,8N1.
the RTC counter register down the serial line (PA9) at 115200,8N1.

View File

@@ -44,11 +44,7 @@ static void usart_setup(void)
GPIO_CNF_OUTPUT_ALTFN_PUSHPULL, GPIO_USART1_TX);
/* Setup UART parameters. */
// usart_set_baudrate(USART1, 38400);
/* TODO usart_set_baudrate() doesn't support 24MHz clock (yet). */
/* This is the equivalent: */
USART_BRR(USART1) = (uint16_t)((24000000 << 4) / (38400 * 16));
usart_set_baudrate(USART1, 115200);
usart_set_databits(USART1, 8);
usart_set_stopbits(USART1, USART_STOPBITS_1);
usart_set_mode(USART1, USART_MODE_TX);

View File

@@ -1,9 +1,9 @@
# README
This example program sends some characters on USART1 on the
This example program sends some characters on USART1 (PA9) on the
ST STM32VLDISCOVERY eval board.
The terminal settings for the receiving device/PC are 38400 8n1.
The terminal settings for the receiving device/PC are 115200 8n1.
The sending is done in a blocking way in the code, see the usart\_irq example
for a more elaborate USART example.

View File

@@ -40,11 +40,7 @@ static void usart_setup(void)
GPIO_CNF_OUTPUT_ALTFN_PUSHPULL, GPIO_USART1_TX);
/* Setup UART parameters. */
// usart_set_baudrate(USART1, 38400);
/* TODO usart_set_baudrate() doesn't support 24MHz clock (yet). */
/* This is the equivalent: */
USART_BRR(USART1) = (uint16_t)((24000000 << 4) / (38400 * 16));
usart_set_baudrate(USART1, 115200);
usart_set_databits(USART1, 8);
usart_set_stopbits(USART1, USART_STOPBITS_1);
usart_set_mode(USART1, USART_MODE_TX);

View File

@@ -39,7 +39,7 @@ static void clock_setup(void)
static void usart_setup(void)
{
/* Setup USART2 parameters. */
usart_set_baudrate(USART2, 38400);
usart_set_baudrate(USART2, 115200);
usart_set_databits(USART2, 8);
usart_set_stopbits(USART2, USART_STOPBITS_1);
usart_set_mode(USART2, USART_MODE_TX);

View File

@@ -10,4 +10,4 @@ the USART2.
| Port | Function | Description |
| ----- | ------------- | --------------------------------- |
| `PA2` | `(USART2_TX)` | TTL serial output `(38400,8,N,1)` |
| `PA2` | `(USART2_TX)` | TTL serial output `(115200,8,N,1)` |

View File

@@ -39,7 +39,7 @@ static void clock_setup(void)
static void usart_setup(void)
{
/* Setup USART2 parameters. */
usart_set_baudrate(USART2, 38400);
usart_set_baudrate(USART2, 115200);
usart_set_databits(USART2, 8);
usart_set_stopbits(USART2, USART_STOPBITS_1);
usart_set_mode(USART2, USART_MODE_TX);

View File

@@ -9,5 +9,5 @@ The sending is done in a nonblocking way.
| Port | Function | Description |
| ----- | ------------- | --------------------------------- |
| `PA2` | `(USART2_TX)` | TTL serial output `(38400,8,N,1)` |
| `PA3` | `(USART2_RX)` | TTL serial input `(38400,8,N,1)` |
| `PA2` | `(USART2_TX)` | TTL serial output `(115200,8,N,1)` |
| `PA3` | `(USART2_RX)` | TTL serial input `(115200,8,N,1)` |

View File

@@ -51,7 +51,7 @@ static void usart_setup(void)
gpio_set_af(GPIOA, GPIO_AF7, GPIO3);
/* Setup USART2 parameters. */
usart_set_baudrate(USART2, 38400);
usart_set_baudrate(USART2, 115200);
usart_set_databits(USART2, 8);
usart_set_stopbits(USART2, USART_STOPBITS_1);
usart_set_mode(USART2, USART_MODE_TX_RX);

View File

@@ -10,4 +10,4 @@ the USART1.
| Port | Function | Description |
| ----- | ------------- | --------------------------------- |
| `PA9` | `(USART1_TX)` | TTL serial output `(38400,8,N,1)` |
| `PA9` | `(USART1_TX)` | TTL serial output `(115200,8,N,1)` |

View File

@@ -40,7 +40,7 @@ static void clock_setup(void)
static void usart_setup(void)
{
/* Setup USART1 parameters. */
usart_set_baudrate(USART1, 38400);
usart_set_baudrate(USART1, 115200);
usart_set_databits(USART1, 8);
usart_set_stopbits(USART1, USART_STOPBITS_1);
usart_set_mode(USART1, USART_MODE_TX);

View File

@@ -9,7 +9,7 @@ The sending is done in a blocking way.
| Port | Function | Description |
| ----- | ------------- | --------------------------------- |
| `PA9` | `(USART1_TX)` | TTL serial output `(38400,8,N,1)` |
| `PA9` | `(USART1_TX)` | TTL serial output `(115200,8,N,1)` |
## Notes

View File

@@ -36,7 +36,7 @@ static void clock_setup(void)
static void usart_setup(void)
{
/* Setup USART2 parameters. */
usart_set_baudrate(USART1, 38400);
usart_set_baudrate(USART1, 115200);
usart_set_databits(USART1, 8);
usart_set_stopbits(USART1, USART_STOPBITS_1);
usart_set_mode(USART1, USART_MODE_TX);

View File

@@ -9,8 +9,8 @@ The sending is done in a nonblocking way.
| Port | Function | Description |
| ------ | ------------- | --------------------------------- |
| `PA9` | `(USART1_TX)` | TTL serial output `(38400,8,N,1)` |
| `PA10` | `(USART1_RX)` | TTL serial input `(38400,8,N,1)` |
| `PA9` | `(USART1_TX)` | TTL serial output `(115200,8,N,1)` |
| `PA10` | `(USART1_RX)` | TTL serial input `(115200,8,N,1)` |
## Notes

View File

@@ -51,7 +51,7 @@ static void usart_setup(void)
gpio_set_af(GPIOA, GPIO_AF7, GPIO10);
/* Setup USART1 parameters. */
usart_set_baudrate(USART1, 38400);
usart_set_baudrate(USART1, 115200);
usart_set_databits(USART1, 8);
usart_set_stopbits(USART1, USART_STOPBITS_1);
usart_set_mode(USART1, USART_MODE_TX_RX);

View File

@@ -3,7 +3,7 @@
This example program sends some characters on USART2 on the
ST STM32L DISCOVERY eval board. (USART2 TX on PA2)
The terminal settings for the receiving device/PC are 38400 8n1.
The terminal settings for the receiving device/PC are 115200 8n1.
The sending is done in a blocking way in the code, see the usart\_irq example
for a more elaborate USART example.

View File

@@ -36,7 +36,7 @@ static void clock_setup(void)
static void usart_setup(void)
{
/* Setup USART2 parameters. */
usart_set_baudrate(USART2, 38400);
usart_set_baudrate(USART2, 115200);
usart_set_databits(USART2, 8);
usart_set_stopbits(USART2, USART_STOPBITS_1);
usart_set_mode(USART2, USART_MODE_TX);