STM32 Serial Reading Tutorial
Use Keil and an STM32F103 board to validate ANROT UART data as a first-step MCU integration workflow.
- stm32
- mcu
- uart
- tutorial
STM32 example
Protocol Support
| Protocol / frame | Support | How this example handles it |
|---|---|---|
0x91 IMUSOL | Supported | Decodes a single-device float frame into receive_imusol and prints it from dump_data_packet(). |
0x62 GWSOL | Supported | Decodes gateway float collection frames and iterates receive_gwsol.receive_imusol[]. |
0x63 GWSOL Compact | Not supported | The STM32 decoder has no compact gateway branch. |
0x90, 0xA0, 0xB0, 0xB1, 0xC0, 0xD0, 0xD1 | Supported | Parses loose single-field output modes. |
0xF0 Pressure | Skipped | The code advances past the pressure item and does not store or print pressure. |
Source code (download and unzip): demo-stm32-en.zip
This example provides C language example code, users receive Hi226/Hi229 and Hi221 data.
-
Test environment: Windows10_x64 operating system
-
Compiler: keil_V5.28
-
Development board: Punctual Atom-Battleship V3 STM32F103ZET6
-
Test equipment: Hi226/Hi229
Hardware connection
Insert the Hi226/Hi229 into the SuperCore debug board correctly.
| Supercore Debug Board | Punctual Atomic Development Board |
|---|---|
| RXD | PA2(TXD) |
| TXD | PA3(RXD) |
| 3.3V | 3V3 |
| GND | GND |
Connect the corresponding pins in the table above with DuPont wires.
Plug the USB cable into the USB_232 socket of the development board, and plug the other end into the computer.
Watch the output
Open the serial port debugging assistant, open the serial port number corresponding to the development board, and observe the data output