【程序】STM32F407VE单片机驱动Marvell 88W8801 WiFi模块的程序(20181010版)

版权声明:本文为博主原创文章,欢迎转载 https://blog.csdn.net/ZLK1214/article/details/82995164

本程序是从STM32F103ZE单片机驱动的88W8801程序(20180807版)移植过来的。

本程序所用的单片机型号为:STM32F407VE
PD14端口为复位引脚(PDN),请务必连接!
晶振用的是8MHz,请注意检查自己的开发板,看看晶振是不是8MHz。如果是25MHz,请修改system_stm32f4xx.c文件!

程序支持连接无密码的热点以及WEP、WPA-PSK和WPA2-PSK认证类型的热点,加密方式支持TKIP和AES。WEP加密类型仅支持添加一个密钥。
程序暂不支持创建AP热点(路由器热点)。
88W8801不支持Ad-Hoc点对点模式, 请不要使用程序中与Ad-Hoc有关的函数。

用Keil5编写程序的时候,工程文件夹路径最好不要出现中文哦!不然代码提示可能会有问题
wifi_88w8801是主程序,直接打开下载运行即可。该程序裸机运行,不带操作系统,运行最新的lwip-2.0.3协议栈

sd8801_uapsta.c是WiFi模块的固件,上电运行时必须由单片机发送给WiFi模块运行
该固件数据非常大,为了节约程序编译下载的时间,可以运行flash_saver程序将这些数据保存到Flash固定区域
然后根据串口提示,修改WiFi.h中WIFI_FIRMWAREAREA_ADDR的值(取消注释)
这样就可以移除sd8801_uapsta.c文件,大幅度降低程序烧写时间了

Keil5工程下载地址:https://pan.baidu.com/s/1Az-Ts1F8HIv2Pe1gqMQ9fQ

【模块连线】

D0~D3接PC8~11,CMD接PD2,CLK接PC12,RESET悬空,PDN接PD14。GND接电源负极,VCC直接接到电源正极。

【Keil5工程截图】

【笔者所用的开发板和WiFi模块】

在笔者所用的开发板上,Wi-Fi模块的VCC不是直接接到电源上的,而是串联了一个场效应管,当PA15为低电平时Wi-Fi模块通电。

【程序运行截图】

1. 串口输出

 

2. ping IP地址和计算机名

3. IE浏览器通过计算机名访问板上的HTTP服务器

4. 路由器管理页面中看到的DHCP客户端列表

5. TCP和UDP数据发送速度测试结果

 

【描述移植过程的Word文档(压缩包内)】

【程序运行结果】

STM32F407VE SDIO 88W8801
RESPCMD63, RESP1_b0ff8000
RESPCMD63, RESP1_b0300000
Number of I/O Functions: 3
Memory Present: 0
Relative Card Address: 0x0001
Card selected! RESP1_00001e00
SDIO Clock: 24MHz
[CIS] func=0, ptr=0x00008000
Product Information: Marvell 802.11 SDIO ID: 48
Manufacturer Code: 0x02df
Manufacturer Information: 0x9138
Card Function Code: 0x0c
System Initialization Bit Mask: 0x00
Maximum Block Size: 256
Maximum Transfer Rate Code: 0x5a
[CIS] func=1, ptr=0x00008080
Manufacturer Code: 0x02df
Manufacturer Information: 0x9139
Card Function Code: 0x0c
System Initialization Bit Mask: 0x00
Maximum Block Size: 512
[CIS] func=2, ptr=0x00008100
[CIS] func=3, ptr=0x00008180
Firmware is successfully downloaded!
CMDRESP 0x804d at 19ms
MAC Addr: 14:6B:9C:17:50:73
CMDRESP 0x8006 at 433ms
SSID 'O(n_n)O??~', MAC F0:B4:29:23:C3:59, RSSI 65, Channel 3
  Capability: 0x0c11 (Security: WPA2, Mode: Infrastructure)
  Rates: 1.0Mbps 2.0Mbps 5.5Mbps 11.0Mbps 9.0Mbps 18.0Mbps 36.0Mbps 54.0Mbps
CMDRESP 0x8006 at 433ms
SSID 'CMCC-EDU', MAC C6:14:4B:57:E0:2D, RSSI 68, Channel 6
  Capability: 0x0621 (Security: Unsecured, Mode: Infrastructure)
  Rates: 1.0Mbps 2.0Mbps 5.5Mbps 11.0Mbps 18.0Mbps 24.0Mbps 36.0Mbps 54.0Mbps
