BPI-R2 2.4Ghz and 5.6Ghz Wifi Working fine

Thank you, on second try it did work… Now I can see some wifi networks around…

Now it seems that wifi is working if I start everything by hand - hostapd, assign ip adresses, etc. But I cant configure it using LuCI. It just does not do anything.

When I start wmt_loader, 3 wirelss interfaces appear in luci: radio0,1,2. All with all-zeros mac address. So I tried to edit manually /etc/config/wireless and edited the values to

config wifi-device 'ap0'
        option type 'mac80211'
        option hwmode '11g'
        option macaddr '02:08:22:90:C0:FF' (the mac of wlan0 begins wit 00:xx)
        option channel '1'
        option country 'CZ'

config wifi-iface 'default_ap0'
        option device 'ap0'
        option network 'lan'
        option mode 'ap'
        option ssid 'LEDE'

I was able to edit the network options like encryption using LuCI, also added the interface to the lan bridge, or tried to make it separate - just nothing happens. As if some tools are missing or what? I tried with hostapd and wpad - neither does anything.

The only relevent thing in syslog seems to be this:

Sun Oct 20 21:46:11 2019 daemon.notice netifd: ap0 (2751): Could not find PHY for device 'ap0'
Sun Oct 20 21:46:11 2019 daemon.notice netifd: ap0 (2759): WARNING: Variable 'data' does not exist or is not an array/object

Any suggestions? I’m just stating to bang my head against wall… And wonder how can anyone sell these devices and claim that openwrt is working on them? Um… it is working after several days of fiddling and doing non standard stuff… Aaargh…

You cannot set options for ap0 in system,because it is not available after reboot. Maybe gary has created an init-script which does the wmt-commands on boot. Else you have to set ip,hostap,dhcp-settings after runninh wmt-commands

I have tried several precompiled openwrt images. Some of them didn’t boot at all, some had broken packets on LAN bridge, and those that worked didn’t have wlan0 or ap0 after boot. So I thought they lack the driver completely. I didn’t know that I have to run wmt… But anyway I would be in the same situation as now. Thanks for clarification.

Broken packets on lan bridge may be caused by second gmac patches without setting both gmacs to same rgmii-mode

Yes, it was solved here: OpenWrt 18.06 malformed ip packets at bridged interface

The problem was to find image or at least repository (and branch) that has the patch applied. I found at least three git clones of openwrt related to bpi-r2… This is so confusing for someone who is new to this platform. And then even the subject of this topic is confusing. I should be: Wifi working fine, but you have to do some woodo before ! :wink:

you’ve seen that this topic is ubuntu-related and not lede/openwrt? :stuck_out_tongue: the official ubuntu does not use second gmac patches from openwrt/lede that break 1st gmac (lan)

Not really. I thought this is about the wifi in general, not ubuntu specific. Sorry for drifting off-topic. However one important finding that might be useful for all platforms. There has to be some significant delay between stp_uart_launcher and “echo A”. Otherwise hostapd does not work properly, and clients cannot associate. (That was another two hours wondering why something that worked once does not work any more)… EDIT: it was maybe not the delay (10s seems to be enough after all), but hw_mode=g that broke it. hw_mode=a or =b (default seems to be OK). But also stopping and starting hostap breaks it too. EDIT2: it seems quite random, after stopping hostap, I have to reste the driver with echo 0/echo A. And then run hostapd again (with different options - a/b/g/channels/wpa/etc…) Sometimes it works, sometimes not, and no error is logged anywhere. while I’m writing it started to work by itself, and client connected. Maybe something takes too much time? Also almost all bandwidth tests made the wifi stop doing anything, and while stopped associations (wpa2 handshake) failed. I thought about lack of entropy - but I have hwrng and rngd working, rngtest on /dev/random looks good. Tried wifi without encryption and it is the same - a few seconds of bandwith test and it gets stuck… Any ideas?

i have running hostapd on ap0 with hw-mode=g and using this script to start wifi (including hostapd)

/etc/hostapd/hostapd_ap0.conf:

interface=ap0
driver=nl80211

ssid=r2_AP0

hw_mode=g
channel=13
auth_algs=1
#ignore_broadcast_ssid=0
wpa=2
wmm_enabled=1
wpa_passphrase=12345678
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP

Thank you, the script looks really fool-proof. Is the wifi stable on your system? Is there a way how to check if I have the latest version of driver & firmware?

Imho there is only one firmware and driver is only ported by me to higher kernel-versions and optimized by some people like @lexa2 but that makes driver not “newer”

@vladislav_kurz This is unfortunate state that the driver we’ve got on hands is in. It is by no means end-user ready and won’t ever get to that level of quality unless someone from Mediatek linux team steps in and helps us to either do a complete rewrite of this driver or at the very least patch the existing one to the later version of codebase Mediatek propably have got available internally. Base for the driver was an Android source code published for some other device using the same wifi chipset that was hacked’n’patched by @sinovoip representatives to be buildable under linux 4.14. No bug fixes were done to the driver itself since then except for porting it to the ever-changing internal APIs coming with new linux kernel versions. If you want to have more-or-less stable WiFi on BPi-R2 - better option would be to buy PCIEx wlan module with a chipset that had known good support in vanilla linux kernel.

1 Like

Gary ported to 4.9…all higher porting was done by me (and 4.14 was very hard because this were my first steps in driver development and git)

Thank you guys for the work you did, and info you gave me.

I got message from another user that he asks a wifi driver developer from openwrt what needs to be done. Currently workload is estimated…

1 Like

@LeXa2 - following your advice I have bought intel 7260, which I know works well under Linux (Debian), but I can’t get it working on openwrt. Iwlwifi driver depends on cfg80211 and that cannot be loaded due to: cfg80211: exports duplicate symbol __cfg80211_alloc_event_skb (owned by kernel)

As if some patches specific to banana Pi, duplicate cfg80211 functions. Is there anything I should tweak in the config before compilation?

bad news, wifi-driver will not be rewritten by openwrt-developer, so we stay on that buggy driver

@vladislav_kurz as it works with debian there is anything openwrt specific…you can search for EXPORT_SYMBOL(your function name) and disable it for this function

Where should I search? In the sources? And just comment it and compile again?

Right,you should find 2 such lines

grep -Rni 'EXPORT_SYMBOL(...)' .

Hello frank-w, hello all,

I appriciate your effort to make a bunch of description, helper, how to’s, images, kernels… All of them are very useful! Thank you! I’d have a short question! I’m able to configure all lan ports in br0, and ap0 also, and make them working via DHCP. Under /etc/hostap.d/interfaces.conf are 2,4 GHz and 5ghz ap0 configured. But only the last, 5ghz is running, if I start all stuff for wifi. Anyway, it’s working only for just 2,4 GHz, if I remove settings for 5ghz. It is possible to run both (2,4 and 5) in AP mode? Best regards, furumc