100ASK-V853-PRO开发板支持WIFI和有线网卡
00ASK-V853-PRO开发板支持WIFI和有线网卡
0.前言
通过上一章节,我们已经成功下载Tina SDK包,完成编译并烧写Tina Linux系统,接下来展示100ASK_V853-PRO开发部如何通过WIFI和有线网卡进行上网。
全志Linux Tina-SDK开发完全手册:https://tina.100ask.net/
(资料图)
100ASK_V853-PRO开发板资料合集(包含2000+页 开发文档和Tina SDK包等):
链接:https://pan.baidu.com/s/1TX742vfEde9bMLd9IrwwqA?pwd=sp6a 提取码:sp6a
100ASK_V853-PRO开发板资料汇总:
链接:100ASK_100ASK-PRO 资料汇总 - Allwinner / V853-Pro - 嵌入式开发问答社区
100ASK_V853-PRO开发板购买链接:100ASK_V853-PRO开发板
1.使用WIFI实现上网
100ASK_V853-PRO全功能底板上板载有全志XR829,烧录的开发板系统已经进行了适配,可以直接使用,在开发板上输入ifconfig,可以显示已经使能的网络设备。
root@TinaLinux:/# ifconfiglo 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:EthernetHWaddr 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默认已经使能了,如果没有使能可以输入ifconfig -a
,查看所有网络接口是否存在wlan0设备,如果存在wlan0,则可输入ifconfig wlan0 up
使能wlan0。
root@TinaLinux:/# ifconfig -aeth0 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:59lo 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
使能完成后,由于系统内置wifimanager-v2.0,可以使您快速实现配网,输入wifi -h
,可以获得参数帮助
root@TinaLinux:/# wifi -h=======================================================================************************* sta mode Options **************************=======================================================================wifi -o sta : open sta modewifi -f : close sta modewifi -s : scanwifiwifi -c ssid [passwd] : connect to an encrypted or non-encrypted apwifi -d : disconnect from apwifi -a [enable/disable] : Auto reconnectwifi -l [all] : list connected or saved ap informationwifi -r [ssid/all] : remove a specified network or all networkswifi -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 passwdwifi -l : list current ap mode informationwifi -f : close ap mode=======================================================================*********************** monitor mode Options ************************=======================================================================wifi -o monitor : open monitor modewifi -f : close monitor mode=======================================================================*************************** other Options ***************************=======================================================================wifi -D [error/warn/info/debug/dump/exce] : set debug levelwifi -g : get system mac addrwifi -m [macaddr] : set system mac addrwifi -h : print help=======================================================================
接下来可以进行扫描wifi,注意扫描前需要检查天线是否安装好,安装位置如下图所示。
检查安装完成后,在开发板的串口终端输入wifi -s
root@TinaLinux:/# wifi -sroot@TinaLinux:/# 1970-01-01 04:00:42:003: WMG_DEBUG [wifi_daemon.c:cmd_handle_thread:702]: get cmd: s1970-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 SCAN1970-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_PSK1970-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_PSK1970-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_PSK1970-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_PSK1970-01-01 04:00:45:517: WMG_INFO [wifi_daemon.c:cmd_handle_s:222]: ===Wi-Fiscan successful, total 21 ap(buff size: 60) time 3180.000000 ms===
扫描完成后会打印Wi-Fi scan successful和所用的时间time,可以看到输出信息中的ssid为扫描出来的WIFI名称,注意WIFI名称如果是含有中文字符可能会无法显示。
接下来可以进行连接WIFI进行上网,输入wifi -c ssid [passwd]
,其中ssid为WIFI名,passwd为密码
假设我现在连接的WIFI名称为100ASK,密码为12345678,则需要输入wifi -c 100ASK 12345678
root@TinaLinux:/# wifi -c 100ASK 12345678root@TinaLinux:/# 1970-01-01 04:16:49:482: WMG_DEBUG [wifi_daemon.c:cmd_handle_thread:702]: get cmd: c 100ASK 123456781970-01-01 04:16:49:482: WMG_DEBUG [wifi_daemon.c:cmd_handle_c:232]: cmd handle c: 100ASK 123456781970-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 141970-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_CONFIG1970-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.conf1970-01-01 04:16:51:691: WMG_DEBUG [src/wifimg.c:__wifi_sta_connect:87]: wifi station connect success1970-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.2udhcpc: sending discoverudhcpc: sending select for 192.168.0.163udhcpc: lease of 192.168.0.163 obtained, lease time 1221970-01-01 04:16:53:689: WMG_DEBUG [src/os/linux/udhcpc.c:start_udhcpc:83]: vflag= 41970-01-01 04:16:53:689: WMG_INFO [src/os/linux/udhcpc.c:start_udhcpc:85]: get ip addr 192.168.0.163
可以看到当我们输入完成后,开发板会自动连接到WIFI并会自动获取IP地址,此时我们可以执行ping www.100ask.net,测试wifi是否可以ping通百问网的官方网址,按下Crtl+C结束测试。
root@TinaLinux:/# ping www.100ask.netPING www.100ask.net (118.25.119.100): 56 data bytes64 bytes from 118.25.119.100: seq=0 ttl=53 time=34.627 ms64 bytes from 118.25.119.100: seq=1 ttl=53 time=34.894 ms64 bytes from 118.25.119.100: seq=2 ttl=53 time=34.477 ms64 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 lossround-trip min/avg/max = 34.477/35.206/36.828 ms
2.使用有线网卡实现上网
对于有线网卡,我们在我们的补丁文件中已经做了支持,但没有默认使能,需要我们手动进行使能,在开发板的串口终端输入ifconfig -a
查看所有支持的网络设备,我们可以看到输入后会出现eth0有线网卡的设备。
root@TinaLinux:/# ifconfig -aeth0 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:59lo 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)
确认eth0有线网卡的设备存在,此时输入ifconfig eth0 up
,使能有线网卡。
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
此时从路由器上引出一条网线,插上开发板的有线网口处。
当网线插入开发板后,开发板的串口终端则会输出以下信息,表示有线网络已经连接成功
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
此时需要为开发板设备的有线网口获取IP,输入udhcpc eth0
root@TinaLinux:/# udhcpc eth0udhcpc: started, v1.33.2udhcpc: sending discoverudhcpc: sending select for 192.168.1.38udhcpc: lease of 192.168.1.38 obtained, lease time 86400udhcpc: ip addr add 192.168.1.38/255.255.255.0 broadcast + dev eth0udhcpc: setting default routers: 192.168.1.1
此时我们可以执行ping www.100ask.net,测试wifi是否可以ping通百问网的官方网址,按下Crtl+C结束测试。
root@TinaLinux:/# ping www.100ask.netPING www.100ask.net (118.25.119.100): 56 data bytes64 bytes from 118.25.119.100: seq=0 ttl=54 time=34.836 ms64 bytes from 118.25.119.100: seq=1 ttl=54 time=32.367 ms64 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 lossround-trip min/avg/max = 31.824/33.009/34.836 ms
标签: