【程序】STM32F407VE單片機驅動Marvell 88W8801 WiFi模塊的程序(20181010版)

本程序是從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

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章