10.UART数据传输测试
该教程演示如何通过开发板的UART数据传输测试
一、准备工作
- 准备1块BearPi-Pico H2821开发板
二、编译代码
在Windows下编译操作
点击左侧的“KConfig”,打开配置界面.
选择Support UART Sample
Application ---> [*] Enable Sample. [*] Enable the Sample of peripheral. [ ] Enable all the sample of peripheral, it's just for build. [ ] Support ADC Sample. [ ] Support BLINKY Sample. [ ] Support BUTTON Sample. [ ] Support DMA Sample. [ ] Support I2C Sample. [ ] Support I2S Sample. [ ] Support KEYSCAN Sample. [ ] Support PINCTRL Sample. [ ] Support PWM Sample. [ ] Support QDEC Sample. [ ] Support RTC Sample. [ ] Support SPI Sample. [ ] Support SYSTICK Sample. [ ] Support TASKS Test Sample. [ ] Support TCXO Sample. [ ] Support TIMER Sample. [*] Support UART Sample. UART Sample Configuration --->
设置UART对应的id和GPIO,id可设置为0、1、2,GPIO可设置任意引脚.
UART Sample Configuration ---> (2) Choose UART bus id. (13) Choose UART TXD pin. (14) Choose UART RXD pin. [*] Choose UART poll transfer mode. [ ] Choose UART interrupt transfer mode.
按下"Save"键保存配置。
编译烧录固件
参考环境搭建教程编译烧录代码
在Ubuntu下编译操作
在MobaXterm中输入:
./build.py menuconfig
选择Support UART Sample
Application ---> [*] Enable Sample. [*] Enable the Sample of peripheral. [ ] Enable all the sample of peripheral, it's just for build. [ ] Support ADC Sample. [ ] Support BLINKY Sample. [ ] Support BUTTON Sample. [ ] Support DMA Sample. [ ] Support I2C Sample. [ ] Support I2S Sample. [ ] Support KEYSCAN Sample. [ ] Support PINCTRL Sample. [ ] Support PWM Sample. [ ] Support QDEC Sample. [ ] Support RTC Sample. [ ] Support SPI Sample. [ ] Support SYSTICK Sample. [ ] Support TASKS Test Sample. [ ] Support TCXO Sample. [ ] Support TIMER Sample. [*] Support UART Sample. UART Sample Configuration --->
设置UART对应的id和GPIO,id可设置为0、1、2,GPIO可设置任意引脚.
UART Sample Configuration ---> (2) Choose UART bus id. (13) Choose UART TXD pin. (14) Choose UART RXD pin. [*] Choose UART poll transfer mode. [ ] Choose UART interrupt transfer mode.
按下"ESC"键退出并保存配置。
编译烧录固件
参考环境搭建教程编译烧录代码
三、测试
烧录固件后按下开发的复位按键,使用USB转TTL工具将开发板的串口与PC连接,使用串口工具发送任意消息给开发板,开发板将回复相同消息。