Wifi Connect on Raspberry Pi 3 Compute module with Redpine RS9113 Wifi Module

I’m trying to use Wifi Connect for the first time. I’ve got a Raspberry Pi 3 Compute Module with a Redpine RS9113 Wifi Module. I don’t know of it’s one of the supported boards and trying to get things working.

  1. I’ve got Wifi-connect installed and running on a balenaOS multicontainer app

  2. Checking system settings (from Balena Host OS)

# systemctl status NetworkManager
Warning: The unit file, source configuration file or drop-ins of NetworkManager.service changed on disk. Run 'systemctl daemon-reload' to reload units.
● NetworkManager.service - Network Manager
   Loaded: loaded (/lib/systemd/system/NetworkManager.service; enabled; vendor preset: enabled)
  Drop-In: /etc/systemd/system/NetworkManager.service.d
           └─NetworkManager.conf
   Active: active (running) since Tue 2020-02-25 21:39:54 UTC; 1 months 23 days ago
     Docs: man:NetworkManager(8)
 Main PID: 745 (NetworkManager)
    Tasks: 3 (limit: 2215)
   Memory: 9.7M
   CGroup: /system.slice/NetworkManager.service
           └─745 /usr/sbin/NetworkManager --no-daemon

Feb 25 21:40:11 a705845 NetworkManager[745]: <info>  [1582666811.0487] device (wifi0): state change: ip-check -> secondaries (reason 'none', sys-iface-state: 'managed')
Feb 25 21:40:11 a705845 NetworkManager[745]: <info>  [1582666811.0503] device (wifi0): state change: secondaries -> activated (reason 'none', sys-iface-state: 'managed')
Feb 25 21:40:11 a705845 NetworkManager[745]: <info>  [1582666811.0535] manager: NetworkManager state is now CONNECTED_LOCAL
Feb 25 21:40:11 a705845 NetworkManager[745]: <info>  [1582666811.0649] manager: NetworkManager state is now CONNECTED_SITE
Feb 25 21:40:11 a705845 NetworkManager[745]: <info>  [1582666811.0704] policy: set 'resin-wifi-01' (wifi0) as default for IPv4 routing and DNS
Feb 25 21:40:11 a705845 NetworkManager[745]: <info>  [1582666811.0779] dns-mgr: Writing DNS information to /sbin/resolvconf
Feb 25 21:40:11 a705845 NetworkManager[745]: <info>  [1582666811.1777] device (wifi0): Activation: successful, device activated.
Feb 25 21:40:13 a705845 NetworkManager[745]: <info>  [1582666813.8764] manager: NetworkManager state is now CONNECTED_GLOBAL
Feb 25 21:40:17 a705845 NetworkManager[745]: <info>  [1582666817.3783] manager: (resin-vpn): new Tun device (/org/freedesktop/NetworkManager/Devices/8)
Apr 19 22:44:58 a705845 NetworkManager[745]: <info>  [1587336298.4805] bluez: use BlueZ version 5
# nmcli d 
DEVICE           TYPE      STATE        CONNECTION    
wifi0            wifi      connected    resin-wifi-01 
supervisor0      bridge    connected    supervisor0   
rpine0           ethernet  unavailable  --            
balena0          bridge    unmanaged    --            
br-d0b1d9af1186  bridge    unmanaged    --            
resin-dns        bridge    unmanaged    --            
lo               loopback  unmanaged    --            
resin-vpn        tun       unmanaged    --  
  1. Tried with ./wifi-connect -i wifi0 -s "NickConnect" -p "testpass" (as part of start.sh), while NickHotspot not up and RPi not connected. Didn’t see the network pop up.

  2. Tried with ./wifi-connect -i wifi0 -s "NickConnect" -p "testpass" (from console), while connected to NickHotspot, got:

Targeted WiFi device: wifi0
Access points: ["NickHotspot", "DIRECT-4i-BRAVIA", "Tintin", "Arenas", "WIFIDDF16F", "tl6531a0-EXT", "", "Tintin-5G"]
Starting access point...
SSH session disconnected
SSH reconnecting...
Spawning shell...
  1. Checked dmesg
