67 lines
1.7 KiB
Markdown
67 lines
1.7 KiB
Markdown
# Zephyr UART + LED - Nucleo G474RE
|
|
|
|
A learning project for [Zephyr RTOS](https://zephyrproject.org/) targeting the **STM32 Nucleo G474RE** dev board! I have always seen Zephyr projects in the wild and want to document my learning process. I've used FreeRTOS in the past and want to rewrite some projects using Zephyr 🙂
|
|
|
|
----
|
|
|
|
## Hardware
|
|
|
|
| | |
|
|
|---|---|
|
|
| **Board** | ST Nucleo G474RE |
|
|
| **MCU** | STM32G474RE (ARM Cortex-M4F, 170 MHz) |
|
|
| **UART** | LPUART1 via onboard ST-Link VCP (PA2/PA3) |
|
|
| **LED** | LD2 on PA5 |
|
|
|
|
Connect via USB to the Nucleo's ST-Link port
|
|
|
|
----
|
|
|
|
## Features
|
|
|
|
- **Interrupt-driven UART RX** - ISR writes bytes into a ring buffer
|
|
- **Dedicated RX thread** - sleeps on a semaphore, wakes on data arrival
|
|
- **Line accumulation** - buffers input until `\r` or `\n`
|
|
- **Formatted output** - prints received line with length and uptime timestamp
|
|
- **LED** - on PA5 configured via devicetree overlay (for testing)
|
|
|
|
----
|
|
|
|
## Getting Started
|
|
|
|
### Prerequisites
|
|
|
|
- [Zephyr SDK](https://docs.zephyrproject.org/latest/develop/getting_started/index.html) installed
|
|
- `west` installed and workspace initialized
|
|
|
|
### Build & Flash
|
|
|
|
```bash
|
|
west build # board is set in CMakeLists.txt
|
|
west flash
|
|
|
|
(optionally)
|
|
west debug
|
|
```
|
|
|
|
### Serial Monitor
|
|
|
|
Connect a terminal to the ST-Link Virtual COM Port at a baud rate of **115200**:
|
|
|
|
Personally, I just use PuTTY!
|
|
|
|
Type a line and press Enter:
|
|
|
|
```
|
|
─────────────────────────────
|
|
│ RX: hello
|
|
│ Len: 5, Time: 6741
|
|
─────────────────────────────
|
|
```
|
|
|
|
---
|
|
|
|
## License
|
|
|
|
[Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0)
|