Configure wifi access point on BeagleBone Black running Buster

I am trying to add the ability for BeagleBone Black to act as a Wi-Fi access point like BeagleBone Black Wireless did. I have been told to use hostapd and have worked on this, but I can’t get it running. (As you’ll see, we are using an older distribution because our custom boards and software for our prototypes are all written with this; it works, and we don’t have time to fight through an upgrade.)

The dongle is a Cudy WU650 Version 1.0 built around the Realtek 8821 chip.
I have it plugged in to the USB A port on the Beagle.
I have the Beagle powered from a 5V supply.
I have the Beagle plugged in to a Windows 10 PC via the miniUSB port and use PuTTY and/or Cloud9.

Here’s the output of version.sh

git:/opt/scripts/:[e4e4854ef8ff9ada5c85553376043ee7679167ca]
eeprom:[A335BNLT00C02411SBB02285]
model:[TI_AM335x_BeagleBone_Black]
dogtag:[BeagleBoard.org Debian Buster IoT Image 2021-02-15]
bootloader:[eMMC-(default)]:[/dev/mmcblk1]:[U-Boot SPL 2019.04-00002-gc9b3922522 (Aug 24 2020 - 16:42:18 -0500)]:[location: dd MBR]
bootloader:[eMMC-(default)]:[/dev/mmcblk1]:[U-Boot 2019.04-00002-gc9b3922522]:[location: dd MBR]
UBOOT: Booted Device-Tree:[am335x-boneblack-uboot-univ.dts]
UBOOT: Loaded Overlay:[AM335X-PRU-RPROC-4-19-TI-00A0.kernel]
UBOOT: Loaded Overlay:[BB-ADC-00A0.kernel]
UBOOT: Loaded Overlay:[BB-BONE-eMMC1-01-00A0.kernel]
UBOOT: Loaded Overlay:[BB-I2C2-RTC-DS3231]
kernel:[4.19.94-ti-r68]
nodejs:[v10.23.1]
/boot/uEnv.txt Settings:
uboot_overlay_options:[enable_uboot_overlays=1]
uboot_overlay_options:[uboot_overlay_addr4=/lib/firmware/BB-W1-P9.24-00A0.dtbo]
uboot_overlay_options:[uboot_overlay_addr5=/lib/firmware/BB-I2C2-RTC-DS3231.dtbo]
uboot_overlay_options:[disable_uboot_overlay_video=1]
uboot_overlay_options:[disable_uboot_overlay_audio=1]
uboot_overlay_options:[uboot_overlay_pru=AM335X-PRU-RPROC-4-19-TI-00A0.dtbo]
uboot_overlay_options:[enable_uboot_cape_universal=1]
pkg check: to individually upgrade run: [sudo apt install --only-upgrade <pkg>]
pkg:[bb-cape-overlays]:[4.14.20210809.0-0~buster+20210816]
pkg:[bb-customizations]:[1.20210810.1-0~buster+20210810]
pkg:[bb-usb-gadgets]:[1.20200504.0-0~buster+20200504]
pkg:[bb-wl18xx-firmware]:[1.20200813.1-0~buster+20200813]
pkg:[kmod]:[26-1]
pkg:[librobotcontrol]:[1.0.5-git20200715.0-0~buster+20200716]
pkg:[firmware-ti-connectivity]:[20190717-2rcnee1~buster+20200305]
groups:[debian : debian adm kmem dialout cdrom floppy audio dip video plugdev users systemd-journal input bluetooth netdev i2c gpio admin spi iio docker tisdk weston-launch xenomai cloud9ide pwm eqep remoteproc]
cmdline:[console=ttyO0,115200n8 bone_capemgr.uboot_capemgr_enabled=1 root=/dev/mmcblk1p1 ro rootfstype=ext4 rootwait coherent_pool=1M net.ifnames=0 lpj=1990656 rng_core.default_quality=100 quiet]
dmesg | grep remote
[   72.003254] remoteproc remoteproc0: wkup_m3 is available
[   72.055865] remoteproc remoteproc0: powering up wkup_m3
[   72.055895] remoteproc remoteproc0: Booting fw image am335x-pm-firmware.elf, size 217148
[   72.056175] remoteproc remoteproc0: remote processor wkup_m3 is now up
[   73.687848] remoteproc remoteproc1: 4a334000.pru is available
[   73.696156] remoteproc remoteproc2: 4a338000.pru is available
dmesg | grep pru
[   73.687848] remoteproc remoteproc1: 4a334000.pru is available
[   73.688047] pru-rproc 4a334000.pru: PRU rproc node pru@4a334000 probed successfully
[   73.696156] remoteproc remoteproc2: 4a338000.pru is available
[   73.696338] pru-rproc 4a338000.pru: PRU rproc node pru@4a338000 probed successfully
dmesg | grep pinctrl-single
[    1.027573] pinctrl-single 44e10800.pinmux: 142 pins, size 568
dmesg | grep gpio-of-helper
[    1.041057] gpio-of-helper ocp:cape-universal: ready
lsusb
Bus 001 Device 002: ID 0bda:c811 Realtek Semiconductor Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

