NanoPi Wifi Problem

Lukluk
Hi FA Team,

I've been received my NanoPi since weeks ago,
been tried Debian which takes too much RAM,
and also tried OpenWrt (taken from Kirkwood rootfs) to save some RAM,
everything run normal except of its wifi...

I keep always failing to make wifi up on both OS,
while it run in AP mode, it successfully run and up on OS side, but can not
be detected by any wifi client devices (i.e: my smartphone). 

But while it turned as wifi client, it keep failing to authenticate to any
AP, even if the AP SSID is detected and succesfully connected on phyisical
layer, I assume that the problem is on signaling or clocking probably in
driver side...

any help is appreciated. 

Thanks in advance,
--Lukluk

Lukluk
some kernel logs:

...
[  270.726483] dhd_bus_devreset: == WLAN ON ==
[  270.728408] F1 signature read @0x18000000=0x1591a962
[  270.734507] dhd_conf_set_hw_oob_intr: Enable HW OOB for 43362
[  270.749440] F1 signature OK, socitype:0x1 chip:0xa962 rev:0x1 pkg:0x9
[  270.754017] DHD: dongle ram size is set to 245760(orig 245760) at 0x0
[  270.766077] dhd_conf_read_config: Ignore config file
/lib/firmware/ap6210/config.txt
[  270.768268] dhd_conf_set_fw_name_by_chip:
firmware_path=/lib/firmware/ap6210/fw_bcm40181a2.bin
[  270.777661] Final fw_path=/lib/firmware/ap6210/fw_bcm40181a2.bin
[  270.783650] Final nv_path=/lib/firmware/ap6210/nvram.txt
[  270.788957] Final conf_path=/lib/firmware/ap6210/config.txt
[  270.895034] NVRAM version: AP6210_NVRAM_V1.2_03192013
[  270.897176] dhdsdio_write_vars: Download, Upload and compare of NVRAM
succeeded.
[  270.906357] dhd_bus_init: delay 100ms for BCM43362
[  271.125823] dhd_bus_init: enable 0x06, ready 0x06 (waited 0us)
[  271.126469] bcmsdh_oob_intr_register: Enter
[  271.130903] bcmsdh_oob_intr_register OOB irq=54 flags=4
[  271.136257] bcmsdh_oob_intr_register: enable_irq_wake
[  271.141205] wake enabled for irq 54
[  271.150740] dhd_conf_set_band: Set band 0
[  271.159172] Firmware up: op_mode=0x0005, MAC=04:e6:76:6f:f6:a2
[  271.159421] dhd_conf_set_country: Set country ALL, revision 0
[  271.273271] Country code: ALL (ALL/0)
[  271.275165] dhd_conf_set_roam: Set roam_off 1
[  271.285152] dhd_preinit_ioctls buf_key_b4_m4 set failed -23
[  271.309791] Firmware version = wl0: Nov 25 2013 17:54:47 version
5.90.195.89.13 FWID 01-c2d628b1
[  271.313013]   Driver: 1.201.34.2 (r491657)
[  271.313013]   Firmware: wl0: Nov 25 2013 17:54:47 version 5.90.195.89.13
FWID 01-c2d628b1 
[  271.326937] dhd_txglom_enable: enable 0
[  271.334259] dhd_preinit_ioctls wl ampdu_hostreorder failed -23
[  271.336523] wl_android_wifi_on: Success
[  271.471851] dhd_set_scb_probe: GET max_scb_probe failed
[  271.473305] dhd_set_scb_probe: max_scb_probe setting failed
[  271.477746] dhd_open: Exit ret=0
...

davef
Lukluk,

While I managed to connect to my Samsung Smartphone I can not connect to my
home Wireless router (TP-Link).

And I get the same messages as you:

   [  271.471851] dhd_set_scb_probe: GET max_scb_probe failed
   [  271.473305] dhd_set_scb_probe: max_scb_probe setting failed
   [  271.477746] dhd_open: Exit ret=0

