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
Copy file name to clipboardExpand all lines: uart-polling/README.md
+57-21Lines changed: 57 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,14 +21,41 @@ Connect the board with host through USB to TTL converter (FTDI board in our case
21
21
22
22

23
23
24
+
25
+
## Project Structure
26
+
27
+
*`src` directory contains all source files for the project
28
+
*`include` directory contains all header files for the project
29
+
30
+
### Source file description
31
+
32
+
*`STM32F103C8TX_FLASH.ld` - linker script for generating elf file.
33
+
*`src/main.c` - entry point of application and main code body.
34
+
*`src/uart.c` - Contains definition of non-inline functions for uart.
35
+
*`src/timer.c` - Contains definition of non-inline functions for SysTick timer.
36
+
*`src/startup_stm32f103c8tx.s` - assembly startup script for blue pill board.
37
+
*`include/uart.h` - Contains definitions of inline functions and declaration of all functions for uart.
38
+
*`include/uart.h` - Contains definitions of inline functions and declarations of all functions for SysTick timer.
39
+
*`system_stm32f1xx.c` - clock configuration and system initialization functions.
40
+
*`STM32F103.svd` - contains the description of the system contained in Arm Cortex-M processor-based microcontrollers, in particular, the memory mapped registers of peripherals.
41
+
42
+
24
43
## Control flow
25
44
26
45
The initialisation function accomplishes following tasks
27
46
28
-
1. Enables clock signal for USART1 peripheral as well as GPIO Port A, both are connected with APB2 bus.\

54
88
89
+
### Function description
90
+
91
+
1. `USART1_puts()` - prints a string to USART1.
92
+
2. `USART1_putc()` - waits for the transmit data register (`TDR`) to be empty and loads new character in it.
93
+
3. `USART1_IRQHandler()` - Interrupt service routine for USART1 related interrupts. If `RXNE` is set i.e. receiver not empty interrupt then it echoes the character back to usart.
94
+
55
95
## Project Working
56
96
57
-
This project configures SysTick timer and uses it to generate time accurate delay for blinking an LED. The onboard LED connected to pin C13 blinks every second.
97
+
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.
58
98
59
99
## Dependencies
60
100
61
101
* **make**\
62
102
Make utility is required for configuring and building this project. You can install make on linux by running command:
63
103
64
104
```bash
105
+
# for debian/ubuntu
65
106
sudo apt install build-essential
107
+
108
+
# for macos
109
+
brew install make
66
110
```
67
111
68
112
* **gcc-arm-none-eabi toolchain**\
@@ -71,12 +115,17 @@ This project configures SysTick timer and uses it to generate time accurate dela
71
115
```bash
72
116
sudo apt install gcc-arm-none-eabi
73
117
```
118
+
* For mac, visit  page to install arm embedded toolchain.
74
119
75
120
* **openocd**\
76
121
It is an Open On Circuit Debugging tool used to flash and debug arm micro controllers. You can install openocd on linux by running command:
77
122
78
123
```bash
124
+
# for debian/ubuntu
79
125
sudo apt install openocd -y
126
+
127
+
# for macos
128
+
brew install openocd
80
129
```
81
130
82
131
***Cortex Debug extension**\
@@ -87,19 +136,6 @@ This project configures SysTick timer and uses it to generate time accurate dela
87
136
ext install marus25.cortex-debug
88
137
```
89
138
90
-
## Project Structure
91
-
92
-
*`src` directory contains all source files for the project
93
-
*`include` directory contains all header files for the project
94
-
95
-
### Source file description
96
-
97
-
*`STM32F103C8TX_FLASH.ld` - linker script
98
-
*`src\main.c` - application code
99
-
*`src\startup_stm32f103c8tx.s` - assembly startup script for blue pill board
100
-
*`system_stm32f1xx.c` - clock configuration and system initialization functions
101
-
*`STM32F103.svd` - contains the description of the system contained in Arm Cortex-M processor-based microcontrollers, in particular, the memory mapped registers of peripherals.
102
-
103
139
## Run Locally
104
140
105
141
Running the project is super easy. Just clone, build, and flash.
0 commit comments