The USB dongle is showing up as Bus 001 Device 002 which I take to be USB1.

Following some hostapd instructions I wrote this hostapd.conf file.

interface=usb1
# "a" simply means 5GHz
hw_mode=a
# the channel to use, 0 means the AP will search for the channel with the least interferences (ACS)
channel=0
ieee80211d=1
country_code=US
ieee80211n=1
# 802.11ac support
ieee80211ac=1
wmm_enabled=1

ssid=Test_BBB
auth_algs=1
wpa=2
wpa_key_mgmt=WPA-PSK
rsn_pairwise=CCMP
wpa_passphrase=BeagleBone

when I execute

hostapd hostapd.conf

I get this

root@beaglebone:/etc/hostapd# hostapd hostapd.conf                                                                                                                                                                                                                                                                                    
Configuration file: hostapd.conf
nl80211: Driver does not support authentication/association or connect commands
nl80211: deinit ifname=usb1 disabled_11b_rates=0
nl80211 driver initialization failed.
usb1: interface state UNINITIALIZED->DISABLED
usb1: AP-DISABLED
usb1: CTRL-EVENT-TERMINATING
hostapd_free_hapd_data: Interface usb1 wasn't started

Does this mean that driver nl180211 doesn’t provide access point support?
If so, what driver do I need to have this support and how do I get it?
And if this isn’t the problem, any ideas?

As I said, we cannot take the time to move to a new distribution now, so I’d appreciate suggestions geared for our implementation.

interface=usb1

Check you interfaces again, wlan0 etc…

My other answer, probably to old…

Regards,

https://www.realtek.com/Download/List?cate_id=667&menu_id=297

You are up the river without a paddle on this. Only see a windows driver…

@RobertCNelson Thanks as always for a speedy reply. So by ‘too old’ are you referring to the distribution, dongle or driver or maybe all three?

If distribution, what’s the latest best distribution for the Black? I don’t need a GUI. I tried a Bullseye distribution early on and it was taking too much time to debug but I expect they are much better by now.

Walter

ordered… Amazon.com: Cudy AC 650Mbps USB WiFi Adapter for PC, 5GHz/2.4GHz Wireless Dongle, WiFi Wireless Adapter for Laptop - Nano Size, Compatible with Windows XP / 7/8.x /10/11, Mac OS : Electronics

IDK… asking 4.19.x to work with newer modules is asking a lot…

Regards,

I have ordered a Netgear WNA1100 adaptor, which has been discussed as working in other posts and blogs. I think I got the Cudy because the WNA1100s were nowhere to be found when I tried this before. They seem to be back now. It will be here tomorrow, so hopefully, it will work, and we will be back in business.

(But I know we will be better off with Bullseye at some point. So I’ve picked that back up again and right back where I stopped before. I have Visual Studio up and running, but it won’t compile without a debugger, and I do not know how to get a debugger installed on this thing. I’m going back to the thread I started on this topic last year to keep the issues separate.)

The Netgear N150 (aka WNA1100) arrived and I’ve made a bit of progress I think.

After installing it I get this from

lsusb

root@beaglebone:/etc/hostapd# lsusb
Bus 001 Device 002: ID 0846:9030 NetGear, Inc. WNA1100 Wireless-N 150 [Atheros AR9271]
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

So the Netgear is visible.

My hostapd.conf looks like this now
I had to change hw_mode from ‘a’ to ‘g’ because the Netgear is an older adaptor and doesn’t support 5Ghz (“a”).

interface=wlan0
# "a" simply means 5GHz
hw_mode=g
# the channel to use, 0 means the AP will search for the channel with the least interferences (ACS)
channel=0
ieee80211d=1
country_code=US
ieee80211n=1
# 802.11ac support
ieee80211ac=1
wmm_enabled=1

ssid=Test_BBB
auth_algs=1
wpa=2
wpa_key_mgmt=WPA-PSK
rsn_pairwise=CCMP
wpa_passphrase=BeagleBone

When I run

hostapd hostapd.conf

I got this at first

Configuration file: hostapd.conf
wlan0: interface state UNINITIALIZED->COUNTRY_UPDATE
ACS: Automatic channel selection started, this may take a bit
wlan0: interface state COUNTRY_UPDATE->ACS
wlan0: ACS-STARTED
ACS: Unable to collect survey data
ACS: All study options have failed
Interface initialization failed
wlan0: interface state ACS->DISABLED
wlan0: AP-DISABLED
ACS: Possibly channel configuration is invalid, please report this along with your config file.
ACS: Failed to start
wlan0: AP-DISABLED
hostapd_free_hapd_data: Interface wlan0 wasn't started
nl80211: deinit ifname=wlan0 disabled_11b_rates=0
wlan0: interface state DISABLED->DISABLED
wlan0: interface state DISABLED->DISABLED
wlan0: AP-DISABLED
wlan0: CTRL-EVENT-TERMINATING
hostapd_free_hapd_data: Interface wlan0 wasn't started

Which is encouraging because I see the light on the USB dongle blink a few times and I don’t get the driver error I was getting with the Cudy USB adaptor.

And the system is trying to find the best channel.
I don’t know why it couldn’t find the channel and because that failed it could not enable the AP.

So I chose a channel (we’re a bit isolated here and this is actually ultimately for farms, so I think picking a channel is probably safe.) I set it to 5. Then I ran hostapd again and I the AP came up.

But I can’t seem to login to it and I think it has to do with some security setting.

Any ideas would be appreciated greatly!

Here’s the output from hostapd with the channel set to 5.

