Raspberry Pi Zero W AP+STA mode

Hi, I am trying to get Raspberry PI Zero W to work in simultaneous AP+STA mode. This kind of sort of works in raspbian, however I haven't been able to get it to work on OpenWrt. For raspbian I used the instructions from https://blog.thewalr.us/2017/09/26/raspberry-pi-zero-w-simultaneous-ap-and-managed-mode-wifi/.
On booting with raspbian, I see this in dmesg for brcmfmac driver load.

[   10.473651] brcmfmac: F1 signature read @0x18000000=0x1541a9a6
[   10.486165] brcmfmac: brcmf_fw_map_chip_to_name: using brcm/brcmfmac43430-sdio.bin for chip 0x00a9a6(43430) rev 0x000001
[   10.486550] usbcore: registered new interface driver brcmfmac
[   10.969625] brcmfmac: brcmf_c_preinit_dcmds: Firmware version = wl0: Oct 23 2017 03:55:53 version 7.45.98.38 (r674442 CY) FWID 01-e58d219f
[   10.970748] brcmfmac: brcmf_c_preinit_dcmds: CLM version = API: 12.2 Data: 7.11.15 Compiler: 1.24.2 ClmImport: 1.24.1 Creation: 2014-05-26 10:53:55 Inc Data: 9.10.39 Inc Compiler: 1.29.4 Inc ClmImport: 1.36.3 Creation: 2017-10-23 03:47:14 
[   17.965633] brcmfmac: power management disabled

However, booting with openwrt I see this in dmesg

root@OpenWrt:/# dmesg | grep brcm
[    7.185771] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43430-sdio for chip BCM43430/1
[    7.350199] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43430-sdio for chip BCM43430/1
[    7.363651] brcmfmac mmc1:0001:1: Direct firmware load for brcm/brcmfmac43430-sdio.clm_blob failed with error -2
[    7.378675] brcmfmac mmc1:0001:1: Falling back to user helper
[    7.409063] firmware brcm!brcmfmac43430-sdio.clm_blob: firmware_loading_store: map pages failed
[    7.426381] brcmfmac: brcmf_c_process_clm_blob: no clm_blob available (err=-11), device may have limited channels available
[    7.449007] brcmfmac: brcmf_c_preinit_dcmds: Firmware: BCM43430/1 wl0: Oct 23 2017 03:55:53 version 7.45.98.38 (r674442 CY) FWID 01-e58d219f
[    7.522293] usbcore: registered new interface driver brcmfmac
[   17.650538] ieee80211 phy0: brcmf_link_down: WLC_DISASSOC failed (-52)
[   19.146820] ieee80211 phy0: brcmf_link_down: WLC_DISASSOC failed (-52)
[   20.698133] ieee80211 phy0: brcmf_link_down: WLC_DISASSOC failed (-52)
[   31.842257] ieee80211 phy0: brcmf_escan_timeout: timer expired
[   32.762086] ieee80211 phy0: brcmf_link_down: WLC_DISASSOC failed (-52)
[   43.362267] ieee80211 phy0: brcmf_escan_timeout: timer expired
[   44.235513] ieee80211 phy0: brcmf_link_down: WLC_DISASSOC failed (-52)
[   45.693247] ieee80211 phy0: brcmf_link_down: WLC_DISASSOC failed (-52)
[   47.209139] ieee80211 phy0: brcmf_link_down: WLC_DISASSOC failed (-52)
[   48.652918] ieee80211 phy0: brcmf_link_down: WLC_DISASSOC failed (-52)

Is this a firmware issue? or am i missing something basic here? I checked the MD5 for the firmware bin file and that checks out.
Any help is greatly appreciated.

Thanks

@pmnair, welcome to the community!

This cannot be done with Broadcom WiFi devices on OpenWrt, as there are license issues with the drivers.

See: https://openwrt.org/meta/infobox/broadcom_wifi

In case of the RPi, the wireless situation isn't as dire as for most other Broadcom wireless chipsets. It is using the mainline brcmfmac (cfg80211 based) driver and the public brcmfmac firmware from linux-wireless. I'm not sure about the exact feature set brcmfmac supports, but iw list should anser that question.

2 Likes

Thanks for the response guys! Yes @slh, both raspbian and openwrt in this case are using the brcmfmac driver. I tried adding more debugs in the driver and it looks like the firmware load works the same way on both; so I can pretty much rule that out.

Which "valid interface combinations" did you see with iw list?

here is what I get

        valid interface combinations:
                 * #{ managed } <= 1, #{ P2P-device } <= 1, #{ P2P-client, P2P-GO } <= 1,
                   total <= 3, #channels <= 2
                 * #{ managed } <= 1, #{ AP } <= 1, #{ P2P-client } <= 1, #{ P2P-device } <= 1,
                   total <= 4, #channels <= 1

From iw point of view STA+AP should work ... please note the channel restriction ' channels <= 1' ... use the same channel on both vifs.

1 Like

does the following configuration look alright?