SSID '???', MAC E4:F3:F5:21:55:DC, RSSI 48, Channel 6
  Capability: 0x0431 (Security: WPA2, Mode: Infrastructure)
  Rates: 1.0Mbps 2.0Mbps 5.5Mbps 11.0Mbps 6.0Mbps 9.0Mbps 12.0Mbps 18.0Mbps
SSID 'CMCC-EDU', MAC C6:14:4B:62:AB:CD, RSSI 68, Channel 6
  Capability: 0x0621 (Security: Unsecured, Mode: Infrastructure)
  Rates: 1.0Mbps 2.0Mbps 5.5Mbps 11.0Mbps 18.0Mbps 24.0Mbps 36.0Mbps 54.0Mbps
SSID 'CMCC-EDU', MAC 66:14:4B:58:0A:E7, RSSI 70, Channel 6
  Capability: 0x0621 (Security: Unsecured, Mode: Infrastructure)
  Rates: 1.0Mbps 2.0Mbps 5.5Mbps 11.0Mbps 18.0Mbps 24.0Mbps 36.0Mbps 54.0Mbps
SSID 'CMCC-EDU', MAC 66:14:4B:57:FE:57, RSSI 64, Channel 6
  Capability: 0x0621 (Security: Unsecured, Mode: Infrastructure)
  Rates: 1.0Mbps 2.0Mbps 5.5Mbps 11.0Mbps 18.0Mbps 24.0Mbps 36.0Mbps 54.0Mbps
SSID 'CMCC-Young', MAC E6:14:4B:58:06:D0, RSSI 71, Channel 6
  Capability: 0x0621 (Security: Unsecured, Mode: Infrastructure)
  Rates: 1.0Mbps 2.0Mbps 5.5Mbps 11.0Mbps 18.0Mbps 24.0Mbps 36.0Mbps 54.0Mbps
SSID 'CMCC-Young', MAC C6:14:4B:57:E0:2E, RSSI 68, Channel 6
  Capability: 0x0621 (Security: Unsecured, Mode: Infrastructure)
  Rates: 1.0Mbps 2.0Mbps 5.5Mbps 11.0Mbps 18.0Mbps 24.0Mbps 36.0Mbps 54.0Mbps
SSID 'CMCC-Young', MAC 66:14:4B:57:FE:58, RSSI 63, Channel 6
  Capability: 0x0621 (Security: Unsecured, Mode: Infrastructure)
  Rates: 1.0Mbps 2.0Mbps 5.5Mbps 11.0Mbps 18.0Mbps 24.0Mbps 36.0Mbps 54.0Mbps
SSID 'CMCC-Young', MAC 66:14:4B:58:0A:E8, RSSI 71, Channel 6
  Capability: 0x0621 (Security: Unsecured, Mode: Infrastructure)
  Rates: 1.0Mbps 2.0Mbps 5.5Mbps 11.0Mbps 18.0Mbps 24.0Mbps 36.0Mbps 54.0Mbps
SSID 'CMCC-EDU', MAC E6:14:4B:58:06:DF, RSSI 69, Channel 6
  Capability: 0x0621 (Security: Unsecured, Mode: Infrastructure)
  Rates: 1.0Mbps 2.0Mbps 5.5Mbps 11.0Mbps 18.0Mbps 24.0Mbps 36.0Mbps 54.0Mbps
SSID 'NJSGHMP', MAC C8:3A:35:4B:47:F8, RSSI 70, Channel 7
  Capability: 0x0411 (Security: WPA2, Mode: Infrastructure)
  Rates: 1.0Mbps 2.0Mbps 5.5Mbps 11.0Mbps 18.0Mbps 24.0Mbps 36.0Mbps 54.0Mbps
CMDRESP 0x8006 at 435ms
SSID 'k(j?m)l', MAC 40:31:3C:D3:33:E0, RSSI 52, Channel 9
  Capability: 0x0431 (Security: WPA2, Mode: Infrastructure)
  Rates: 1.0Mbps 2.0Mbps 5.5Mbps 11.0Mbps 6.0Mbps 9.0Mbps 12.0Mbps 18.0Mbps