root@beaglebone:/etc/hostapd# hostapd hostapd.conf
Configuration file: hostapd.conf
wlan0: interface state UNINITIALIZED->COUNTRY_UPDATE
Using interface wlan0 with hwaddr 30:46:9a:2b:d7:fa and ssid "Test_BBB"
wlan0: interface state COUNTRY_UPDATE->ENABLED
wlan0: AP-ENABLED
wlan0: STA ba:5a:71:de:48:c8 IEEE 802.11: authenticated
HT: Forty MHz Intolerant is set by STA ba:5a:71:de:48:c8 in Association Request
wlan0: STA ba:5a:71:de:48:c8 IEEE 802.11: associated (aid 1)
wlan0: AP-STA-CONNECTED ba:5a:71:de:48:c8
wlan0: STA ba:5a:71:de:48:c8 RADIUS: starting accounting session 8B2B28FF8E049C43
wlan0: STA ba:5a:71:de:48:c8 WPA: pairwise key handshake completed (RSN)
wlan0: AP-STA-DISCONNECTED ba:5a:71:de:48:c8
wlan0: STA ba:5a:71:de:48:c8 IEEE 802.11: disassociated
wlan0: STA ba:5a:71:de:48:c8 IEEE 802.11: authenticated
HT: Forty MHz Intolerant is set by STA ba:5a:71:de:48:c8 in Association Request
wlan0: STA ba:5a:71:de:48:c8 IEEE 802.11: associated (aid 1)
wlan0: AP-STA-CONNECTED ba:5a:71:de:48:c8
wlan0: STA ba:5a:71:de:48:c8 RADIUS: starting accounting session 8B2B28FF8E049C43
wlan0: STA ba:5a:71:de:48:c8 WPA: pairwise key handshake completed (RSN)
wlan0: AP-STA-DISCONNECTED ba:5a:71:de:48:c8
wlan0: STA ba:5a:71:de:48:c8 IEEE 802.11: disassociated
wlan0: STA ba:5a:71:de:48:c8 IEEE 802.11: authenticated
HT: Forty MHz Intolerant is set by STA ba:5a:71:de:48:c8 in Association Request
wlan0: STA ba:5a:71:de:48:c8 IEEE 802.11: associated (aid 1)
wlan0: AP-STA-CONNECTED ba:5a:71:de:48:c8
wlan0: STA ba:5a:71:de:48:c8 RADIUS: starting accounting session 8B2B28FF8E049C43
wlan0: STA ba:5a:71:de:48:c8 WPA: pairwise key handshake completed (RSN)
wlan0: AP-STA-DISCONNECTED ba:5a:71:de:48:c8
wlan0: STA ba:5a:71:de:48:c8 IEEE 802.11: disassociated
wlan0: STA ba:5a:71:de:48:c8 IEEE 802.11: authenticated
HT: Forty MHz Intolerant is set by STA ba:5a:71:de:48:c8 in Association Request
wlan0: STA ba:5a:71:de:48:c8 IEEE 802.11: associated (aid 1)
wlan0: AP-STA-CONNECTED ba:5a:71:de:48:c8
wlan0: STA ba:5a:71:de:48:c8 RADIUS: starting accounting session 8B2B28FF8E049C43
wlan0: STA ba:5a:71:de:48:c8 WPA: pairwise key handshake completed (RSN)
wlan0: AP-STA-DISCONNECTED ba:5a:71:de:48:c8
wlan0: STA ba:5a:71:de:48:c8 IEEE 802.11: disassociated
wlan0: STA ba:5a:71:de:48:c8 IEEE 802.11: authenticated
HT: Forty MHz Intolerant is set by STA ba:5a:71:de:48:c8 in Association Request
wlan0: STA ba:5a:71:de:48:c8 IEEE 802.11: associated (aid 1)
wlan0: AP-STA-CONNECTED ba:5a:71:de:48:c8
wlan0: STA ba:5a:71:de:48:c8 RADIUS: starting accounting session 8B2B28FF8E049C43
wlan0: STA ba:5a:71:de:48:c8 WPA: pairwise key handshake completed (RSN)

I am used X’s GROK AI to get this running and want to share the information here for anyone else who might be struggling with this. Please forgive me for not formatting everything properly. I"m just pasting the output from Grok. I believe the primary issue was a conflict with wpa_supplicant trying to take control of the USB dongle and not using a dongle that was compatible with the driver distributed with Buster. Once those were solved, it was fairly straightforward and I have now done this on four BeagleBone Black units.

These instructions were provided by working with X.com’s GROK AI.

I’m glad to hear this configuration works for you! It ensures reliable USB (usb0, 192.168.7.2) and WiFi (“BBB__Dev1” on wlan0, 192.168.1.1) access to the BeagleBone Black, with local access to Cloud9 and internet via USB through Windows 10’s ICS. Since you’ve confirmed it meets your needs, let’s finalize by providing clear, replicable instructions for setting up other BeagleBone devices with this exact configuration. I’ll keep this short and focused.

To be able to get to the internet and do the apt update, you have to use the usb cable, set up wifi sharing and the address of the ethernet is 192.168.7.1 (the gateway address).

Then, on the Beagle execute

sudo /sbin/route add default gw 192.168.7.1

Then ping 8.8.8.8
If this works, then you need to edit /etc/resolv.conf to add nameserver entries.
NOTE there is no ‘e’ in resolv.conf!!!

The entries needed are

nameserver 8.8.8.8
nameserver 8.8.8.4

You can confirm this works with this.

ping debian.org

IF THIS DOESN’T work, remove sharing on the wifi network on the PC and set it up again. Sometimes this triggers the interfaces to reset.

Also, although not in the instructions below, it’s probably wise to update hostapd.

sudo apt update
sudo apt install hostapd
sudo apt install iptables-persistent
Accept the default to save current iptables rules during installation.

!!! Restart the BeagleBone Black after doing these installs