config wifi-device 'radio0'
        option type 'mac80211'
        option channel '11'
        option hwmode '11g'
        option path 'platform/soc/20300000.mmc/mmc_host/mmc1/mmc1:0001/mmc1:0001:1'
        option htmode 'HT20'
        option disabled '0'

config wifi-iface
        option device 'radio0'
        option network 'lan'
        option mode 'ap'
        option ssid 'OpenWrt'
        option encryption 'none'
        option ifname 'ap0'
        option disabled '0'

config wifi-iface
        option device 'radio0'
        option network 'wlan'
        option mode 'sta'
        option ssid 'MyWifiAp'
        option encryption 'psk2'
        option key 'abcd1234'
        option ifname 'wlan0'
        option disabled '0'

First of all, please use the "preformatted text" feature of the online editor, whenever you post any configs for better readability - thanks.
In 'wifi-device' section I would change channel to 'auto' and remove the 'disabled' option. 'wifi-iface' section for ap looks OK (maybe you should enable psk2 encryption anyway), same goes to 'sta' section ... only ...

looks unusual. Is this network 'wlan' really configured as WAN network? Please post also your network and firewall configuration. In general I would test 'sta' and 'ap' separately ... start with the 'sta' stuff, if the uplink connection works OK, add the 'ap' and check if the WLAN comes up.

Will do! :slight_smile:

Ok, will set channel to auto, the disabled option was for me to control them separately from a script.

ap encryption is for test purpose right now, will change it once everything is set

Yes I have wlan configured similar to lan and I think it is configured properly; I have tested them separately and they work fine. Anyhow, following are the configurations

/etc/config/network

config interface 'loopback'
        option ifname 'lo'
        option proto 'static'
        option ipaddr '127.0.0.1'
        option netmask '255.0.0.0'

config globals 'globals'
        option ula_prefix 'fd01:12fa:71d6::/48'

config interface 'lan'
        option ifname 'ap0'
        option proto 'static'
        option ipaddr '192.168.10.1'
        option netmask '255.255.255.0'
        option hostname 'openwrtpi'

config interface 'wlan'
        option ifname 'wlan0'
        option proto 'dhcp'
        option hostname 'openwrtpi'

/etc/config/firewall

config defaults
        option syn_flood        1
        option input            ACCEPT
        option output           ACCEPT
        option forward          REJECT
# Uncomment this line to disable ipv6 rules
#       option disable_ipv6     1

config zone
        option name             lan
        list   network          'lan'
        list   network          'wlan'
        option input            ACCEPT
        option output           ACCEPT
        option forward          ACCEPT

config zone
        option name             wan
        list   network          'wan'
        option input            REJECT
        option output           ACCEPT
        option forward          REJECT
        option masq             1
        option mtu_fix          1

config forwarding
        option src              lan
        option dest             wan
...

do these look ok?

No, your firewall config looks wrong to me. Please remove list network 'wlan' from your lan zone and add it to your wan zone. Restart your firewall config afterwards (/etc/init.d/firewall restart).

Good luck!

Why is that a problem if I want to configure the routing for 'wlan' similar to 'lan'?
Also, I tried your suggestion and that does not seem to solve the issue. Also, I get the following warnings in the output when I restart the firewall; anything to be worried about?

Warning: Unable to locate ipset utility, disabling ipset support
Warning: Section @zone[1] (wan) cannot resolve device of network 'wan'
Warning: Section @zone[1] (wan) cannot resolve device of network 'wlan'
Warning: Section @zone[1] (wan) has no device, network, subnet or extra options
  • Reset to defaults
  • Log into LuCI and browse to Network > Wireless
  • Join the network in question
  • It should walk you through a semi-wizard to add this SSID to WWAN in Firewall Zone WAN
  • Enable the pre-existing OpenWrt SSID

Did you ever get it working? If so could you publish your configs here? I have a rpi zero working with TWO wifis but would love to get 1 working!

No, did not work for me. I went with multiple WiFi solution.

Good luck!

I've been working on this for a couple days and have not gotten it working. I was wondering if you ever figured it out.
Im just trying to use my pi 0 as a repeater and have a nice web interface that less tech savy people can use :frowning:

No, no luck with Openwrt and Pi0. However, I was able to get it working with both Pi3 & 4 using raspbian.

darn, well thanks for the reply. I'm able to get it working on pi 0 with raspbian, but i think there's a driver issue that prevents it from working with openWRT. Im going to make my own post about it in a bit.

I did find a version of claims to work however it only worked for about five minutes and then completely locked up the zero because it overheated.

Unless you actually rewrite the Broadcom driver I suspect that this at least with the zero is nearly impossible. Using a zero with an ath H9K USB dongle seems like the best option which I’ll be testing this weekend.

Thomas J Munn

Well that's disappointing. Nonetheless I'd be interested to know what configuration you used to get it working with a single radio for even a few minutes.

At this point I just want to know what exactly is wrong and get it working even temporarily.