基于BeagleBone的WIFI通信
硬件环境: BeagleBone 无线网卡: TL-WN321G+ 操作系统: linux-3.1.0-psp04.06.00.03.sdk
1. Linux-3.1.0内核已经支持RT73的驱动,所以配置一下内核就可以了,主要由以下两个步骤: 1) 无线网络协议栈的配置 Networking support —>
Wireless —> Generic IEEE 802.11 Networking Stack (mac80211)
如果没有配置MAC80211,是看不到RT73的驱动的 2) 选择RT73 USB无线网卡驱动 Device Drivers —> Network device support —> Wireless LAN —> Ralink driver support —> <*> Ralink rt2501/rt73(USB) support
2. 接着Make uImage,把内核映像文件拷贝到SD卡中
3. 安装wireless_tools opkg install wireless-tools_29-r4_armv7a.ipk
4. 插入USB无线网卡,查看USB设备
root@beaglebone:/etc# lsusb Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 001 Device 003: ID 148f:2573 Ralink Technology, Corp. RT2501USB Wireless Adapter Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
5. 激活网卡
root@beaglebone:~# ifconfig wlan0 up root@beaglebone:~# ifconfig lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:4 errors:0 dropped:0 overruns:0 frame:0 TX packets:4 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:280 (280.0 B) TX bytes:280 (280.0 B) wlan0 Link encap:Ethernet HWaddr 00:25:86:AD:C2:D5 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)
6. 扫描可用的无线网络 iwlist wlan0 scan
7. 配置wpa.conf
新建文件 /etc/wpa.conf
ctrl_interface=/var/run/wpa_supplicant network={ ssid="无线网路名称" psk="密码" }
8. 连接wlan0到网络
wpa_supplicant -B -i wlan0 -c /etc/wpa.conf
-B Background 在后台以daemon 运行
-i interface
-c 配置文件
不要用 iwconfig wlan0来连接网络哦,这个是对WEP加密方式的无线网络
9. 设置IP
ifconfig wlan0 192.168.10.125
10. 执行ping
root@beaglebone:/etc# ifconfig wlan0 192.168.10.125 root@beaglebone:/etc# ping 192.168.10.105 PING 192.168.10.105 (192.168.10.105) 56(84) bytes of data. 64 bytes from 192.168.10.105: icmp_req=1 ttl=64 time=1133 ms 64 bytes from 192.168.10.105: icmp_req=2 ttl=64 time=126 ms 64 bytes from 192.168.10.105: icmp_req=3 ttl=64 time=11.1 ms
|