HamsterBear F1C200s Linux v5.17 RTL8188EUS 适配

HamsterBear F1C200s Linux v5.17 RTL8188EUS 适配

  • 平台 – F1C200s

  • Linux版本 – 5.17.2

  • Buildroot – v2022.2

底板做了USB HUB, 用的是FE1.1s,一共做了4路,其中一路拿来连wifi模块,另外
3个直接做成了USB Type-A接口
image
image

image

进入 kernel menuconfig 打开如下选项

需要先打开IE802.11协议栈支持
image

image

buildroot中选择如下软件包

(主要是net-tools iw工具包)

启动系统后

1. 修改musb 为host模式

echo host > /sys/devices/platform/soc/1c13000.usb/musb-hdrc.1.auto/mode

[ 1379.560411] phy phy-1c13400.phy.0: Changing dr_mode to 1
[ 1380.223933] usb 1-1: new high-speed USB device number 2 using musb-hdrc
[ 1380.405841] hub 1-1:1.0: USB hub found
[ 1380.409764] hub 1-1:1.0: 4 ports detected
[ 1380.833942] usb 1-1.1: new high-speed USB device number 3 using musb-hdrc
[ 1381.146412] r8188eu: module is from the staging directory, the quality is unknown, you have been warned.
[ 1381.170314] Chip Version Info: CHIP_8188E_Normal_Chip_TSMC_D_CUT_1T1R_RomVer(0)
[ 1381.205020] EEPROM ID = 0x8129
[ 1381.212399] usbcore: registered new interface driver r8188eu

ip addr 可以看到对应wifi接口

# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
2: usb0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop qlen 1000
    link/ether 52:8c:6f:55:1f:64 brd ff:ff:ff:ff:ff:ff
3: wlan0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop qlen 1000
    link/ether 54:ef:33:d6:5e:72 brd ff:ff:ff:ff:ff:ff

2. 固件的导入

模块在上电的时候会加载固件/lib/firmware/rtlwifi/rtl8188eufw.bin
这个固件可以直接从你们linux pc机相同路径为止拷出来,这是我在调试的时候这样做的,
其实你们完全可以在编译环节搞定,在buildroot中,找到
Target packages -> Hardware handling -> Firmware
然后勾选好对应固件就可以了!如果不确定,那就全选上,只要你存储空间够大就行!

3. 连接到wifi

上电

# ifconfig wlan0 up
[ 1687.899356] R8188EU: Firmware Version 11, SubVersion 1, Signature 0x88e1
[ 1688.274263] MAC Address = 54:ef:33:d6:5e:72

扫描附近wifi

# iwlist wlan0 scan
wlan0     Scan completed :
          Cell 01 - Address: 8C:DE:F9:EC:55:8B
                    ESSID:""
                    Protocol:IEEE 802.11bgn
                    Mode:Master
                    Frequency:2.422 GHz (Channel 3)
                    Encryption key:off
                    Bit Rates:144 Mb/s
                    Quality:0  Signal level:0  Noise level:0
          Cell 02 - Address: 96:DE:F9:EC:55:8B
                    ESSID:"kernelbot"
                    Protocol:IEEE 802.11bgn
                    Mode:Master
                    Frequency:2.422 GHz (Channel 3)
                    Encryption key:off
                    Bit Rates:144 Mb/s
                    IE: Unknown: DD820050F204104A0001101044000101103B00010310470010876543219ABCDEF012340AA3C33C838F102100067869616F6D69102300045241383110240004303030321042000531323334351054000800060050F2040001101100135849414F4D495F524F555445525F4755455354100800020000103C0001031049000600372A000120
                    Quality:0  Signal level:0  Noise level:0

连接到wifi

# iwconfig wlan0 essid kernelbot
# iwconfig
lo        no wireless extensions.

usb0      no wireless extensions.

wlan0     IEEE 802.11bgn  ESSID:"kernelbot"  Nickname:"<WIFI@REALTEK>"
          Mode:Managed  Frequency:2.422 GHz  Access Point: 96:DE:F9:EC:55:8B
          Bit Rate:72.2 Mb/s   Sensitivity:0/0
          Retry:off   RTS thr:off   Fragment thr:off
          Encryption key:off
          Power Management:off
          Link Quality=100/100  Signal level=0 dBm  Noise level=0 dBm
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0

请求ip

# udhcpc -i wlan0
udhcpc: started, v1.35.0
udhcpc: broadcasting discover
udhcpc: broadcasting select for 192.168.19.234, server 192.168.19.1
udhcpc: lease of 192.168.19.234 obtained from 192.168.19.1, lease time 43200
deleting routers
adding dns 192.168.19.1

尝试访问外网(没接天线)

# ping baidu.com
PING baidu.com (220.181.38.148): 56 data bytes
64 bytes from 220.181.38.148: seq=0 ttl=50 time=201.784 ms
64 bytes from 220.181.38.148: seq=1 ttl=50 time=225.148 ms
64 bytes from 220.181.38.148: seq=2 ttl=50 time=15.126 ms
64 bytes from 220.181.38.148: seq=3 ttl=50 time=116.496 ms
64 bytes from 220.181.38.148: seq=4 ttl=50 time=115.356 ms
64 bytes from 220.181.38.148: seq=5 ttl=50 time=21.000 ms
64 bytes from 220.181.38.148: seq=6 ttl=50 time=114.353 ms
64 bytes from 220.181.38.148: seq=7 ttl=50 time=122.406 ms
^C
--- baidu.com ping statistics ---
8 packets transmitted, 8 packets received, 0% packet loss
round-trip min/avg/max = 15.126/116.458/225.148 ms

更多玩法

1. MQTT与上位机通信

	大概业务就是 扫描传感器数据上报给上位机
	上位机也可以指定从机行为

2. 移植浏览器访问网页

3. 挂载主机NFS文件系统

4. 做内网WEB服务器

5. 暂时没想到

总结以及遇到的一些问题

总结

因为一开始设计思路就比较清晰,所以整个过程还是比较顺利的,底板设计的时候,因为
粗心大意连错了线,所以又再版了。

内核 buildroot那两块等有空再写详细点。

有问题可以联系我邮箱(writeforever@foxmail.com)

问题

  1. 模块上电后扫描自动断开连接
    后来发现是供电不够,一开始一直用电脑USB接口供电,但那个最大电流貌似就500mA,
    换了个充电头就ok了。

 4 total views,  1 views today

页面下部广告