balena-os / balena-radxa

https://www.balena.io/os/
Apache License 2.0
14 stars 14 forks source link

WiFi does not work on RockPi 4B+ #28

Closed shawaj closed 2 years ago

shawaj commented 2 years ago

We have three test devices running. WiFi does not work on either.

One does not have a wlan0 interface showing at all.

One has the interface showing, but in nmcli it says:

wlan0: unavailable
        "wlan0"
        wifi (bcmsdh_sdmmc), 20:50:E7:1A:40:AF, hw, mtu 1500

The third seems to have working WiFi:

wlan0: disconnected
        "wlan0"
        1 connection available
        wifi (bcmsdh_sdmmc), B0:02:47:93:8A:F1, hw, mtu 1500

There is no apparent reason why it works on one but not the others?

floion commented 2 years ago

Hi, what is the hw revision of these 3 boards? Do they all have the same revision?

shawaj commented 2 years ago

@floion when you say hardware revision - is there a particular place you would like me to get this info from?

There appears to be an issue with bluetooth as well as wifi on the affected devices.

some more info in this thread also: https://github.com/NebraLtd/hm-config/issues/156

shawaj commented 2 years ago

Also @floion can enable support access to the fleet / devices in question if you want to have a poke around?

floion commented 2 years ago

@floion when you say hardware revision - is there a particular place you would like me to get this info from?

What is printed on the PCB should be enough

floion commented 2 years ago

Also @floion can enable support access to the fleet / devices in question if you want to have a poke around?

Yes please

shawaj commented 2 years ago

@floion this is the fleet where I've enabled support access https://dashboard.balena-cloud.com/fleets/1884658

The device version is 1.72 and it has an Ampak AP6212 chipset for BT /WiFi which I believe is a Broadcom 43430 chipset. This is the device: https://dashboard.balena-cloud.com/devices/963415259c442625fc5f5ac241f48578/summary

This one is the same, but I think it's using an underpowered power supply potentially (awaiting confirmation from @vpetersson ) https://dashboard.balena-cloud.com/devices/abbd40dba563c6cef3ae9647a074f196/summary

20211203_194447

shawaj commented 2 years ago

@floion this one that is working is a v1.6 with Ampak AP6256 chipset. AP6256 chipset uses Broadcom BCM43456 https://dashboard.balena-cloud.com/devices/79966c99632cdf13cedb3831e8d83c53/summary

20211203_204043

shawaj commented 2 years ago

AP6212_V1.1_09022014 (1).pdf AP6256 datasheet_V1.3_12202017.pdf

shawaj commented 2 years ago

I spoke to RockPi and they have said they will also use the Azurewave AW-NB197SM which is based on the Cypress / Broadcom 43438 and the Ampak AP6212A which is the same.

1x1_bgn_sdio_aw-nb197sm_cyw43438.pdf ap6212_datasheet_v1.0_04082014.pdf

So looks like the 4 chipsets we need to have support for are: BCM43438 CYW43438 BCM43430 BCM43456

shawaj commented 2 years ago

Was going to do a PR here:

https://github.com/balena-os/balena-rockpi/blob/e098a347646c45b4e91a1507a6f6695fc1f593b8/layers/meta-balena-rockpi/recipes-connectivity/bluetooth/files/broadcom-bluetooth/update-brcm-btfw-load-service.sh#L35-L49

However, it appears both AP6212 and AP6212A use the same vendor and device IDs even though they are different chipsets.

AP6212

root@9634152:~# cat /sys/bus/sdio/devices/mmc2:0001:1/vendor
0x02d0
root@9634152:~# cat /sys/bus/sdio/devices/mmc2:0001:1/device
0xa9a6

AP6212A

root@9634152:~# cat /sys/bus/sdio/devices/mmc2:0001:1/vendor
0x02d0
root@9634152:~# cat /sys/bus/sdio/devices/mmc2:0001:1/device
0xa9a6

Chipsets

    {"4343A0","bcm43438a0"},    //AP6212
    {"BCM43430A1","bcm43438a1"}, //AP6212A

Also - weirdly I noticed that on a device with AP6212 it had vendor 02d0 and device a9a6 but still loaded the BCM4345C5.hcd firmware instead of BCM4343B0.hcd

root@9634152:~# cat /sys/bus/sdio/devices/mmc2:0001:1/vendor
0x02d0
root@9634152:~# cat /sys/bus/sdio/devices/mmc2:0001:1/device
0xa9a6
root@9634152:~# cat /lib/systemd/system/brcm-btfw-load.service
[Unit]
Description=Load Broadcom Bluetooth firmware
#Requires=display-manager.service
After=display-manager.service
[Service]
#Type=dbus
#blkusName=org.bluez
#ExecStartPre=/usr/sbin/rfkill block bluetooth
ExecStartPre=/usr/sbin/rfkill unblock bluetooth
ExecStart=/usr/bin/brcm_patchram_plus --enable_hci --no2bytes --use_baudrate_for_download --tosleep 200000 --baudrate 1500000 --patchram /system/etc/firmware/BCM4345C5.hcd /dev/ttyS0 > /dev/null 2>&1 &
ExecStop=/usr/bin/killall brcm_patchram_plus
Restart=on-failure
RestartSec=2
StandardOutput=null
[Install]
WantedBy=multi-user.target