arp -a   gave me:
   ? (192.168.2.1) at <incomplete> on wlan0 

so tried
   arp -s 192.168.2.1 00:27:19:db:cb:82
with no luck

route -n gave me:

Kernel IP routing table                                                    
    
Destination     Gateway         Genmask         Flags Metric Ref    Use
Iface   
0.0.0.0         192.168.2.1     0.0.0.0         UG    0      0        0
wlan0   
192.168.2.0     0.0.0.0         255.255.255.0   U     0      0        0
wlan0   
192.168.100.0   0.0.0.0         255.255.255.0   U     0      0        0
usb0    

wpa_cli -iwlan0 scan_result gave me:
bssid / frequency / signal level / flags / ssid                            
    
00:27:19:db:cb:82       2437    -39     [WPA2-PSK-CCMP+TKIP-preauth][ESS]  
   T
P-LINK

(which looks correct)

and put an entry in resolv.conf
   nameserver 192.168.2.1

Have you found what works?

jota
I have the same problem.Have you found any solution?

[10346.576782] wifi_platform_set_power = 1
[10346.576854] ======== PULL WL_REG_ON HIGH! ========
[10346.839233] sdio_reset_comm():
[10346.860741] mmc1: queuing unknown CIS tuple 0x80 (2 bytes)
[10346.862735] mmc1: queuing unknown CIS tuple 0x80 (3 bytes)
[10346.874039] mmc1: queuing unknown CIS tuple 0x80 (3 bytes)
[10346.877655] mmc1: queuing unknown CIS tuple 0x80 (7 bytes)
[10346.904377] 

dhd_bus_devreset: == WLAN ON ==
[10346.906369] F1 signature read @0x18000000=0x1591a962
[10346.917951] dhd_conf_set_hw_oob_intr: Enable HW OOB for 43362
[10346.931163] F1 signature OK, socitype:0x1 chip:0xa962 rev:0x1 pkg:0x9
[10346.938520] DHD: dongle ram size is set to 245760(orig 245760) at 0x0
[10346.942805] dhd_conf_read_config: Ignore config file
/lib/firmware/ap6210/config.txt
[10346.954013] dhd_conf_set_fw_name_by_chip:
firmware_path=/lib/firmware/ap6210/fw_bcm40181a2.bin
[10346.957278] Final fw_path=/lib/firmware/ap6210/fw_bcm40181a2.bin
[10346.969556] Final nv_path=/lib/firmware/ap6210/nvram.txt
[10346.969677] Final conf_path=/lib/firmware/ap6210/config.txt
[10347.068014] NVRAM version: AP6210_NVRAM_V1.2_03192013
[10347.073366] dhdsdio_write_vars: Download, Upload and compare of NVRAM
succeeded.
[10347.077694] dhd_bus_init: delay 100ms for BCM43362
[10347.295908] dhd_bus_init: enable 0x06, ready 0x06 (waited 0us)
[10347.296501] bcmsdh_oob_intr_register: Enter
[10347.305242] bcmsdh_oob_intr_register OOB irq=54 flags=4
[10347.305611] bcmsdh_oob_intr_register: enable_irq_wake
[10347.316437] wake enabled for irq 54
[10347.324866] dhd_conf_set_band: Set band 0
[10347.335809] Firmware up: op_mode=0x0005, MAC=04:e6:76:71:1d:c1
[10347.336051] dhd_conf_set_country: Set country ALL, revision 0
[10347.423383] Country code: ALL (ALL/0)
[10347.428525] dhd_conf_set_roam: Set roam_off 1
[10347.440300] dhd_preinit_ioctls buf_key_b4_m4 set failed -23
[10347.466450] Firmware version = wl0: Nov 25 2013 17:54:47 version
5.90.195.89.13 FWID 01-c2d628b1
[10347.469801]   Driver: 1.201.34.2 (r491657)
  Firmware: wl0: Nov 25 2013 17:54:47 version 5.90.195.89.13 FWID
