Edit online

AIC8800 调试指南

3 Mar 2025
Read time: 8 minute(s)

本章节讲解如何在 Luban-Lite 系统中配置 SDIO 接口的 AIC8800 无线网络模块。

配置 SDMC 接口和 WiFi 模组

使用 SDMC 接口前,选中对应的 SDMC 接口,以 KunLun Pi 开发板为例。

  1. 使用 scons--meunconfig 命令,配置下列内容:
    Board options
        [*] Using SDMC0                                                         # 硬件连接哪个 SDMC 接口,选择哪个 SDMC
         -*-  Enable the interrupt of SDMC
              SDMC0 Parameter  --->
                 Select SDMC0 BUSWIDTH (sdmc 4-bit mode)  --->
                [ ] Using SDcard hotplug detection (NEW)
                [*] SDMC0 connect to a SDIO device
                (3) SDMC0 driver phase (NEW)
                (0) SDMC0 sample phase (NEW)
                (40000000) SDMC0 CMU clock frequency (NEW)                      # 建议使用 40Mhz
        [*] Using Wireless lan --->
            [*] Using Realtek wlan driver --->
                [*]   AIC8800 wlan driver  --->
                    Wlan0 Parameter  --->
                            Select AIC8800 MODEL (select AIC8800D40L)  --->
                            (PD.7) aic8800 wlan0 power on gpio
                            ()  aic8800 wlan0 reset gpio                        # Kunlun Pi WiFi 接口没有连接 reset 引脚,故不做设定
  2. pinmux.c 中配置 WiFi 模块所需使用的引脚:
    struct aic_pinmux aic_pinmux_config[] = {
    ...
    #ifdef AIC_WIRELESS_LAN
        {1, PIN_PULL_DIS, 3, AIC_DEV_AIC8800_WLAN0_PWR_GPIO},  // WIFI_PWR_ON
        {1, PIN_PULL_DIS, 3, AIC_DEV_AIC8800_WLAN0_RST_GPIO},  // WIFI_RST_ON
    #endif
    ...
    };

配置内核和 lwIP

使用 scons --menuconfig 命令进入配置页面,配置如下:

Rt-Thread options --->
    RT-Thread Kernel --->
        [*] Enable software timer with a timer thread
        (4)   The priority level value of timer thread
        (8192) The stack size of timer thread
    RT-Thread Components --->
        Device Drivers --->
            -*-   Using system default workqueue
            (2048)  The stack size for system workqueue thread
            (23)    The priority level of system workqueue thread
            (10240) The stack size for sdio irq thread
            (3)   The priority level value of sdio irq thread
            [*] Using Wi-Fi framework  --->
                (wlan0) The device name for station
                (wlan1) The device name for ap
                (32)  SSID maximum length
                (32)  Password maximum length
                (2)   Driver events maxcount
                [*]   Connection management Enable
                (10000) Set scan timeout time(ms)
                (10000) Set connect timeout time(ms)
                [*]     Automatic sorting of scan results
                [*]     MSH command Enable
                [*]     Auto connect Enable
                (2000)    Auto connect period(ms)
                -*-   WiFi information automatically saved Enable
                (3)     Maximum number of WiFi information automatically saved
                [*]   Transport protocol manage Enable
                (8)     Transport protocol name length
                (2)     Transport protocol maxcount
                (lwip)  Default transport protocol
                [*]     LWIP transport protocol Enable
                (lwip)    LWIP transport protocol name
                [ ]       Forced use of PBUF transmission
                -*-   WLAN work queue thread Enable
                (wlan)  WLAN work queue thread name
                (2048)  WLAN work queue thread size
                (15)    WLAN work queue thread priority
                [*]   Enable WLAN Debugging Options  --->
                    [*]   Enable Debugging of wlan_cmd.c
        C/C++ and POSIX layer  --->
            POSIX (Portable Operating System Interface) layer  --->
                [*] Enable POSIX file system and I/O
                [ ]   Enable devices as file descriptors (NEW)
                [ ]   Enable standard I/O devices, e.g. STDOUT_FILENO (NEW)
                -*-   Enable I/O Multiplexing poll() <poll.h>
                -*-   Enable I/O Multiplexing select() <sys/select.h>
                [*]   Enable BSD Socket I/O <sys/socket.h> <netdb.h>
        Network --->
            -*- SAL: socket abstraction layer  --->
                --- SAL: socket abstraction layer
                [*]   Enable the ability that check internet status
            -*- Enable network interface device  --->
                --- Enable network interface device
                [*]   Enable ifconfig features
                -*-   Enable ping features
                [*]   Enable netstat features
                [*]   Enable default netdev automatic change features
                [ ]   Enable IPV6 protocol support
            -*- LwIP: light weight TCP/IP stack  --->                             # 使用 RT-Thread 内核中的 lwIP
                --- LwIP: light weight TCP/IP stack
                [ ]   Use LwIP local version only
                lwIP version (lwIP v2.0.3)  --->
                [ ]   IPV6 protocol
                (8)   Memory alignment
                [*]   IGMP protocol
                -*-   ICMP protocol
                [ ]   SNMP protocol
                [*]   Enble DNS for name resolution
                [*]   Enable alloc ip address through DHCP
                (1)     SOF broadcast
                (1)     SOF broadcast recv
                      Static IPv4 Address  --->
                -*-   UDP protocol
                [*]   TCP protocol
                -*-   RAW protocol
                [ ]   PPP protocol
                (64)  the number of struct netconns
                (64)  the number of PBUF
                (4)   the number of raw connection
                (16)  the number of UDP socket
                (32)  the number of TCP socket
                (88)  the number of TCP segment
                (30720) the size of send buffer
                (30720) the size of TCP send window
                (7)   the priority level value of lwIP thread
                (160) the number of mail in the lwIP thread mailbox
                (2048) the stack size of lwIP thread
                [ ]   Not use Rx thread
                [ ]   Not use Tx thread
                (12)  the priority level value of ethernet thread
                (4096) the stack size of ethernet thread
                (8)   the number of mail in the ethernet thread mailbox
                [*]   Enable IP reassembly and frag
                (1)   Enable netif status callback
                (1)   Enable netif link status callback
                (1)   Enable SO_REUSEADDR option
                (1)   Enable receive timeout for sockets/netconns and SO_RCVTIMEO processing.
                (1)   Enable send timeout for sockets/netconns and SO_SNDTIMEO processing.
                (1)   Enable SO_RCVBUF processing
                (0)   Enable SO_LINGER processing
                [*]   Enable netif loopback
                [ ]   Enable lwIP statistics
                [ ]   Enable hardware checksum
                [*]   Enable ping features
                [*]   Enable DHCP server
                (192.168.169.1) DHCPD SERVER IP address
                [*]     alloc gateway ip for router
                [ ]     Enable customer DNS server config
                [ ]   Enable lwIP Debugging Options  ----

调试工具

Local packages options  --->
    Third-party packages options  --->
        [ ] LwIP: light weight TCP/IP stack  ----                        # 关闭第三方包中的 lwIP
            [*] netutils: Networking utilities for RT-Thread  --->
                --- netutils: Networking utilities for RT-Thread
                [*]   Enable iperf-liked network performance tool

测试命令

完成所有配置后,保存退出,编译、烧录。待系统启动后,可执行如下命令进行验证:

wifi -d mode sta wlan0

wifi join SSID PASSWORD  // 连接 wifi

ping 192.168.1.1  // 假设网关 IP 为 192.168.1.1,ping 一下验证通路