SSID 'CMCC-EDU', MAC 46:14:4B:57:F8:45, RSSI 68, Channel 11
  Capability: 0x0621 (Security: Unsecured, Mode: Infrastructure)
  Rates: 1.0Mbps 2.0Mbps 5.5Mbps 11.0Mbps 18.0Mbps 24.0Mbps 36.0Mbps 54.0Mbps
SSID 'Oct1158-2', MAC FC:D7:33:FE:D6:02, RSSI 22, Channel 11
  Capability: 0x0431 (Security: WPA2, Mode: Infrastructure)
  Rates: 1.0Mbps 2.0Mbps 5.5Mbps 11.0Mbps 6.0Mbps 9.0Mbps 12.0Mbps 18.0Mbps
SSID 'cdu??', MAC C8:ED:7D:87:78:E0, RSSI 53, Channel 11
  Capability: 0x0431 (Security: WPA2, Mode: Infrastructure)
  Rates: 1.0Mbps 2.0Mbps 5.5Mbps 11.0Mbps 6.0Mbps 9.0Mbps 12.0Mbps 18.0Mbps
SSID 'CMCC-Young', MAC 46:14:4B:57:F8:46, RSSI 68, Channel 11
  Capability: 0x0621 (Security: Unsecured, Mode: Infrastructure)
  Rates: 1.0Mbps 2.0Mbps 5.5Mbps 11.0Mbps 18.0Mbps 24.0Mbps 36.0Mbps 54.0Mbps
SSID 'FAST_6666', MAC D4:83:04:E3:99:9C, RSSI 33, Channel 11
  Capability: 0x0431 (Security: WPA2, Mode: Infrastructure)
  Rates: 1.0Mbps 2.0Mbps 5.5Mbps 11.0Mbps 6.0Mbps 9.0Mbps 12.0Mbps 18.0Mbps
SSID 'CMCC-EDU', MAC 56:14:4B:62:E9:E6, RSSI 49, Channel 11
  Capability: 0x0621 (Security: Unsecured, Mode: Infrastructure)
  Rates: 1.0Mbps 2.0Mbps 5.5Mbps 11.0Mbps 18.0Mbps 24.0Mbps 36.0Mbps 54.0Mbps
SSID 'CMCC-Young', MAC 56:14:4B:62:E9:E7, RSSI 51, Channel 11
  Capability: 0x0621 (Security: Unsecured, Mode: Infrastructure)
  Rates: 1.0Mbps 2.0Mbps 5.5Mbps 11.0Mbps 18.0Mbps 24.0Mbps 36.0Mbps 54.0Mbps
CMDRESP 0x8006 at 220ms
Scan finished!
CMDRESP 0x80c4 at 0ms
CMDRESP 0x8028 at 0ms
CMDRESP 0x8006 at 1497ms
CMDRESP 0x8012 at 12ms
Waiting for authentication!
[Event 23] size=77
WMM status change event occurred!
[Event 43] size=10
Authenticated!
[Send] len=350, port=1
[Recv] len=590, port=1
[Send] len=350, port=2
[Recv] len=590, port=2
[Send] len=42, port=3
[Send] len=42, port=4
[Send] len=42, port=5
DHCP supplied address!
IP address: 192.168.1.101
Subnet mask: 255.255.255.0
Default gateway: 192.168.1.1
DNS Server: 202.115.80.132
[Send] len=42, port=6
Not in cache!
[Recv] len=42, port=3
[Send] len=79, port=7
[Send] len=42, port=8
[Send] len=79, port=9
[Recv] len=223, port=4
DNS Found IP: 208.118.235.79
Connecting to 208.118.235.79...
[Send] len=58, port=10
[Send] len=42, port=11
Packet on port 1 ACK at 1969ms
Packet on port 2 ACK at 1967ms
Packet on port 3 ACK at 1965ms
Packet on port 4 ACK at 1820ms
Packet on port 5 ACK at 1322ms
Packet on port 6 ACK at 1311ms
Packet on port 7 ACK at 1308ms
Packet on port 8 ACK at 1244ms
Packet on port 9 ACK at 1246ms
Packet on port 10 ACK at 1027ms
[Send] len=42, port=1
[Send] len=58, port=2
[Send] len=42, port=3
[Send] len=58, port=4
[Send] len=58, port=5
[Send] len=58, port=6
[Send] len=58, port=7
[Send] len=58, port=8
Connection error! code=-13
[Recv] len=42, port=5

猜你喜欢

转载自blog.csdn.net/ZLK1214/article/details/82995164