This project demonstrates UART communication between an STM32F767ZI Nucleo-144 board and a Raspberry Pi 5.
- Problem being solved: Establishing a reliable UART link between STM32 and Pi for embedded system data exchange.
- Purpose: Allows the STM32 to send periodic status messages to the Raspberry Pi, forming the foundation for sensor or control data transfer.
- Demonstration: Counts incrementally transmitted from STM32 and displayed on the Raspberry Pi terminal.
- High-level description: STM32 runs a loop sending UART messages, Raspberry Pi receives them via GPIO UART pins.
- Data flow: STM32 → UART → Pi → Terminal Display
- Control flow: Simple polling loop on STM32, no interrupts used.
- STM32F767ZI Nucleo-144: Chosen for high-performance Cortex-M7, multiple UARTs.
- Raspberry Pi 5: Receives UART data, acts as a display or processing unit.
- Jumper wires: For TX/RX and GND connections.
Power considerations: Both boards are powered by their standard USB sources.
- Firmware structure: HAL-based initialization, main loop sends messages.
- Tasks: Main polling loop, message formatting with counter.
- Code snippet:
int counter = 0;
char msg[50];
while(1) {
sprintf(msg, "Hello STM32! Count=%d\r\n", counter++);
HAL_UART_Transmit(&huart3, (uint8_t*)msg, strlen(msg), HAL_MAX_DELAY);
HAL_Delay(1000);
}- Timing: 1-second interval between messages.
- Protocol: UART (USART3)
- Reason: Simple, low-latency point-to-point communication.
- Correct GPIO alternate function configuration for PB10/PB11.
- Use of HAL_UART_Transmit in blocking mode for simplicity.
- Counter-based message to verify continuous communication.
- Minimal code footprint for embedded teaching or prototyping.
- Initial blank screen on Pi due to
serial-gettyand default UART mapping. - Resolved by disabling serial console, enabling hardware UART, and verifying pinctrl mapping.
- Python loopback test used to verify Pi UART before connecting STM32.
- STM32 transmits
"Hello STM32! Count=N"every second. - Raspberry Pi terminal (
screen /dev/serial0 115200) receives messages in real-time. - Validates end-to-end UART communication.
- Pull-up resistors configured on PB10/PB11 for stable logic levels.
- UART blocking transmit ensures no message loss in this simple demo.
- Grounding required between STM32 and Pi.
- Implement STM32 RX handling to allow bidirectional communication.
- Add message framing and checksums for robust data transfer.
- Integrate into a larger sensor or control system.
- Explore DMA-based UART for non-blocking transmissions.
/core -> Core STM32 firmware code
/driver -> Peripheral drivers
/images -> Diagrams, pinout, screenshots
/README.md -> Project documentation
/LICENSE -> License file (stay intact)
- MCU: STM32F767ZI Cortex-M7
- HAL Drivers: Used for UART, GPIO, and system clock
- Debugging tools: ST-Link, CubeIDE
- UART AF: PB10 (TX), PB11 (RX), AF7
- No RTOS: Bare-metal polling loop for simplicity
- Clock: HSI + PLL configuration for system stability

