You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Programming the UART1 peripheral in STM32F1 controller for bi-directional communication. Echo characters received from UART and transmit time elapsed since boot every 5 seconds.
6
+
7
+
## USART
8
+
9
+
The controller has 3 USART peropherals with varying functionality. The peripheral registers can be accessed as half word (16 bit) as well as words (32 bit).\
10
+
This project uses USART1 with pinc PA9 and PA10 for demonstration.
11
+
12
+
## Hardware Setup
13
+
14
+
Connect the board with host through USB to TTL converter (FTDI board in our case). The connections are described as follows.
15
+
16
+
| Pin on Blue Pill | Pin on FTDI |
17
+
|------------------ |------------- |
18
+
| PA9 | Rx |
19
+
| PA10 | Tx |
20
+
| Gnd | Gnd |
21
+
22
+

23
+
24
+
## Project Variant
25
+
STM32F1 Blue pill is a versatile board and can be programmed in various ways. I have created following variations of this project which differs in programming language, use of RTOS and framework. Clone the repository and follow steps mentioned in the respective variations for building and flashing.
26
+
1.[Baremetal](baremetal)
27
+
2. libopencm3
28
+
3. FreeRTOS
29
+
4. Zephyr RTOS
30
+
5. Arduino
31
+
6. CPP Cmake
32
+
33
+
### Build
34
+
35
+
Run following command in terminal to generate flashable binaries for blue pill board. Build files will be written to **Build Output Directory** as configured.
36
+
37
+
```bash
38
+
make all
39
+
```
40
+
41
+
### Flash
42
+
43
+
1. Connect STlink to PC and blue pill board using swd headers.
44
+
2. Put blue pill board in programming mode.
45
+
3. Run following to flash board with binary.
46
+
47
+
```bash
48
+
make flash
49
+
```
50
+
51
+
## Output
52
+
53
+
The application prints time elapsed since boot in interval of 5 seconds. Configure serial onitor on host for 9600 baudrate to be able to read and write to blue pill using uart. Following output can be observed on UART.
54
+

55
+
56
+
57
+
## Debug
58
+
59
+
Click in `Run and Debug` option in VsCode sidebar. Then launch `Cortex Debug` target.
0 commit comments