# Dmesg output
[ 1607.898247] IPv6: ADDRCONF(NETDEV_UP): wifi0: link is not ready
[ 1607.955485] down interface wifi0
[ 1607.985486] IPv6: ADDRCONF(NETDEV_UP): wifi0: link is not ready
[ 1609.593209] In ieee80211_ioctl_set80211 3833 : returnin EOPNOTSUPP
[ 1609.598055] Failed to set Operation mode obm_cfg_start_ap Line 1033
[ 1609.599340] In ieee80211_ioctl_set80211 3833 : returnin EOPNOTSUPP
[ 1634.049666] IPv6: ADDRCONF(NETDEV_UP): wifi0: link is not ready
[ 1634.062911] down interface wifi0
[ 1634.100800] IPv6: ADDRCONF(NETDEV_UP): wifi0: link is not ready
[ 1635.606108] onebox_ioctl: 1003 Error: WLAN firmware is not active
[ 1635.748122] VAP = NULL
[ 1635.859532] onebox_cfg80211_connect:[42:c7:f1:be:15:ec] 
[ 1636.076763] onebox_disconnect 
[ 1636.076958] wlan_remove: Below are WLAN STATS: 
[ 1636.076972] total beacon send : 0
[ 1636.076982] total beacon Interrupts Received : 0
[ 1636.076992] total_mgmt_pkt_send : 208
[ 1636.077002] total_mgmt_rx       : 3794
[ 1636.077013] total_onair_mgmt       : 0
[ 1636.077023] total_data_rx       : 1144
[ 1636.077032] BUFFER FULL COUNTER  : 0
[ 1636.077042] BUFFER SEMI FULL COUNTER  : 0
[ 1636.077051] MGMT BUFFER FULL COUNTER  : 0
[ 1636.078565] down interface wifi0
[ 1636.345195] onebox_disconnect:Below are the sdio stats 
[ 1636.345236] total sdio Interrupts recvd : 4786
[ 1636.345248] total sdio Interrupts with zero status recvd : 4786
[ 1636.345258] total sdio buffer Interrupts recvd : 2
[ 1636.345269] total data pending Interrupts recvd : 4910
[ 1636.345279] total sdio Unkown Interrupts recvd : 0
[ 1636.345318] onebox_sdio_master_access_msword: fail to access MASTER_ACCESS_MSBYTE
[ 1636.345328] reset_chip: Unable to set ms word to common reg
[ 1636.495108] onebox_reset_card: CMD0 failed : -123 
[ 1636.495525] mmc1: card fffd removed
[ 1636.551847] mmc1: new high speed SDIO card at address fffd
[ 1636.565470] will be ignored
[ 1636.678101] MAC Address     : 88 da 1a 82 e8 5c
[ 1636.678154] MFG SW Version  : 4.3
[ 1636.678154] Bootloader Ver  : 18
[ 1636.678154] Onboard Antenna : 1
[ 1636.678154] Module Type     : 0 Non-HPM
[ 1636.678154] Band Support    : Dual Band
[ 1636.678154] Country domain  : 0
[ 1638.034554] core_net80211_attach: macaddr 88:da:1a:82:e8:5c
[ 1638.035574] [onebox_update_country][1722] : Updating Country to 00 from WR!!!
[ 1638.129461] created vap: wifi0
[ 1638.228294] IPv6: ADDRCONF(NETDEV_UP): wifi0: link is not ready
[ 1638.232510] Disabling power save
[ 1638.243690] down interface wifi0
[ 1638.460339] IPv6: ADDRCONF(NETDEV_UP): wifi0: link is not ready
[ 1640.034584] onebox_cfg80211_connect:[42:c7:f1:be:15:ec] 
[ 1640.091092] IPv6: ADDRCONF(NETDEV_CHANGE): wifi0: link becomes ready

Any other debugging info I could provide? Trying to figure out next steps.

Hi, I see that when you run WiFi Connect from the terminal you are connected to the device over the same WiFi chip and that causes a terminal disconnect. Can you please retry by connecting to the device through Ethernet instead?
Thanks,
Zahari

Sadly I can’t – I only have a wifi chip connected to the compute module, and there’s no ethernet access.

I don’t expect running WiFi connect from the terminal to work, but it’s helped debug a bit. I know that the RS9113 chip supports AP mode, and I’m trying to find other ways to debug. IPv6: ADDRCONF(NETDEV_UP): wifi0: link is not ready (even after delaying 120 seconds in the start script) is the thing I’m stuck on.

The IPv6 log entry is just a warning coming from the kernel that occurs for all interfaces and cannot be related.

Do you have a way to plug-in a second WiFi dongle on a USB bus or USB-to-Ethernet adapter? Also are you connected to the CM3 from your development computer in some other way - either with a keyboard/monitor, or through a serial cable?

I do not. The only connection I have is through that Redpine chip, so I’ve been adding logging to start.sh.

Here’s the output on start from iwconfig and ifconfig while connected as a client to my hotspot and when trying to become the Access Point (hotspot turned off):

# As Client
## iwconfig
wifi0     IEEE 802.11bgn  ESSID:"NickHotspot"  
          Mode:Managed  Frequency:2.412 GHz  Access Point: 42:C7:F1:BE:15:EC   
          Bit Rate:65 Mb/s   Tx-Power=10 dBm   Sensitivity=1/0  
          RTS thr:off   Fragment thr:off
          Encryption key:****-****   Security mode:restricted
          Power Management:off
          Link Quality=80/80  Signal level=-49 dBm  Noise level:0 dBm
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0

## ifconfig
wifi0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.43.66  netmask 255.255.255.0  broadcast 192.168.43.255
        inet6 fe80::376b:2491:177f:12a2  prefixlen 64  scopeid 0x20<link>
        ether 88:da:1a:82:e8:5c  txqueuelen 1000  (Ethernet)
        RX packets 2664  bytes 358978 (350.5 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 3083  bytes 730005 (712.8 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

# As AP (hotspot off)
## iwconfig
wifi0     IEEE 802.11abgn  ESSID:""  
          Mode:Managed  Frequency:5.7 GHz  Access Point: Not-Associated   
          Tx-Power=30 dBm   Sensitivity=1/0  
          RTS thr:off   Fragment thr:off
          Encryption key:off
          Power Management:off
          Link Quality=80/80  Signal level=0 dBm  Noise level:0 dBm
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0

## ifconfig
wifi0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether 88:da:1a:82:e8:5c  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

I’m suspecting I should see iwconfig wifi0 in Mode:Host (EDIT: probably should be Mode:Master) instead of Mode:Managed. Here’s the relavent part of my docker-compose.yaml:

version: '2'
volumes:
  resin-data: {}

services:
  wifi-connect:
    build: ./wifi-connect
    network_mode: "host"
    labels:
        io.balena.features.dbus: '1'
    cap_add:
        - NET_ADMIN
    environment:
        DBUS_SYSTEM_BUS_ADDRESS: "unix:path=/host/run/dbus/system_bus_socket"

I am confused - how did you run iwconfig and ifconfig when you were not connected to device through “NickHotspot” (the second batch of output above)? Just trying to understand more about your setup so that I get a better idea on how this could be diagnosed further.

As part of my start.sh script, I do ifconfig wifi0 > ifconfig.txt, for instance. Then I turn on the hotspot and check the file.

That makes sense then :slight_smile: Can you please enable persistent via the device dashboard configuration variables? This will persist the device journal logs in case you need to reboot your device. Then after you run WiFi Connect and the access point is not started can you please grab all journalctl from the host OS and attach them here? You can grab those by opening a host OS terminal and run journalctl > /mnt/data/logs.txt and then using a file upload service like file.io - e.g. curl -F "file=@/mnt/data/logs.txt" https://file.io.

Also what drivers is the Redpine module using? Are those already part of the kernel or you are modprobing them from the container?