Replicable Instructions for Other BeagleBone Devices
These steps assume a fresh BeagleBone Black running Debian Buster IoT (2021-02-15 or similar), with mini-USB connected to a Windows 10 machine for internet via ICS. Follow these steps to replicate the “BBB__Dev1” WiFi access point and USB networking setup:
1. Initial Setup:
○ Connect the BeagleBone to a Windows 10 machine via mini-USB.
○ Install PuTTY on Windows and connect to 192.168.7.2 with username debian and password temppwd.
○ Update and install iptables-persistent for NAT rule persistence:
○ (SHOULD HAVE ALREADY BEEN DONE ABOVE)
bash

sudo apt update
sudo apt install iptables-persistent
○ Accept the default to save current iptables rules during installation.
2. Configure Network Interfaces:
○ Edit /etc/network/interfaces:
bash

sudo nano /etc/network/interfaces
○ Add or modify:

auto lo
iface lo inet loopback

auto wlan0
iface wlan0 inet static
address 192.168.1.1
netmask 255.255.255.0

auto usb0
iface usb0 inet static
address 192.168.7.2/24
netmask 255.255.255.0
gateway 192.168.7.1
dns-nameservers 8.8.8.8 8.8.4.4
○ Save and exit (Ctrl+O, Enter, Ctrl+X).
3. Set Up “BBB__Dev1” WiFi Access Point:
○ Configure hostapd for “BBB__Dev1”:
Bash
○ PLUG IN THE USB WIFI DONGLE!!
sudo nano /etc/hostapd/hostapd.conf
○ Add or modify:

interface=wlan0
ssid=BBB__Dev1
wpa_passphrase=BeagleBone
hw_mode=g
channel=1
auth_algs=1
wpa=2
wpa_key_mgmt=WPA-PSK
rsn_pairwise=CCMP
○ Save and exit.
○ Enable and start hostapd:
bash

sudo systemctl enable hostapd
sudo systemctl start hostapd
4. Configure DHCP for “BBB__Dev1”:
○ Edit dnsmasq configuration:
bash

sudo nano /etc/dnsmasq.conf
○ Add or modify:

interface=wlan0
dhcp-range=192.168.1.2,192.168.1.100,12h
○ Save and exit.
○ Enable and start dnsmasq:
bash

sudo systemctl enable dnsmasq
sudo systemctl start dnsmasq
5. Disable wpa_supplicant to Avoid Conflicts:
○ Ensure wpa_supplicant is stopped and disabled:
bash

sudo systemctl stop wpa_supplicant
sudo systemctl disable wpa_supplicant
6. Set Up NAT and Forwarding Rules:
○ Apply NAT rules for internet routing via USB:
bash

sudo iptables-legacy -A FORWARD -i wlan0 -o usb0 -j ACCEPT
sudo iptables-legacy -A FORWARD -i usb0 -o wlan0 -m state --state RELATED,ESTABLISHED -j ACCEPT
sudo iptables-legacy -t nat -A POSTROUTING -o usb0 -j MASQUERADE
○ Save rules for persistence:
bash

sudo iptables-legacy-save > /etc/iptables/rules.v4
7. Test and Reboot:
○ Reboot the BeagleBone:
bash

sudo reboot
○ After reboot, reconnect via PuTTY to 192.168.7.2.
○ Verify wlan0 (192.168.1.1) and usb0 (192.168.7.2) IPs:
bash

ip addr
○ Verify hostapd and dnsmasq are running:
bash

sudo systemctl status hostapd
sudo systemctl status dnsmasq
○ Test “BBB__Dev1” WiFi on devices:
§ Connect Windows 10 and iPad to “BBB__Dev1” (password: “BeagleBone”).
§ Check IPs (e.g., 192.168.1.x), ping 192.168.1.1, and access Cloud9 at http://192.168.1.1:3000.
These instructions assume:
• Windows 10 is configured for Internet Connection Sharing (ICS) on the USB adapter (192.168.7.1).
• The BeagleBone uses its default WiFi hardware (wlan0).
• No second WiFi dongle is needed for internet, as WiFi provides local access only, with internet via USB.
Let me know if you need adjustments, want to add WiFi internet (requiring a dongle), or have questions about replicating this setup!