Some other info

Non working (possibly with power issue)

root@abbd40d:~# dmesg | grep brcm
[   22.230469] brcmfmac: brcmf_sdio_drivestrengthinit: No SDIO Drive strength init done for chip 43430 rev 1 pmurev 24
[   22.233958] usbcore: registered new interface driver brcmfmac
[   22.234924] brcmfmac_sdio mmc2:0001:1: Direct firmware load for brcm/brcmfmac43430-sdio.bin failed with error -2
[   23.241533] brcmfmac: brcmf_sdio_htclk: HT Avail timeout (1000000): clkctl 0x50
[   24.253415] brcmfmac: brcmf_sdio_htclk: HT Avail timeout (1000000): clkctl 0x50
root@abbd40d:~# rfkill list
0: bt_default: Bluetooth
        Soft blocked: no
        Hard blocked: no

Non working but no power issue

root@9634152:~# dmesg | grep brcm
[   19.527949] usbcore: registered new interface driver brcmfmac
root@9634152:~# rfkill list
0: bt_default: Bluetooth
        Soft blocked: no
        Hard blocked: no
1: phy0: Wireless LAN
        Soft blocked: no
        Hard blocked: no
2: brcmfmac-wifi: Wireless LAN
        Soft blocked: no
        Hard blocked: no

Working

root@79966c9:~# dmesg | grep brcm
root@79966c9:~# rfkill list
0: bt_default: Bluetooth
        Soft blocked: no
        Hard blocked: no
1: phy0: Wireless LAN
        Soft blocked: no
        Hard blocked: no
2: brcmfmac-wifi: Wireless LAN
        Soft blocked: no
        Hard blocked: no
3: hci0: Bluetooth
        Soft blocked: no
        Hard blocked: no

Seems this has all but the AP6212 https://github.com/rockchip-linux/rkwifibt/tree/master/firmware/broadcom

floion commented 2 years ago

Will have a look. I only have 1.6 with me so I'll look into your machine and see what's it about.

floion commented 2 years ago

Hi, so https://dashboard.balena-cloud.com/devices/963415259c442625fc5f5ac241f48578/summary has an AP6212, right?

Can you also enable support access for a board which has an AP6212A?

floion commented 2 years ago

And also please renew the support access on the other machine so that's it's available for longer to debug.

floion commented 2 years ago

You can also add some tags in the dashboard to these machines with the wifi chipsets they have.

floion commented 2 years ago

@shawaj reping on the above please.

shawaj commented 2 years ago

@floion sorry only just saw this

AP6212 are calm-meadow and large-waterfall AP6256 is divine-zombie We don't currently have any units with AP6212A or AW-NB197SM because these will be newer versions (to account for chip shortages etc)

FYI - https://forum.radxa.com/t/rock-pi-4b-wifi-bt-not-working-properly/8017/4

shawaj commented 2 years ago

@floion have re-enabled or extended support access on all the devices

joehounsham commented 2 years ago

@floion Do you have access to the devices Aaron is sharing above? Probably best if you can share the UUID's in the future Aaron.

floion commented 2 years ago

Yes I do. Did my job on them and will release a new OS version soon

floion commented 2 years ago

@shawaj until upstream approves my PR on dunfell, I created https://github.com/balena-os/balena-rockpi/pull/31 in our repo here so we are not blocked by them

shawaj commented 2 years ago

@floion oh amazing, thanks very much 👍

I have pinged our contract at Radxa directly as well to try and bump them on that too 🙂

shawaj commented 2 years ago

@floion Do you have access to the devices Aaron is sharing above? Probably best if you can share the UUID's in the future Aaron.

Think the UUID is part of the URL slug so thought that might be easier. But sure can share just UUID in future.

floion commented 2 years ago

Hi @shawaj this should be fixed in 2021.10.5. Can you update the OS on that machine and check it out please?

vpetersson commented 2 years ago

I just upgraded one of my affected devices and I can confirm that both Bluetooth and WiFi now works. Well...at least being detected.

shawaj commented 2 years ago

@floion working nicely for me. nmcli dev wifi list returns wifi networks. I will check the bluetooth connection over the weekend (however, it is certainly appearing in Linux now which is a good sign!)

Thanks for your efforts on this :-)

floion commented 2 years ago

@vpetersson it gets detected but it's not usable you mean?

vpetersson commented 2 years ago

TBD. There's a bug but we don't exactly know if it's a bug in driver or in our stack.

floion commented 2 years ago

Hi all, based on the above confirmation from Aaron, I will close this item.