Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable AMPAK AP6330 WiFi and Bluetooth #429

Merged
merged 1 commit into from
Dec 12, 2024

Conversation

leon-anavi
Copy link

Enable AMPAK AP6330 that combines Broadcom Wifi (BCM4330) and Bluetooth 4.0 (BCM40183) chips for sun9i devices such as Merrii A80 Optimus and Cubieboard 4.

QA

Tested with an open 2.4GHz WiFi network on Merrii A80 Optimus board here are the results:

  • The dmesg log:
[   12.792755] mmc1: new high speed SDIO card at address 0001
[   13.487738] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac4330-sdio for chip BCM4330/4
[   13.620672] brcmfmac mmc1:0001:1: Direct firmware load for brcm/brcmfmac4330-sdio.clm_blob failed with error -2
[   13.990582] brcmfmac: brcmf_c_process_clm_blob: no clm_blob available (err=-2), device may have limited channels available
[   14.001703] brcmfmac: brcmf_c_process_txcap_blob: no txcap_blob available (err=-2)
[   14.009958] brcmfmac: brcmf_c_preinit_dcmds: Firmware: BCM4330/4 wl0: Jan 23 2013 17:46:35 version 5.90.195.114 FWID 01-cafa6b3e

Note: brcmfmac4330-sdio.clm_blob isn't available but this error isn't fatal.

  • Available wlan0 (before connecting to a network):
root@merrii-a80-optimus:~# ip link ls
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
2: end0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq qlen 1000
    link/ether 02:2c:e4:2d:b4:fd brd ff:ff:ff:ff:ff:ff
3: wlan0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop qlen 1000
    link/ether 6c:fa:a7:84:1f:48 brd ff:ff:ff:ff:ff:ff
  • Log from journalctl -f -u [email protected] after connecting to an open 2.4GHz WiFi network:
Nov 14 18:25:47 merrii-a80-optimus wpa_supplicant[588]: wlan0: Trying to associate with SSID 'Leon-P9'
Nov 14 18:25:47 merrii-a80-optimus wpa_supplicant[588]: wlan0: Associated with a2:8c:b0:e9:a4:8c
Nov 14 18:25:47 merrii-a80-optimus wpa_supplicant[588]: wlan0: CTRL-EVENT-CONNECTED - Connection to a2:8c:b0:e9:a4:8c completed [id=0 id_str=]
Nov 14 18:25:47 merrii-a80-optimus wpa_supplicant[588]: wlan0: CTRL-EVENT-SUBNET-STATUS-UPDATE status=0
Nov 14 18:25:47 merrii-a80-optimus wpa_supplicant[588]: wlan0: CTRL-EVENT-REGDOM-CHANGE init=COUNTRY_IE type=COUNTRY alpha2=BG
  • The assigned IP for wlan0:
root@merrii-a80-optimus:~# ip a
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: end0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq qlen 1000
    link/ether 02:2c:e4:2d:b4:fd brd ff:ff:ff:ff:ff:ff
3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000
    link/ether 6c:fa:a7:84:1f:48 brd ff:ff:ff:ff:ff:ff
    inet 192.168.143.248/24 brd 192.168.143.255 scope global dynamic wlan0
       valid_lft 3364sec preferred_lft 3364sec
  • Test:
root@merrii-a80-optimus:~# ping -c 4 example.com
PING example.com (93.184.215.14): 56 data bytes
64 bytes from 93.184.215.14: seq=0 ttl=51 time=168.224 ms
64 bytes from 93.184.215.14: seq=1 ttl=51 time=241.396 ms
64 bytes from 93.184.215.14: seq=2 ttl=51 time=214.439 ms
64 bytes from 93.184.215.14: seq=3 ttl=51 time=288.157 ms

--- example.com ping statistics ---
4 packets transmitted, 4 packets received, 0% packet loss
round-trip min/avg/max = 168.224/228.054/288.157 ms

Configuration

Follow the steps below to configure the WiFi:

  • Built an image with wpa-supplicant, for example in conf/local.conf:
IMAGE_INSTALL:append = " wpa-supplicant"
  • create directory /etc/wpa_supplicant/

  • Create /etc/wpa_supplicant/wpa_supplicant-wlan0.conf with the following content:

ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=0
update_config=1
country=BG

network={
  ssid="Leon-P9"
  key_mgmt=NONE
  scan_ssid=1
}

Note: replace the ssid with whatever you are using.

  • Create /etc/systemd/network/70-wlan.network with the following content:
[Match]
Name=wlan0

[Network]
DHCP=ipv4

After creating these two files restart the networking systemd services:

systemctl restart systemd-networkd.service
systemctl restart [email protected]

Enable AMPAK AP6330 that combines Broadcom Wifi (BCM4330) and
Bluetooth 4.0 (BCM40183) chips for sun9i devices such as Merrii A80
Optimus and Cubieboard 4.

Signed-off-by: Leon Anavi <[email protected]>
@nandra
Copy link
Collaborator

nandra commented Dec 12, 2024

👍 Thanks!

@nandra nandra merged commit f2f4c6a into linux-sunxi:master Dec 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants