00ASK-V853-PRO開(kāi)發(fā)板支持WIFI和有線網(wǎng)卡
0.前言
? 通過(guò)上一章節(jié),我們已經(jīng)成功下載Tina SDK包,完成編譯并燒寫(xiě)Tina Linux系統(tǒng),接下來(lái)展示100ASK_V853-PRO開(kāi)發(fā)部如何通過(guò)WIFI和有線網(wǎng)卡進(jìn)行上網(wǎng)。
全志Linux Tina-SDK開(kāi)發(fā)完全手冊(cè):https://tina.100ask.net/
100ASK_V853-PRO開(kāi)發(fā)板資料合集(包含2000+頁(yè) 開(kāi)發(fā)文檔和Tina SDK包等):
鏈接:https://pan.baidu.com/s/1TX742vfEde9bMLd9IrwwqA?pwd=sp6a 提取碼:sp6a
100ASK_V853-PRO開(kāi)發(fā)板資料匯總:
鏈接:100ASK_100ASK-PRO 資料匯總 - Allwinner / V853-Pro - 嵌入式開(kāi)發(fā)問(wèn)答社區(qū)
100ASK_V853-PRO開(kāi)發(fā)板購(gòu)買(mǎi)鏈接:100ASK_V853-PRO開(kāi)發(fā)板
1.使用WIFI實(shí)現(xiàn)上網(wǎng)
? 100ASK_V853-PRO全功能底板上板載有全志XR829,燒錄的開(kāi)發(fā)板系統(tǒng)已經(jīng)進(jìn)行了適配,可以直接使用,在開(kāi)發(fā)板上輸入ifconfig,可以顯示已經(jīng)使能的網(wǎng)絡(luò)設(shè)備。
root@TinaLinux:/# ifconfig
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 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:1
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
wlan0 Link encap:Ethernet HWaddr 84:B0:AC:67:95:EE
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)
可以看到wlan0默認(rèn)已經(jīng)使能了,如果沒(méi)有使能可以輸入ifconfig -a
,查看所有網(wǎng)絡(luò)接口是否存在wlan0設(shè)備,如果存在wlan0,則可輸入ifconfig wlan0 up
使能wlan0。
root@TinaLinux:/# ifconfig -a
eth0 Link encap:Ethernet HWaddr 92:A8:E0:01:3D:F9
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)
Interrupt:59
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 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:1
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
p2p0 Link encap:Ethernet HWaddr 84:B0:AC:67:95:EF
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)
wlan0 Link encap:Ethernet HWaddr 84:B0:AC:67:95:EE
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)
root@TinaLinux:/# ifconfig wlan0 up
使能完成后,由于系統(tǒng)內(nèi)置wifimanager-v2.0,可以使您快速實(shí)現(xiàn)配網(wǎng),輸入wifi -h
,可以獲得參數(shù)幫助
root@TinaLinux:/# wifi -h
=======================================================================
************************* sta mode Options **************************
=======================================================================
wifi -o sta
: open sta mode
wifi -f
: close sta mode
wifi -s
: scan wifi
wifi -c ssid [passwd]
: connect to an encrypted or non-encrypted ap
wifi -d
: disconnect from ap
wifi -a [enable/disable]
: Auto reconnect
wifi -l [all]
: list connected or saved ap information
wifi -r [ssid/all]
: remove a specified network or all networks
wifi -p [softap/ble/xconfig/soundwave]
: softap/ble/xconfig/soundwave distribution network
=======================================================================
************************* ap mode Options ***************************
=======================================================================
wifi -o ap [ssid] [passwd]
: open ap mode
: if ssid and passwd is not set, start the default configuration: (allwinner-ap Aa123456)
: if only set ssid, start the ap without passwd
wifi -l
: list current ap mode information
wifi -f
: close ap mode
=======================================================================
*********************** monitor mode Options ************************
=======================================================================
wifi -o monitor
: open monitor mode
wifi -f
: close monitor mode
=======================================================================
*************************** other Options ***************************
=======================================================================
wifi -D [error/warn/info/debug/dump/exce]
: set debug level
wifi -g
: get system mac addr
wifi -m [macaddr]
: set system mac addr
wifi -h
: print help
=======================================================================
接下來(lái)可以進(jìn)行掃描wifi,注意掃描前需要檢查天線是否安裝好,安裝位置如下圖所示。
檢查安裝完成后,在開(kāi)發(fā)板的串口終端輸入wifi -s
root@TinaLinux:/# wifi -s
root@TinaLinux:/# 1970-01-01 04:00:42:003: WMG_DEBUG [wifi_daemon.c:cmd_handle_thread:702]: get cmd: s
1970-01-01 04:00:42:003: WMG_DEBUG [wifi_daemon.c:cmd_handle_s:196]: cmd handle s:
1970-01-01 04:00:42:004: WMG_DEBUG [src/wmg_sta.c:sta_mode_ctl:463]: =====sta_mode_ctl cmd: 8=====
1970-01-01 04:00:42:004: WMG_EXCESSIVE [src/os/linux/linux_wpa.c:command_to_supplicant:195]: do cmd SCAN
1970-01-01 04:00:42:004: WMG_EXCESSIVE [src/os/linux/linux_wpa.c:command_to_supplicant:203]: do cmd SCAN, reply: OK
...
1970-01-01 04:00:45:185: WMG_INFO [wifi_daemon.c:cmd_handle_s:220]: bss[00]: bssid=94:d9:b3:b7:c9:0a ssid=100ASK channel=7(freq=2442) rssi=-23 sec=WPA_PSK
1970-01-01 04:00:45:185: WMG_INFO [wifi_daemon.c:cmd_handle_s:220]: bss[01]: bssid=d0:76:e7:f8:93:d8 ssid=TP-LINK_93D8 channel=6(freq=2437) rssi=-70 sec=WPA_PSK
1970-01-01 04:00:45:185: WMG_INFO [wifi_daemon.c:cmd_handle_s:220]: bss[02]: bssid=7a:60:5b:29:22:ab ssid= channel=2(freq=2417) rssi=-70 sec=WPA2_PSK
1970-01-01 04:00:45:185: WMG_INFO [wifi_daemon.c:cmd_handle_s:220]: bss[03]: bssid=7a:60:5b:59:22:ab ssid= channel=2(freq=2417) rssi=-70 sec=WPA_PSK
1970-01-01 04:00:45:517: WMG_INFO [wifi_daemon.c:cmd_handle_s:222]: ===Wi-Fi scan successful, total 21 ap(buff size: 60) time 3180.000000 ms===
掃描完成后會(huì)打印Wi-Fi scan successful和所用的時(shí)間time,可以看到輸出信息中的ssid為掃描出來(lái)的WIFI名稱(chēng),注意WIFI名稱(chēng)如果是含有中文字符可能會(huì)無(wú)法顯示。
接下來(lái)可以進(jìn)行連接WIFI進(jìn)行上網(wǎng),輸入wifi -c ssid [passwd]
,其中ssid為WIFI名,passwd為密碼
假設(shè)我現(xiàn)在連接的WIFI名稱(chēng)為100ASK,密碼為12345678,則需要輸入wifi -c 100ASK 12345678
root@TinaLinux:/# wifi -c 100ASK 12345678
root@TinaLinux:/# 1970-01-01 04:16:49:482: WMG_DEBUG [wifi_daemon.c:cmd_handle_thread:702]: get cmd: c 100ASK 12345678
1970-01-01 04:16:49:482: WMG_DEBUG [wifi_daemon.c:cmd_handle_c:232]: cmd handle c: 100ASK 12345678
1970-01-01 04:16:49:482: WMG_INFO [wifi_daemon.c:cmd_handle_c:256]: connect to sta(100ASK) with pask(12345678)
...
1970-01-01 04:16:51:670: WMG_EXCESSIVE [src/os/linux/event.c:evt_read:128]: Excessive: read event 14
1970-01-01 04:16:51:670: WMG_DUMP [src/os/linux/linux_wpa.c:linux_supplicant_connect_to_ap:1531]: receive wpas event 'CONNECTED'
1970-01-01 04:16:51:671: WMG_EXCESSIVE [src/os/linux/linux_wpa.c:command_to_supplicant:195]: do cmd SAVE_CONFIG
1970-01-01 04:16:51:691: WMG_WARNG [src/os/linux/linux_wpa.c:linux_supplicant_connect_to_ap:1559]: failed to save config to wpa_supplicant.conf
1970-01-01 04:16:51:691: WMG_DEBUG [src/wifimg.c:__wifi_sta_connect:87]: wifi station connect success
1970-01-01 04:16:51:691: WMG_INFO [wifi_daemon.c:cmd_handle_c:265]: ===Wi-Fi connect successful,time 2210.000000 ms===
udhcpc: started, v1.33.2
udhcpc: sending discover
udhcpc: sending select for 192.168.0.163
udhcpc: lease of 192.168.0.163 obtained, lease time 122
1970-01-01 04:16:53:689: WMG_DEBUG [src/os/linux/udhcpc.c:start_udhcpc:83]: vflag= 4
1970-01-01 04:16:53:689: WMG_INFO [src/os/linux/udhcpc.c:start_udhcpc:85]: get ip addr 192.168.0.163
可以看到當(dāng)我們輸入完成后,開(kāi)發(fā)板會(huì)自動(dòng)連接到WIFI并會(huì)自動(dòng)獲取IP地址,此時(shí)我們可以執(zhí)行ping www.100ask.net,測(cè)試wifi是否可以ping通百問(wèn)網(wǎng)的官方網(wǎng)址,按下Crtl+C結(jié)束測(cè)試。
root@TinaLinux:/# ping www.100ask.net
PING www.100ask.net (118.25.119.100): 56 data bytes
64 bytes from 118.25.119.100: seq=0 ttl=53 time=34.627 ms
64 bytes from 118.25.119.100: seq=1 ttl=53 time=34.894 ms
64 bytes from 118.25.119.100: seq=2 ttl=53 time=34.477 ms
64 bytes from 118.25.119.100: seq=3 ttl=53 time=36.828 ms
^C
--- www.100ask.net ping statistics ---
4 packets transmitted, 4 packets received, 0% packet loss
round-trip min/avg/max = 34.477/35.206/36.828 ms
2.使用有線網(wǎng)卡實(shí)現(xiàn)上網(wǎng)
? 對(duì)于有線網(wǎng)卡,我們?cè)谖覀兊难a(bǔ)丁文件中已經(jīng)做了支持,但沒(méi)有默認(rèn)使能,需要我們手動(dòng)進(jìn)行使能,在開(kāi)發(fā)板的串口終端輸入ifconfig -a
查看所有支持的網(wǎng)絡(luò)設(shè)備,我們可以看到輸入后會(huì)出現(xiàn)eth0有線網(wǎng)卡的設(shè)備。
root@TinaLinux:/# ifconfig -a
eth0 Link encap:Ethernet HWaddr 92:A8:E0:01:3D:F9
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)
Interrupt:59
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 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:1
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
p2p0 Link encap:Ethernet HWaddr 84:B0:AC:67:95:EF
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)
wlan0 Link encap:Ethernet HWaddr 84:B0:AC:67:95:EE
inet addr:192.168.0.163 Bcast:192.168.0.255 Mask:255.255.255.0
inet6 addr: fe80::86b0:acff:fe67:95ee/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2676 errors:0 dropped:14 overruns:0 frame:0
TX packets:34 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:440957 (430.6 KiB) TX bytes:3968 (3.8 KiB)
? 確認(rèn)eth0有線網(wǎng)卡的設(shè)備存在,此時(shí)輸入ifconfig eth0 up
,使能有線網(wǎng)卡。
root@TinaLinux:/# ifconfig eth0 up
[ 3183.253385] libphy: gmac0: probed
[ 3183.302411] sunxi-gmac gmac0 eth0: eth0: Type(6) PHY ID 001cc816 at 0 IRQ poll (gmac0-0:00)
[ 3183.322880] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
? 此時(shí)從路由器上引出一條網(wǎng)線,插上開(kāi)發(fā)板的有線網(wǎng)口處。
當(dāng)網(wǎng)線插入開(kāi)發(fā)板后,開(kāi)發(fā)板的串口終端則會(huì)輸出以下信息,表示有線網(wǎng)絡(luò)已經(jīng)連接成功
root@TinaLinux:/# [ 3318.532310] sunxi-gmac gmac0 eth0: Link is Up - 100Mbps/Full - flow control rx/tx
[ 3318.540797] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
此時(shí)需要為開(kāi)發(fā)板設(shè)備的有線網(wǎng)口獲取IP,輸入udhcpc eth0
root@TinaLinux:/# udhcpc eth0
udhcpc: started, v1.33.2
udhcpc: sending discover
udhcpc: sending select for 192.168.1.38
udhcpc: lease of 192.168.1.38 obtained, lease time 86400
udhcpc: ip addr add 192.168.1.38/255.255.255.0 broadcast + dev eth0
udhcpc: setting default routers: 192.168.1.1
此時(shí)我們可以執(zhí)行ping www.100ask.net,測(cè)試wifi是否可以ping通百問(wèn)網(wǎng)的官方網(wǎng)址,按下Crtl+C結(jié)束測(cè)試。
root@TinaLinux:/# ping www.100ask.net
PING www.100ask.net (118.25.119.100): 56 data bytes
64 bytes from 118.25.119.100: seq=0 ttl=54 time=34.836 ms
64 bytes from 118.25.119.100: seq=1 ttl=54 time=32.367 ms
64 bytes from 118.25.119.100: seq=2 ttl=54 time=31.824 ms
^C
--- www.100ask.net ping statistics ---
4 packets transmitted, 3 packets received, 25% packet loss
round-trip min/avg/max = 31.824/33.009/34.836 ms
-
Linux
+關(guān)注
關(guān)注
87文章
11306瀏覽量
209572 -
網(wǎng)卡
+關(guān)注
關(guān)注
4文章
311瀏覽量
27386 -
路由器
+關(guān)注
關(guān)注
22文章
3732瀏覽量
113820 -
WIFI
+關(guān)注
關(guān)注
81文章
5297瀏覽量
203782 -
開(kāi)發(fā)板
+關(guān)注
關(guān)注
25文章
5057瀏覽量
97520
發(fā)布評(píng)論請(qǐng)先 登錄
相關(guān)推薦
評(píng)論