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:
@@ -8,4 +8,4 @@ ADC\_IN1 input, and prints it to the serial port.
|
|||||||
| Port | Function | Description |
|
| Port | Function | Description |
|
||||||
| ----- | ----------- | --------------------------------- |
|
| ----- | ----------- | --------------------------------- |
|
||||||
| `PA1` | `(ADC_IN1)` | Analog input |
|
| `PA1` | `(ADC_IN1)` | Analog input |
|
||||||
| `PA9` | `(USART1)` | TTL serial output `(38400,8,N,1)` |
|
| `PA9` | `(USART1)` | TTL serial output `(115200,8,N,1)` |
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ static void usart_setup(void)
|
|||||||
gpio_set_af(GPIOA, GPIO_AF1, GPIO9);
|
gpio_set_af(GPIOA, GPIO_AF1, GPIO9);
|
||||||
|
|
||||||
/* Setup UART parameters. */
|
/* Setup UART parameters. */
|
||||||
usart_set_baudrate(USART1, 38400);
|
usart_set_baudrate(USART1, 115200);
|
||||||
usart_set_databits(USART1, 8);
|
usart_set_databits(USART1, 8);
|
||||||
usart_set_stopbits(USART1, USART_CR2_STOPBITS_1);
|
usart_set_stopbits(USART1, USART_CR2_STOPBITS_1);
|
||||||
usart_set_mode(USART1, USART_MODE_TX);
|
usart_set_mode(USART1, USART_MODE_TX);
|
||||||
|
|||||||
@@ -9,4 +9,4 @@ The sending is done in a blocking way.
|
|||||||
|
|
||||||
| Port | Function | Description |
|
| Port | Function | Description |
|
||||||
| ----- | ------------- | --------------------------------- |
|
| ----- | ------------- | --------------------------------- |
|
||||||
| `PA9` | `(USART1_TX)` | TTL serial output `(38400,8,N,1)` |
|
| `PA9` | `(USART1_TX)` | TTL serial output `(115200,8,N,1)` |
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ static void clock_setup(void)
|
|||||||
static void usart_setup(void)
|
static void usart_setup(void)
|
||||||
{
|
{
|
||||||
/* Setup USART2 parameters. */
|
/* Setup USART2 parameters. */
|
||||||
usart_set_baudrate(USART1, 38400);
|
usart_set_baudrate(USART1, 115200);
|
||||||
usart_set_databits(USART1, 8);
|
usart_set_databits(USART1, 8);
|
||||||
usart_set_parity(USART1, USART_PARITY_NONE);
|
usart_set_parity(USART1, USART_PARITY_NONE);
|
||||||
usart_set_stopbits(USART1, USART_CR2_STOPBITS_1);
|
usart_set_stopbits(USART1, USART_CR2_STOPBITS_1);
|
||||||
|
|||||||
@@ -9,4 +9,4 @@ The sending is done using newlib library in a blocking way.
|
|||||||
|
|
||||||
| Port | Function | Description |
|
| Port | Function | Description |
|
||||||
| ----- | ------------- | --------------------------------- |
|
| ----- | ------------- | --------------------------------- |
|
||||||
| `PA9` | `(USART1_TX)` | TTL serial output `(38400,8,N,1)` |
|
| `PA9` | `(USART1_TX)` | TTL serial output `(115200,8,N,1)` |
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ static ssize_t _iowr(void *_cookie, const char *_buf, size_t _n)
|
|||||||
static FILE *usart_setup(uint32_t dev)
|
static FILE *usart_setup(uint32_t dev)
|
||||||
{
|
{
|
||||||
/* Setup USART2 parameters. */
|
/* Setup USART2 parameters. */
|
||||||
usart_set_baudrate(dev, 38400);
|
usart_set_baudrate(dev, 115200);
|
||||||
usart_set_databits(dev, 8);
|
usart_set_databits(dev, 8);
|
||||||
usart_set_parity(dev, USART_PARITY_NONE);
|
usart_set_parity(dev, USART_PARITY_NONE);
|
||||||
usart_set_stopbits(dev, USART_CR2_STOPBITS_1);
|
usart_set_stopbits(dev, USART_CR2_STOPBITS_1);
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
This example program sends some characters on USART2 on
|
This example program sends some characters on USART2 on
|
||||||
[Lisa/M 2.0 board](see http://paparazzi.enac.fr/wiki/LisaM for details).
|
[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
|
The sending is done in a blocking way in the code, see the usart\_irq example
|
||||||
for a more elaborate USART example.
|
for a more elaborate USART example.
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ static void usart_setup(void)
|
|||||||
GPIO_CNF_OUTPUT_ALTFN_PUSHPULL, GPIO_USART2_TX);
|
GPIO_CNF_OUTPUT_ALTFN_PUSHPULL, GPIO_USART2_TX);
|
||||||
|
|
||||||
/* Setup UART parameters. */
|
/* Setup UART parameters. */
|
||||||
usart_set_baudrate(USART2, 38400);
|
usart_set_baudrate(USART2, 115200);
|
||||||
usart_set_databits(USART2, 8);
|
usart_set_databits(USART2, 8);
|
||||||
usart_set_stopbits(USART2, USART_STOPBITS_1);
|
usart_set_stopbits(USART2, USART_STOPBITS_1);
|
||||||
usart_set_mode(USART2, USART_MODE_TX);
|
usart_set_mode(USART2, USART_MODE_TX);
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ static void usart_setup(void)
|
|||||||
GPIO_CNF_INPUT_FLOAT, GPIO_USART2_RX);
|
GPIO_CNF_INPUT_FLOAT, GPIO_USART2_RX);
|
||||||
|
|
||||||
/* Setup UART parameters. */
|
/* Setup UART parameters. */
|
||||||
usart_set_baudrate(USART2, 38400);
|
usart_set_baudrate(USART2, 115200);
|
||||||
usart_set_databits(USART2, 8);
|
usart_set_databits(USART2, 8);
|
||||||
usart_set_stopbits(USART2, USART_STOPBITS_1);
|
usart_set_stopbits(USART2, USART_STOPBITS_1);
|
||||||
usart_set_mode(USART2, USART_MODE_TX_RX);
|
usart_set_mode(USART2, USART_MODE_TX_RX);
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ static void usart_setup(void)
|
|||||||
GPIO_CNF_OUTPUT_ALTFN_PUSHPULL, GPIO_USART1_TX);
|
GPIO_CNF_OUTPUT_ALTFN_PUSHPULL, GPIO_USART1_TX);
|
||||||
|
|
||||||
/* Setup UART parameters. */
|
/* Setup UART parameters. */
|
||||||
usart_set_baudrate(USART1, 38400);
|
usart_set_baudrate(USART1, 115200);
|
||||||
usart_set_databits(USART1, 8);
|
usart_set_databits(USART1, 8);
|
||||||
usart_set_stopbits(USART1, USART_STOPBITS_1);
|
usart_set_stopbits(USART1, USART_STOPBITS_1);
|
||||||
usart_set_mode(USART1, USART_MODE_TX);
|
usart_set_mode(USART1, USART_MODE_TX);
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
This example program sends some characters on USART3 on the ST STM32-based
|
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).
|
[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
|
The sending is done in a blocking way in the code, see the usart\_irq example
|
||||||
for a more elaborate USART example.
|
for a more elaborate USART example.
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ static void usart_setup(void)
|
|||||||
GPIO_CNF_OUTPUT_ALTFN_PUSHPULL, GPIO_USART1_TX);
|
GPIO_CNF_OUTPUT_ALTFN_PUSHPULL, GPIO_USART1_TX);
|
||||||
|
|
||||||
/* Setup UART parameters. */
|
/* Setup UART parameters. */
|
||||||
usart_set_baudrate(USART1, 38400);
|
usart_set_baudrate(USART1, 115200);
|
||||||
usart_set_databits(USART1, 8);
|
usart_set_databits(USART1, 8);
|
||||||
usart_set_stopbits(USART1, USART_STOPBITS_1);
|
usart_set_stopbits(USART1, USART_STOPBITS_1);
|
||||||
usart_set_mode(USART1, USART_MODE_TX);
|
usart_set_mode(USART1, USART_MODE_TX);
|
||||||
@@ -58,7 +58,7 @@ static void usart_setup(void)
|
|||||||
GPIO_CNF_OUTPUT_ALTFN_PUSHPULL, GPIO_USART2_TX);
|
GPIO_CNF_OUTPUT_ALTFN_PUSHPULL, GPIO_USART2_TX);
|
||||||
|
|
||||||
/* Setup UART parameters. */
|
/* Setup UART parameters. */
|
||||||
usart_set_baudrate(USART2, 38400);
|
usart_set_baudrate(USART2, 115200);
|
||||||
usart_set_databits(USART2, 8);
|
usart_set_databits(USART2, 8);
|
||||||
usart_set_stopbits(USART2, USART_STOPBITS_1);
|
usart_set_stopbits(USART2, USART_STOPBITS_1);
|
||||||
usart_set_mode(USART2, USART_MODE_TX);
|
usart_set_mode(USART2, USART_MODE_TX);
|
||||||
@@ -73,7 +73,7 @@ static void usart_setup(void)
|
|||||||
GPIO_CNF_OUTPUT_ALTFN_PUSHPULL, GPIO_USART3_TX);
|
GPIO_CNF_OUTPUT_ALTFN_PUSHPULL, GPIO_USART3_TX);
|
||||||
|
|
||||||
/* Setup UART parameters. */
|
/* Setup UART parameters. */
|
||||||
usart_set_baudrate(USART3, 38400);
|
usart_set_baudrate(USART3, 115200);
|
||||||
usart_set_databits(USART3, 8);
|
usart_set_databits(USART3, 8);
|
||||||
usart_set_stopbits(USART3, USART_STOPBITS_1);
|
usart_set_stopbits(USART3, USART_STOPBITS_1);
|
||||||
usart_set_mode(USART3, USART_MODE_TX);
|
usart_set_mode(USART3, USART_MODE_TX);
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
This example program sends some characters on USART3 on the ST STM32-based
|
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).
|
[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
|
The sending is done in a blocking way in the code, see the usart\_irq example
|
||||||
for a more elaborate USART example.
|
for a more elaborate USART example.
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ static void usart_setup(void)
|
|||||||
GPIO_CNF_OUTPUT_ALTFN_PUSHPULL, GPIO_USART2_TX);
|
GPIO_CNF_OUTPUT_ALTFN_PUSHPULL, GPIO_USART2_TX);
|
||||||
|
|
||||||
/* Setup UART parameters. */
|
/* Setup UART parameters. */
|
||||||
usart_set_baudrate(USART2, 38400);
|
usart_set_baudrate(USART2, 115200);
|
||||||
usart_set_databits(USART2, 8);
|
usart_set_databits(USART2, 8);
|
||||||
usart_set_stopbits(USART2, USART_STOPBITS_1);
|
usart_set_stopbits(USART2, USART_STOPBITS_1);
|
||||||
usart_set_mode(USART2, USART_MODE_TX);
|
usart_set_mode(USART2, USART_MODE_TX);
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ static void usart_setup(void)
|
|||||||
GPIO_CNF_INPUT_FLOAT, GPIO_USART2_RX);
|
GPIO_CNF_INPUT_FLOAT, GPIO_USART2_RX);
|
||||||
|
|
||||||
/* Setup UART parameters. */
|
/* Setup UART parameters. */
|
||||||
usart_set_baudrate(USART2, 38400);
|
usart_set_baudrate(USART2, 115200);
|
||||||
usart_set_databits(USART2, 8);
|
usart_set_databits(USART2, 8);
|
||||||
usart_set_stopbits(USART2, USART_STOPBITS_1);
|
usart_set_stopbits(USART2, USART_STOPBITS_1);
|
||||||
usart_set_parity(USART2, USART_PARITY_NONE);
|
usart_set_parity(USART2, USART_PARITY_NONE);
|
||||||
|
|||||||
@@ -3,5 +3,5 @@
|
|||||||
This is a small RTC example project.
|
This is a small RTC example project.
|
||||||
|
|
||||||
It blinks the ST STM32VLDISCOVERY's blue LED at 1Hz, and sends the value of
|
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.
|
||||||
|
|
||||||
|
|||||||
@@ -44,11 +44,7 @@ static void usart_setup(void)
|
|||||||
GPIO_CNF_OUTPUT_ALTFN_PUSHPULL, GPIO_USART1_TX);
|
GPIO_CNF_OUTPUT_ALTFN_PUSHPULL, GPIO_USART1_TX);
|
||||||
|
|
||||||
/* Setup UART parameters. */
|
/* Setup UART parameters. */
|
||||||
// usart_set_baudrate(USART1, 38400);
|
usart_set_baudrate(USART1, 115200);
|
||||||
/* 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_databits(USART1, 8);
|
usart_set_databits(USART1, 8);
|
||||||
usart_set_stopbits(USART1, USART_STOPBITS_1);
|
usart_set_stopbits(USART1, USART_STOPBITS_1);
|
||||||
usart_set_mode(USART1, USART_MODE_TX);
|
usart_set_mode(USART1, USART_MODE_TX);
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
# README
|
# 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.
|
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
|
The sending is done in a blocking way in the code, see the usart\_irq example
|
||||||
for a more elaborate USART example.
|
for a more elaborate USART example.
|
||||||
|
|||||||
@@ -40,11 +40,7 @@ static void usart_setup(void)
|
|||||||
GPIO_CNF_OUTPUT_ALTFN_PUSHPULL, GPIO_USART1_TX);
|
GPIO_CNF_OUTPUT_ALTFN_PUSHPULL, GPIO_USART1_TX);
|
||||||
|
|
||||||
/* Setup UART parameters. */
|
/* Setup UART parameters. */
|
||||||
// usart_set_baudrate(USART1, 38400);
|
usart_set_baudrate(USART1, 115200);
|
||||||
/* 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_databits(USART1, 8);
|
usart_set_databits(USART1, 8);
|
||||||
usart_set_stopbits(USART1, USART_STOPBITS_1);
|
usart_set_stopbits(USART1, USART_STOPBITS_1);
|
||||||
usart_set_mode(USART1, USART_MODE_TX);
|
usart_set_mode(USART1, USART_MODE_TX);
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ static void clock_setup(void)
|
|||||||
static void usart_setup(void)
|
static void usart_setup(void)
|
||||||
{
|
{
|
||||||
/* Setup USART2 parameters. */
|
/* Setup USART2 parameters. */
|
||||||
usart_set_baudrate(USART2, 38400);
|
usart_set_baudrate(USART2, 115200);
|
||||||
usart_set_databits(USART2, 8);
|
usart_set_databits(USART2, 8);
|
||||||
usart_set_stopbits(USART2, USART_STOPBITS_1);
|
usart_set_stopbits(USART2, USART_STOPBITS_1);
|
||||||
usart_set_mode(USART2, USART_MODE_TX);
|
usart_set_mode(USART2, USART_MODE_TX);
|
||||||
|
|||||||
@@ -10,4 +10,4 @@ the USART2.
|
|||||||
|
|
||||||
| Port | Function | Description |
|
| Port | Function | Description |
|
||||||
| ----- | ------------- | --------------------------------- |
|
| ----- | ------------- | --------------------------------- |
|
||||||
| `PA2` | `(USART2_TX)` | TTL serial output `(38400,8,N,1)` |
|
| `PA2` | `(USART2_TX)` | TTL serial output `(115200,8,N,1)` |
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ static void clock_setup(void)
|
|||||||
static void usart_setup(void)
|
static void usart_setup(void)
|
||||||
{
|
{
|
||||||
/* Setup USART2 parameters. */
|
/* Setup USART2 parameters. */
|
||||||
usart_set_baudrate(USART2, 38400);
|
usart_set_baudrate(USART2, 115200);
|
||||||
usart_set_databits(USART2, 8);
|
usart_set_databits(USART2, 8);
|
||||||
usart_set_stopbits(USART2, USART_STOPBITS_1);
|
usart_set_stopbits(USART2, USART_STOPBITS_1);
|
||||||
usart_set_mode(USART2, USART_MODE_TX);
|
usart_set_mode(USART2, USART_MODE_TX);
|
||||||
|
|||||||
@@ -9,5 +9,5 @@ The sending is done in a nonblocking way.
|
|||||||
|
|
||||||
| Port | Function | Description |
|
| Port | Function | Description |
|
||||||
| ----- | ------------- | --------------------------------- |
|
| ----- | ------------- | --------------------------------- |
|
||||||
| `PA2` | `(USART2_TX)` | TTL serial output `(38400,8,N,1)` |
|
| `PA2` | `(USART2_TX)` | TTL serial output `(115200,8,N,1)` |
|
||||||
| `PA3` | `(USART2_RX)` | TTL serial input `(38400,8,N,1)` |
|
| `PA3` | `(USART2_RX)` | TTL serial input `(115200,8,N,1)` |
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ static void usart_setup(void)
|
|||||||
gpio_set_af(GPIOA, GPIO_AF7, GPIO3);
|
gpio_set_af(GPIOA, GPIO_AF7, GPIO3);
|
||||||
|
|
||||||
/* Setup USART2 parameters. */
|
/* Setup USART2 parameters. */
|
||||||
usart_set_baudrate(USART2, 38400);
|
usart_set_baudrate(USART2, 115200);
|
||||||
usart_set_databits(USART2, 8);
|
usart_set_databits(USART2, 8);
|
||||||
usart_set_stopbits(USART2, USART_STOPBITS_1);
|
usart_set_stopbits(USART2, USART_STOPBITS_1);
|
||||||
usart_set_mode(USART2, USART_MODE_TX_RX);
|
usart_set_mode(USART2, USART_MODE_TX_RX);
|
||||||
|
|||||||
@@ -10,4 +10,4 @@ the USART1.
|
|||||||
|
|
||||||
| Port | Function | Description |
|
| Port | Function | Description |
|
||||||
| ----- | ------------- | --------------------------------- |
|
| ----- | ------------- | --------------------------------- |
|
||||||
| `PA9` | `(USART1_TX)` | TTL serial output `(38400,8,N,1)` |
|
| `PA9` | `(USART1_TX)` | TTL serial output `(115200,8,N,1)` |
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ static void clock_setup(void)
|
|||||||
static void usart_setup(void)
|
static void usart_setup(void)
|
||||||
{
|
{
|
||||||
/* Setup USART1 parameters. */
|
/* Setup USART1 parameters. */
|
||||||
usart_set_baudrate(USART1, 38400);
|
usart_set_baudrate(USART1, 115200);
|
||||||
usart_set_databits(USART1, 8);
|
usart_set_databits(USART1, 8);
|
||||||
usart_set_stopbits(USART1, USART_STOPBITS_1);
|
usart_set_stopbits(USART1, USART_STOPBITS_1);
|
||||||
usart_set_mode(USART1, USART_MODE_TX);
|
usart_set_mode(USART1, USART_MODE_TX);
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ The sending is done in a blocking way.
|
|||||||
|
|
||||||
| Port | Function | Description |
|
| Port | Function | Description |
|
||||||
| ----- | ------------- | --------------------------------- |
|
| ----- | ------------- | --------------------------------- |
|
||||||
| `PA9` | `(USART1_TX)` | TTL serial output `(38400,8,N,1)` |
|
| `PA9` | `(USART1_TX)` | TTL serial output `(115200,8,N,1)` |
|
||||||
|
|
||||||
## Notes
|
## Notes
|
||||||
|
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ static void clock_setup(void)
|
|||||||
static void usart_setup(void)
|
static void usart_setup(void)
|
||||||
{
|
{
|
||||||
/* Setup USART2 parameters. */
|
/* Setup USART2 parameters. */
|
||||||
usart_set_baudrate(USART1, 38400);
|
usart_set_baudrate(USART1, 115200);
|
||||||
usart_set_databits(USART1, 8);
|
usart_set_databits(USART1, 8);
|
||||||
usart_set_stopbits(USART1, USART_STOPBITS_1);
|
usart_set_stopbits(USART1, USART_STOPBITS_1);
|
||||||
usart_set_mode(USART1, USART_MODE_TX);
|
usart_set_mode(USART1, USART_MODE_TX);
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ The sending is done in a nonblocking way.
|
|||||||
|
|
||||||
| Port | Function | Description |
|
| Port | Function | Description |
|
||||||
| ------ | ------------- | --------------------------------- |
|
| ------ | ------------- | --------------------------------- |
|
||||||
| `PA9` | `(USART1_TX)` | TTL serial output `(38400,8,N,1)` |
|
| `PA9` | `(USART1_TX)` | TTL serial output `(115200,8,N,1)` |
|
||||||
| `PA10` | `(USART1_RX)` | TTL serial input `(38400,8,N,1)` |
|
| `PA10` | `(USART1_RX)` | TTL serial input `(115200,8,N,1)` |
|
||||||
|
|
||||||
## Notes
|
## Notes
|
||||||
|
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ static void usart_setup(void)
|
|||||||
gpio_set_af(GPIOA, GPIO_AF7, GPIO10);
|
gpio_set_af(GPIOA, GPIO_AF7, GPIO10);
|
||||||
|
|
||||||
/* Setup USART1 parameters. */
|
/* Setup USART1 parameters. */
|
||||||
usart_set_baudrate(USART1, 38400);
|
usart_set_baudrate(USART1, 115200);
|
||||||
usart_set_databits(USART1, 8);
|
usart_set_databits(USART1, 8);
|
||||||
usart_set_stopbits(USART1, USART_STOPBITS_1);
|
usart_set_stopbits(USART1, USART_STOPBITS_1);
|
||||||
usart_set_mode(USART1, USART_MODE_TX_RX);
|
usart_set_mode(USART1, USART_MODE_TX_RX);
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
This example program sends some characters on USART2 on the
|
This example program sends some characters on USART2 on the
|
||||||
ST STM32L DISCOVERY eval board. (USART2 TX on PA2)
|
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
|
The sending is done in a blocking way in the code, see the usart\_irq example
|
||||||
for a more elaborate USART example.
|
for a more elaborate USART example.
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ static void clock_setup(void)
|
|||||||
static void usart_setup(void)
|
static void usart_setup(void)
|
||||||
{
|
{
|
||||||
/* Setup USART2 parameters. */
|
/* Setup USART2 parameters. */
|
||||||
usart_set_baudrate(USART2, 38400);
|
usart_set_baudrate(USART2, 115200);
|
||||||
usart_set_databits(USART2, 8);
|
usart_set_databits(USART2, 8);
|
||||||
usart_set_stopbits(USART2, USART_STOPBITS_1);
|
usart_set_stopbits(USART2, USART_STOPBITS_1);
|
||||||
usart_set_mode(USART2, USART_MODE_TX);
|
usart_set_mode(USART2, USART_MODE_TX);
|
||||||
|
|||||||
Reference in New Issue
Block a user