# WiFi ## 模块介绍 ### ESP8266
esp8266
ESP8266芯片是一款串口转无线模芯片,内部自带固件,用户操作简单,无需编写时序信号等。
#### ESP8266 特性: * 802.11 b/g/n * 内置低功耗32位CPU:可以兼作应用处理器 * 内置10 bit高精度ADC * 内置TCP/IP协议栈 * 内置TR开关、balun、LNA、功率放大器和匹配网络 * 内置PLL、稳压器和电源管理组件 * 支持天线分集 * STBC、1x1 MIMO、2x1 MIMO * A-MPDU、A-MSDU的聚合和0.4 s的保护间隔 * WiFi @ 2.4 GHz,支持 WPA/WPA2 安全模式 * 支持STA/AP/STA+AP工作模式 * 支持Smart Config功能(包括Android和iOS设备) * SDIO 2.0、(H) SPI、UART、I2C、I2S、IR Remote Control、PWM、GPIO * 深度睡眠保持电流为10 uA,关断电流小于5 uA * 2 ms之内唤醒、连接并传递数据包 * 802.11b模式下+20 dBm的输出功率 * 待机状态消耗功率小于1.0 mW (DTIM3) * 工作温度范围:-40°C - 125°C * 通过 FCC, CE, TELEC, WiFi Alliance 及 SRRC 认证 ## 软件结构
esp8266 software structure
软件结构如上图,故测试WiFi的时候需要添加 **AT protocol** 和**Mqtt** ## 模块配置和代码树 [\*] Enable Wifi --->
    --- Enable Wifi
    [\*] Espressif ESP8266 ---> (里面的默认设置就可以使用,无需修改)
        --- Espressif ESP8266
        [ ] Enable initialize by thread
        [\*] **Enable sample(模块注册测试程序, 选定后会再启动时自动加载模块)**
        (xiaoshanos) WIFI ssid
        (12345678) WIFI password
        (uart2) AT client device name
        (512) The maximum length of receive line buffer

[\*] Enable AT protocol ---> (里面的默认设置就可以使用,无需修改)
    --- Enable AT protocol
    Socket abstraction layer --->(里面的默认设置就可用,无需修改)
    Network interface device --->(里面的默认设置就可用,无需修改)
    AT commands ---> (里面的默认设置就可用,无需修改,但可添加调试信息)

[\*] Enable AT commands
    **[ ]Enable debug log output(simple)**
    [\*]Enable AT commands client
    (2) The maximum number of supported clients
    [\*]Enable BSD Socket support
     **[ ]Enable print RAW format communication data(complex)**
    (128)The maximum length of AT Commands buffer

[\*] Enable Mqtt --->(当需要测试mqtt时可以打开,里面的默认设置就可以使用,无需修改)
esp8266_CodeTree