01-c2d628b1 
[10347.487673] dhd_txglom_enable: enable 0
[10347.494739] dhd_preinit_ioctls wl ampdu_hostreorder failed -23
[10347.496298] wl_android_wifi_on: Success
[10347.603872] dhd_set_scb_probe: GET max_scb_probe failed
[10347.609040] dhd_set_scb_probe: max_scb_probe setting failed
[10347.609308] dhd_open: Exit ret=0
[10347.628827] CFG80211-ERROR) wl_cfg80211_connect : error (-14)

Arash
I have same problem. with exact dmesg results. 
I can not scan any Access point with wlan0 interface.
I have this problem with BLE4 too.
I think it's some sort of hardware problem.
Do you have any idea?

davef
Interesting that Googling:

   dhd_set_scb_probe: max_scb_probe setting failed

gives 2 hits and one of them is this thread.

I don't get this error:
   
   CFG80211-ERROR) wl_cfg80211_connect : error (-14)

Have you tried searching that one?

I will place a posting on their other forum linking to this thread.

FATechsupport
Thank you for raising these issues. We have a post here
http://www.friendlyarm.com/Forum/viewtopic.php?f=37&t=24&p=51#p51  for your
reference

Lukluk
Hi davef,

I think i got a bit clue how to solve the problem,
the solution is by set security version "WPA2-PSK" and enctyption to
"CCMP/AES", because both security setting are the only been supported by
AP6210 driver,
(and I think on Android AP too)

===============

root@OpenWrt:~# iw wlan0 scan
BSS 90:f6:52:75:06:b4(on wlan0)
  TSF: 1270201618 usec (0d, 00:21:10)
  freq: 2437
  beacon interval: 100 TUs
  capability: ESS Privacy ShortPreamble ShortSlotTime (0x0431)
  signal: -81.00 dBm
  last seen: 0 ms ago
  SSID: TP-LINK_7506B4
  Supported rates: 1.0* 2.0* 5.5* 11.0* 6.0 9.0 12.0 18.0 
  DS Parameter set: channel 6
  TIM: DTIM Count 0 DTIM Period 1 Bitmap Control 0x0 Bitmap[0] 0x0
  Country: US  Environment: Indoor/Outdoor
    Channels [1 - 11] @ 27 dBm
  ERP: <no flags>
  RSN:   * Version: 1
     * Group cipher: CCMP
     * Pairwise ciphers: CCMP
     * Authentication suites: PSK
     * Capabilities: 1-PTKSA-RC 1-GTKSA-RC (0x0000)
  Extended supported rates: 24.0 36.0 48.0 54.0 
  WMM:   * Parameter version 1
     * BE: CW 15-1023, AIFSN 3
     * BK: CW 15-1023, AIFSN 7
     * VI: CW 7-15, AIFSN 2, TXOP 3008 usec
     * VO: CW 3-7, AIFSN 2, TXOP 1504 usec

===============

After I set my TP-LINK router to above setting,
NanoPI wifi connected directly as on this log:

===============

root@OpenWrt:~# wpa_supplicant -i wlan0 -c /etc/wpa_supplicant.conf
Successfully initialized wpa_supplicant
wlan0: Trying to associate with 90:f6:52:75:06:b4 (SSID='TP-LINK_7506B4'
freq=2437 MHz)
wlan0: Associated with 90:f6:52:75:06:b4
wlan0: WPA: Key negotiation completed with 90:f6:52:75:06:b4 [PTK=CCMP
GTK=CCMP]
wlan0: CTRL-EVENT-CONNECTED - Connection to 90:f6:52:75:06:b4 completed
[id=2 id_str=]

===============

But I still got bad signal, even if my NPi placed near the router,
seems the only solution for this signal problem is by soldering antenna as
mentioned on FATechsupport post url...

davef
Lukluk,

I have been able to connect to 2 Smartphones, a TP-link router and another
wireless modem connected to fiber, all with WPA-PSK and CCMP or CCMP TPIK.

