支持WiFi与4G模组联网
背景
本文基于4G模组/WiFi网络的目标,需要首先在T113s3Pro-V1.3-SdNand 工业套件上把4G模组联网,和WiFi功能支持起来,然后再去实现其他功能。
WiFi模组适配
WiFi模组介绍
T113s3Pro-V1.3-SdNand 工业套件,板载的AIC8800是具有双频WiFi6和BT二合一模块,。
模组移植适配
在百问网开发网站提供的补丁包,打入完成后,具有了WiFi模组的驱动程序。
T113S3-PRO_TinaSDK5
├── kernel
│   └── linux-5.4
│       └── drivers
│           └── net
│               └── wireless
│                   └── aic8800
│                       ├── Kconfig
│                       ├── Makefile
│                       ├── aic8800_bsp
│                       │   ├── Makefile
│                       │   ├── aic8800d80_compat.c
│                       │   ├── aic8800d80_compat.h
│                       │   ├── aic8800dc_compat.c
│                       │   ├── aic8800dc_compat.h
...
│                       └── aic8800_fdrv
│                           ├── sdio_host.h
│                           ├── usb_host.c
│                           └── usb_host.h
└── platform
    └── allwinner
        └── wireless
            └── firmware
                └── aic8800
                    └── aic8800d80
                        ├── aic_userconfig_8800d80.txt
                        ├── fmacfw_8800d80_u02.bin
                        ├── fw_adid_8800d80_u02.bin
                        ├── fw_patch_8800d80_u02.bin
                        ├── fw_patch_table_8800d80_u02.bin
                        └── lmacfw_rf_8800d80_u02.bin
打开驱动编译支持


只需要在kernel的网络设备-无线设备下面打开AIC无线的支持即可,这个在打入百问网对xx适配的补丁包后,就已经默认打开了。
模组测试
在测试前,要先加载WiFi模组的驱动程序,如下所示:
# insmod /lib/modules/5.4.61/aic8800_bsp.ko
[  203.391853] aicbsp_init
[  203.394607] RELEASE_DATE:2023_0904_1726
# insmod /lib/modules/5.4.61/aic8800_fdrv.ko
[  209.944090] AICWFDBG(LOGTRACE)	>>> rwnx_mod_init()
[  209.949624] AICWFDBG(LOGINFO)	rwnx v6.4.3.0 - - 241c091M (master)
[  209.956473] AICWFDBG(LOGINFO)	RELEASE_DATE:2023_0904_1725 
[  209.962767] AICWFDBG(LOGTRACE)	rwnx_init_cmd_array Enter 
...
[  214.498858] ieee80211 phy0: 
[  214.498858] *******************************************************
[  214.498858] ** CAUTION: USING PERMISSIVE CUSTOM REGULATORY RULES **
[  214.498858] *******************************************************
[  214.523161] AICWFDBG(LOGTRACE)	>>> rwnx_send_me_chan_config_req()
[  214.530025] AICWFDBG(LOGTRACE)	rwnx_send_msg (5123)ME_CHAN_CONFIG_CFM reqcfm:1 in_irq:0 in_softirq:0 in_atomic:0
[  214.541558] AICWFDBG(LOGTRACE)	rwnx_cmd_malloc get cmd_array[0]:127c02ad 
[  214.549705] AICWFDBG(LOGTRACE)	rwnx_cmd_free cmd_array[0]:127c02ad 
[  214.556836] AICWFDBG(LOGTRACE)	>>> rwnx_dbgfs_register()
[  214.562964] AICWFDBG(LOGINFO)	fw_log_init: c520c000, c520e800
[  214.569476] AICWFDBG(LOGINFO)	rwnx_interface_add: wlan%d, 2, 10
[  214.576375] AICWFDBG(LOGINFO)	interface add:e8 51 9e dc 7a 7f
[  215.256714] AICWFDBG(LOGINFO)	New interface create wlan0 
...
出现以上信息,表示WiFi驱动模块加载成功。执行 ifconfig -a 指令,可以看到存在 wlan0 节点。
# ifconfig wlan0
wlan0     Link encap:Ethernet  HWaddr EE:90:92:F2:D6:E2  
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)