C/C++教程

MYD-YA157C系列定制板AP6234无线网卡适配笔记

本文主要是介绍MYD-YA157C系列定制板AP6234无线网卡适配笔记,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

MYD-YA157C系列定制板AP6234无线网卡适配笔记 2021.8.13

 

MYD-YA157C定制板标配采用了AP6212(BCM43430A0)wifi&Bluetooth二合一模块,且官方已对其做好了驱动适配,该网卡驱动需要与固件配合使用。

 

此次我们定制的开发板使用了AP6234(BCM43340B0),支持5G频段,原版系统镜像中已包含AP6212的驱动,但没有针对AP6234做适配,运行ifconfig,里面并没有出现wlan0等接口。

root@myir:~# ifconfig
eth0      Link encap:Ethernet  HWaddr D2:9C:38:63:E6:C1  
          inet addr:192.168.10.2  Bcast:192.168.10.255  Mask:255.255.255.0
          inet6 addr: fe80::d09c:38ff:fe63:e6c1/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:5939 errors:0 dropped:1 overruns:0 frame:0
          TX packets:5772 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:501741 (489.9 KiB)  TX bytes:2401061 (2.2 MiB)
          Interrupt:51 Base address:0x8000 

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:376 errors:0 dropped:0 overruns:0 frame:0
          TX packets:376 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:23344 (22.7 KiB)  TX bytes:23344 (22.7 KiB)

usb0      Link encap:Ethernet  HWaddr B6:1F:9D:BB:2B:CE  
          inet addr:192.168.7.2  Bcast:192.168.7.255  Mask:255.255.255.0
          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)

接下来我们运行dmesg | grep brcmfmac

root@myir:~# dmesg | grep brcmfmac
[   14.757669] brcmfmac: F1 signature read @0x18000000=0x1602a94c
[   14.806110] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43340-sdio for chip BCM43340/2
[   14.836721] brcmfmac mmc0:0001:1: Direct firmware load for brcm/brcmfmac43340-sdio.bin failed with error -2
[   15.887412] brcmfmac: brcmf_sdio_htclk: HT Avail timeout (1000000): clkctl 0x50

发现这里有一条错误:Direct firmware load for brcm/brcmfmac43340-sdio.bin failed with error -2

由于米尔官方已经对另一个相似的wifi模块AP6212进行适配,所以这里我们直接更换固件进行试验。

从GitHub下载brcmfmac43340-sdio.bin放到/lib/firmware/brcm目录下 (固件链接放在文章最后),并在此目录下新建一个txt文件,命名为brcmfmac43340-sdio.myir,stm32mp157c-ya157c-v2.txt,并把以下内容复制到该文本文件中,注意nvram里面的xtalfreq改为xtalfreq=26000并保存。

#AP6234_NVRAM_V1.1_20131225
manfid=0x2d0
prodid=0x0653
vendid=0x14e4
devid=0x4386
boardtype=0x0653
boardrev=0x1203
boardnum=22
macaddr=00:90:4c:c5:12:38
sromrev=3
#boardflags: 
# bit 19 3tswitch:   2.4GHz FEM: SP3T switch share with BT
# bit 16     nopa:   no external pa
#            keep original 0x200
boardflags=0x0090201
xtalfreq=37400  /*模块使用26M晶振,此处应改为26000*/
nocrc=1
ag0=255
aa2g=1
ccode=ALL
pa0itssit=0x20
#PA parameters for 2.4GHz
pa0b0=6957 default
#pa0b0=6727 
pa0b1=-808
pa0b2=-178
tssifloor2g=69
# rssi params for 2.4GHz
rssismf2g=0xf
rssismc2g=0x8
rssisav2g=0x1
cckPwrOffset=3

# rssi params for 5GHz
rssismf5g=0xf
rssismc5g=0x7
#rssisav5g=0x1
rssisav5g=0x3

#PA parameters for lower a-band
#pa1lob0=5659 default
pa1lob0=5859
#pa1lob0=5659
pa1lob1=-693
pa1lob2=-178
tssifloor5gl=77

#PA parameters for midband
pa1b0=5372 
#pa1b0=5172
pa1b1=-671
pa1b2=-212
tssifloor5gm=77

#PA paramasdeters for high band
#pa1hib0=5320 default
pa1hib0=5620
#pa1hib1=-963
pa1hib1=-663
pa1hib2=-179
tssifloor5gh=74

rxpo5g=0
maxp2ga0=76
#  19.5dBm max; 18dBm target
#Per rate power back-offs for g band, in .5 dB steps. Set it once you have the right numbers.
cck2gpo=0x2222 
ofdm2gpo=0x333333333
# R54 16dBm; R48 17dBm; others 18dBm
mcs2gpo0=0x5555
# M0~ M4 17dBm
mcs2gpo1=0x5555
# M5M6 15dBm; M7 14.5dBm
#max power for 5G
maxp5ga0=68
# 16dBm target; 17.5dBm Max 
maxp5gla0=68
maxp5gha0=68
#Per rate power back-offs for a band, in .5 dB steps. Set it once you have the right numbers.
ofdm5gpo=0x66666666
# R54 13.5dBm
ofdm5glpo=0x66666666
ofdm5ghpo=0x66666666
mcs5gpo0=0x8888
# M0~M4 16dBm (1dB higher than ofdm)
mcs5gpo1=0x8888
# M5M6 13.5dBm; M7 12dBm
mcs5glpo0=0x7777
mcs5glpo1=0x7777
mcs5ghpo0=0x7777
mcs5ghpo1=0x7777
# Parameters for DAC2x mode and ALPF bypass
# RF SW Truth Table: ctrl0 for BT_TX; ctrl1 or 5G Tx; ctrl2 for 5G Rx; Ctrl3 for 2G Tx; Ctrl4 for 2G Rx
swctrlmap_2g=0x00080008,0x00100010,0x00080008,0x011010,0x11f
swctrlmap_5g=0x00040004,0x00020002,0x00040004,0x011010,0x2fe
gain=32
triso2g=8
triso5g=8
#tx parameters
loflag=0
iqlocalidx5g=40
dlocalidx5g=70
iqcalidx5g=50
lpbckmode5g=1 
txiqlopapu5g=0
txiqlopapu2g=0
dlorange_lowlimit=5
txalpfbyp=1
txalpfpu=1
dacrate2xen=1
papden2g=1
papden5g=1
#rx parameters
gain_settle_dly_2g=4
gain_settle_dly_5g=4
noise_cal_po_2g=-1
noise_cal_po_40_2g=-1
noise_cal_high_gain_2g=73
noise_cal_nf_substract_val_2g=346
noise_cal_po_5g=-1
noise_cal_po_40_5g=-1
noise_cal_high_gain_5g=73
noise_cal_nf_substract_val_5g=346
cckpapden=0
# Enable OOB interrupt: level trigger
muxenab=0x10

保存后,重启定制板。

root@myir:~# reboot

重启后,使用dmesg命令查看关于该模块的日志。

dmesg | grep brcmfmac

执行ifconfig,发现列表中没有wlan相关接口。        

 

继续执行ifconfig -a

这次发现列表中已经有wlan0,但并没有被启用。

输入以下命令激活wlan0

ifconfig wlan0 up

再次执行ifconfig,wlan0已出现在列表中。

输入以下命令扫描周围WiFi

iw dev wlan0 scan | grep SSID

2.4G和5G信号均能搜索到,无线网卡已成功适配。

 

这篇关于MYD-YA157C系列定制板AP6234无线网卡适配笔记的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!