However, switching from one system to another seems to take several
attempts.  Usually with me trying different variants of RSN and one WPA RSN
(which appears redundant). 

I'll try your WPA2 PSK and CCMP AES or is it really CCMP/AES?

Where did you find the security settings for the AP6210, in dhd_linux.c?

davef
Signal strength ... I can connect to routers within 5-10 metres but now the
signal level reads -50 whether it is 100mm away or 10 metres.  Doesn't it
get updated every minute or ?

To work at 2.4GHz for the WiFi and 5.4GHz for Bluetooth that chip antenna
would need to be a dual-band device. Is it?  Also, they need to be mounted
above a well-defined ground plane.  Does the NanoPi support 5GHz WiFi?

If FriendlyARM would like to link to the actual chip antenna AN2051
datasheet (English) I might be able to provide some useful input.

davef
Should have read the AP6210 datasheet!  I now know that Bluetooth is
2.4GHz.  Also, the AP6210 only supports 2.4MHz WiFi.

I scrapped the PCB resist off the top and bottomside layers to confirm
there is NO external ground plane layers.  They must use an internal layer
for ground plane, or at the very least to get the ground side of the
antenna back to the AP6210.

OK, finding the datasheet was easy.  Figure 1 on page 4 shows a massive
ground plane.  The artwork for the 50 Ohm track doesn't make sense.  I
suspect it is continuous and is via connected through the board to the
"hot" side of the chip antenna.

Looking thru the NanoPi pcb in the antenna area I can't see any internal
layers, so how they are getting the "cold" or ground side of the chip back
to the RF side of the AP6210 is unknown.  

Connecting the ground flange of a SMA connector to the ground pad of the
removed RainSun chip antenna is probably the only way of getting any ground
connection back to the AP6210.

What might be worth trying is to mount a 35mm by 40mm piece of copper tape
or thin double-sided PCB adjacent to the ground side of the chip antenna,
ie covering the mounting hole and extending outside the board area.  And
connected to the ground side of the in-place chip antenna.

Looking closer I can a track running from pin 1 on the AP6210 to the bottom
side of C500 that is intensively via connected to perhaps an internal
layer.  

Is C487 mounted on your board?

Henry
Hi Davef

Basically chip antenna does not require ground plane under it's footprint,
accept the RF trace from the transceiver to the antenna, we should maintain
50 ohms for standard impedance matching. Return to the main topic I think
the problem is not belong to hardware :

[10346.576782] wifi_platform_set_power = 1
[10346.576854] ======== PULL WL_REG_ON HIGH! ========
[10346.839233] sdio_reset_comm():
[10346.860741] mmc1: queuing unknown CIS tuple 0x80 (2 bytes)
[10346.862735] mmc1: queuing unknown CIS tuple 0x80 (3 bytes)
[10346.874039] mmc1: queuing unknown CIS tuple 0x80 (3 bytes)
[10346.877655] mmc1: queuing unknown CIS tuple 0x80 (7 bytes)

Maybe there is something wrong with driver or BCM firmware.

davef
Henry,

You are correct.  Replacing the RainSun (stated 0.5dBi gain) chip with a
"10dBi" patch antenna gives me about 25dB more signal level, say 5 mtrs
away.

All I can say about the WiFi is that when you get it going it seems to
continue working.  I feel that switching wlan0 on and off using ifon wlan0
and ifdown wlan0 is slow, so I just leave it on and use another WiFi to USB
adapter to talk to other networks.

Henry
Hi Davef,

How about this guide ?

https://hackaday.io/project/9934-raspberry-pi-rtl8723bs-sdio-gpio-150mbs...

It seems to be better than AP6212, I found the Linux driver here :
https://github.com/hadess/rtl8723bs

However the driver has been tested with kernel 4.x, I'm not sure it can
work with kernel 3.4.y or not.

davef
Thanks for the link.  I am quite happy with a ASUS N10 WiFi module.  Had to
re-compile the kernel to put staging ->  RealTek RTL8712U

Dave