在上篇esp8266烧录好固件之后,这篇记录如何移植AT组件。
硬件连接
N32G457串口1用于finsh。这里配置串口2用于AT串口,与ESP8266通信。
N32G457开发板 |
ESP8266模块 |
USART2_TX(PA2) |
RX |
USART2_RX(PA3) |
TX |
GND |
GND |
3.3V |
3.3V |
RT-Thread Setinng
1、添加usart2:
2、打开配置工具,在添加软件包里搜索at_device
3、进入配置好wifi SSD与PWD
配置好后,编译下载到开发板。重启后打开串口终端:
\ | /
- RT - Thread Operating System
/ | \ 4.1.1 build Feb 14 2023 10:42:35
2006 - 2022 Copyright by RT-Thread team
[I/sal.skt] Socket Abstraction Layer initialize success.
[I/at.clnt] AT client(V1.3.1) on device usart2 initialize success.
msh >[I/at.dev.esp] esp0 device wifi is connected.
[I/at.dev.esp] esp0 device wifi is disconnect.
[I/at.dev.esp] esp0 device wifi is connected.
[I/at.dev.esp] esp0 device network initialize successfully.
显示esp0驱动成功,网络也配置成功
输入ifconfig查看网络信息:
msh >ifconfig
network interface device: esp0 (Default)
MTU: 1500
MAC: 5c cf 7f d6 7b f5
FLAGS: UP LINK_UP INTERNET_UP DHCP_ENABLE
ip address: 192.168.101.54
gw address: 192.168.101.1
net mask : 255.255.255.0
dns server #0: 192.168.101.1
dns server #1: 0.0.0.0
看到获取到了网络的详细信息。
ping测试
ping百度测试一下,是OK的:
msh >ping www.baidu.com
32 bytes from 14.215.177.39 icmp_seq=0 time=297 ms
32 bytes from 14.215.177.39 icmp_seq=1 time=207 ms
32 bytes from 14.215.177.39 icmp_seq=2 time=223 ms
32 bytes from 14.215.177.39 icmp_seq=3 time=20 ms
【小结】RTT 生态完美支持esp8266。N32G457可以RTT简单的配置,就能实现网络信息交换。
|