This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Problem with Multi_Role_Configuration!

Dear TI Expert!

I want to config Multi_Role for WL183x : wlan0 as station connected to internet and wlan1 as AP and permit the device connected to wlan1 AP can internet access but I facing the problem below:

Scenario1: I followed this link: http://processors.wiki.ti.com/index.php/OMAP_Wireless_Connectivity_NLCP_Multi_Role_Configuration, scenario "Surf the Web", 

I can access to internet from device connected to wlan1 but in the short time the system warning error and auto reset, please see the log below:

root@am335x-evm:/home# wlan1: STA d0:57:85:6a:2b:db IEEE 802.11: authenticated

wlan1: STA d0:57:85:6a:2b:db IEEE 802.11: associated (aid 1)

wlan1: AP-STA-CONNECTED d0:57:85:6a:2b:db

[  438.877210] wlcore: WARNING no fw rx ba on tid 3

[  439.941697] wlcore: WARNING no fw rx ba on tid 3

[  440.064152] wlcore: WARNING no fw rx ba on tid 3

[  440.087166] wlcore: WARNING no fw rx ba on tid 3

[  440.202606] wlcore: WARNING no fw rx ba on tid 3

[  440.310551] wlcore: WARNING no fw rx ba on tid 3

Scenario2: I followed this link:http://processors.wiki.ti.com/index.php/WiLink8_WLAN_Demo:_Linux#AP_.28create_AP_with_no_security.29,  but I cannot 

access to internet from device which connected to wlan1.

Scenario3: I splitted 2 difference scripts for enable Station and AP: when I run wifi Station script first then I cannot enable wlan1 by script. Please see 

the log below:

root@am335x-evm:/home# ./wifi_AP.sh

Enabling wifi AP

root@am335x-evm:/home# Configuration file: /etc/hostapd.conf

[ 3303.561571] wlcore: down

[ 3303.620553] cfg80211: Calling CRDA for country: US

[ 3303.675857] cfg80211: Current regulatory domain intersected:

[ 3303.681890] cfg80211:   (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp)

[ 3303.690472] cfg80211:   (2402000 KHz - 2472000 KHz @ 40000 KHz), (N/A, 2000 mBm)

[ 3303.698251] cfg80211:   (5170000 KHz - 5250000 KHz @ 40000 KHz), (N/A, 1700 mBm)

[ 3303.706024] cfg80211:   (5250000 KHz - 5330000 KHz @ 40000 KHz), (N/A, 2000 mBm)

wpa_driver_nl80211_set_country: failed

Failed to set country code

wlan1: Unable to setup interface.

[ 3306.662913] wlcore: down

 If I run the script enable AP first, wlan1 active and permit device connected to it but after that it often error as log below:

root@am335x-evm:/home# ./wifi_AP.sh

Enabling wifi AP

[  102.398585] wlcore: PHY firmware version: Rev 8.2.0.0.195

[  102.495272] wlcore: firmware booted (Rev 8.8.0.0.13)

Configuration file: /etc/hostapd.conf

root@am335x-evm:/home# [  102.581909] wlcore: down

[  103.029914] wlcore: PHY firmware version: Rev 8.2.0.0.195

[  103.126314] wlcore: firmware booted (Rev 8.8.0.0.13)

[  103.143780] cfg80211: Calling CRDA for country: US

[  103.261817] cfg80211: Regulatory domain changed to country: US

[  103.267968] cfg80211:   (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp)

[  103.276580] cfg80211:   (2402000 KHz - 2472000 KHz @ 40000 KHz), (300 mBi, 2700 mBm)

[  103.284721] cfg80211:   (5170000 KHz - 5250000 KHz @ 40000 KHz), (300 mBi, 1700 mBm)

[  103.292855] cfg80211:   (5250000 KHz - 5330000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)

[  103.300982] cfg80211:   (5490000 KHz - 5600000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)

[  103.309121] cfg80211:   (5650000 KHz - 5710000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)

[  103.317256] cfg80211:   (5735000 KHz - 5835000 KHz @ 40000 KHz), (300 mBi, 3000 mBm)

[  103.325393] cfg80211:   (57240000 KHz - 63720000 KHz @ 2160000 KHz), (N/A, 4000 mBm)

Using interface wlan1 with hwaddr 84:dd:20:69:de:97 and ssid "Multirole_Demo"

wlan1: STA d0:57:85:6a:2b:db IEEE 802.11: authenticated

wlan1: STA d0:57:85:6a:2b:db IEEE 802.11: associated (aid 1)

wlan1: AP-STA-CONNECTED d0:57:85:6a:2b:db

wlan1: STA d8:5d:4c:be:c7:83 IEEE 802.11: authenticated

wlan1: STA d8:5d:4c:be:c7:83 IEEE 802.11: associated (aid 2)

wlan1: AP-STA-CONNECTED d8:5d:4c:be:c7:83

wlan1: STA 7c:61:93:07:da:5c IEEE 802.11: authenticated

wlan1: STA 7c:61:93:07:da:5c IEEE 802.11: associated (aid 3)

wlan1: AP-STA-CONNECTED 7c:61:93:07:da:5c

wlan1: AP-STA-DISCONNECTED 7c:61:93:07:da:5c

wlan1: AP-STA-DISCONNECTED d8:5d:4c:be:c7:83

wlan1: AP-STA-DISCONNECTED d0:57:85:6a:2b:db

[  292.863139] wlcore: down

[  294.220157] wlcore: PHY firmware version: Rev 8.2.0.0.195

[  294.395386] wlcore: firmware booted (Rev 8.8.0.0.13)

Below are Station and AP enable script:

Station:

#!/bin/bash
ifconfig wlan0 up
wpa_supplicant -d -Dnl80211 -c/etc/wpa_supplicant.conf -iwlan0 -B

wpa_cli -iwlan0 disconnect
for i in `wpa_cli -iwlan0 list_networks | grep ^[0-9] | cut -f1`; 
do wpa_cli -iwlan0 remove_network $i; 
done
wpa_cli -iwlan0 add_network
wpa_cli -iwlan0 set_network 0 auth_alg OPEN
wpa_cli -iwlan0 set_network 0 key_mgmt WPA-PSK
wpa_cli -iwlan0 set_network 0 psk '"xxxx"'
wpa_cli -iwlan0 set_network 0 proto RSN
wpa_cli -iwlan0 set_network 0 mode 0
wpa_cli -iwlan0 set_network 0 ssid '"TOSY_RD"'
wpa_cli -iwlan0 select_network 0
wpa_cli -iwlan0 enable_network 0
wpa_cli -iwlan0 reassociate
wpa_cli -iwlan0 status
iw wlan0 link
udhcpc -i wlan0

AP:

#!/bin/bash

echo Enabling wifi AP
iw phy0 interface add wlan1 type managed
ifconfig wlan1 10.4.30.34 netmask 255.255.255.0 up
hostapd /etc/hostapd.conf &
udhcpd /etc/udhcpd.conf 
iptables -t nat -A POSTROUTING -o wlan1 -j MASQUERADE

Please advise us to resolve this problem!

Thank and Best Regards,

Tri.

  • Hi Tri,

    Please follow the instructions from: processors.wiki.ti.com/.../WiLink8_WLAN_Demo:_Linux to check multirole scenario

    Regards,
    Gigi Joseph.
  • Dear Gigi!

    I had tried your link before but I cannot access to internet from device which associated to wlan1 while wlan0 already connected to internet AP.
    This link below is ok:
    processors.wiki.ti.com/.../OMAP_Wireless_Connectivity_NLCP_Multi_Role_Configuration
    But the problem is after active wlan0 as Station and wlan1 as AP, the system often auto restart in several minutes without reason.

    Another problem I observed is: if the wlan1 AP already active and I running enable wlan1 AP script again then the wlan1 warning error as log below:
    /etc/udhcpc.d/50default: Adding DNS 208.91.112.53
    Configuration file: /etc/hostapd.conf
    [ 151.732843] wlcore: down
    nl80211: Failed to set interface wlan1 into AP mode
    nl80211 driver initialization failed.

    if I shutdown wlan1 by "ifconfig wlan1 down" and then running enable wlan1 AP script again then the result the same above.
    Please advise!
    If in our application we want to have the On/Off wifi button so how we can On and Off the wifi repeatedly without error?

    Thanks and Best Regards,
    Tri.

  • Hi,

    Can you please explain the "auto restart" ? What is it? Can you share the logs?
    Also, you can ignore the - "wlcore: WARNING no fw rx ba on tid 3". This is just a warning.

    Regarding: "if the wlan1 AP already active and I running enable wlan1 AP script again then the wlan1 warning error as log below" - this is expected as the interface is already up.

    "if I shutdown wlan1 by "ifconfig wlan1 down" and then running enable wlan1 AP script again then the result the same above." - this is NOT expected.

    My recommendation is to use a few seconds delay between the wpa_cli commands and see if it helps.

    Regards,
    Gigi Joseph.
  • Dear Gigi!

    Related to wlan1 cannot enable again after down, this is the log:

    am335x-evm login: root
    root@am335x-evm:~# cd /home/
    root@am335x-evm:/home# ./wifi_AP.sh
    Enabling wifi AP
    [ 47.038671] wlcore: PHY firmware version: Rev 8.2.0.0.195
    [ 47.135493] wlcore: firmware booted (Rev 8.8.0.0.13)
    Configuration file: /etc/hostapd.conf
    [ 47.261851] wlcore: down
    [ 47.729935] wlcore: PHY firmware version: Rev 8.2.0.0.195
    [ 47.825519] wlcore: firmware booted (Rev 8.8.0.0.13)
    Using interface wlan1 with hwaddr 84:dd:20:69:de:97 and ssid "MultiRole_AP"
    root@am335x-evm:/home# ifconfig wlan1 down
    [ 58.682990] wlcore: down
    root@am335x-evm:/home# ./wifi_AP.sh
    Enabling wifi AP
    command failed: Too many open files in system (-23)
    Configuration file: /etc/hostapd.conf
    [ 87.513714] wlcore: down
    nl80211: Failed to set interface wlan1 into AP mode
    nl80211 driver initialization failed.

    Below are wifi_AP.sh script to avtive wlan1 as AP:

    #!/bin/bash
    echo Enabling wifi AP
    iw phy0 interface add wlan1 type managed
    ifconfig wlan1 10.4.30.34 netmask 255.255.255.0 up
    hostapd -B /etc/hostapd.conf -P /var/run/hostapd.pid
    echo 1 > /proc/sys/net/ipv4/ip_forward
    udhcpd /etc/udhcpd.conf
    iptables -t nat -A POSTROUTING -o wlan1 -j MASQUERADE

    Please explain this error!
    If I want to turn On and Off wlan1 AP many time without need reset system so what should i do?

    Thanks and Regards,
    Tri.
  • Hi Tri,

    You cannot do: "iw phy0 interface add wlan1 type managed" every time.
    It is only required the first time.

    "ifconfig wlan1 down" will not remove the interface.

    So second time when you run the "wifi_AP.sh" script, what is failing is the "interface add" command because wlan1 is already present.

    Regards,
    Gigi Joseph.
  • Dear Gigi!

    I tried bring up wlan1 again ignored step "iw phy0 interface add wlan1 type managed" followed your advice but the have the error at step run hostapd "hostapd -B /etc/hostapd.conf -P /var/run/hostapd.pid" and the wlan1 was not created AP again, please see the log below:

    am335x-evm login: root
    root@am335x-evm:~# cd /home/
    root@am335x-evm:/home# ./wifi_AP.sh
    Enabling wifi AP
    [ 104.048522] wlcore: PHY firmware version: Rev 8.2.0.0.195
    [ 104.145372] wlcore: firmware booted (Rev 8.8.0.0.13)
    Configuration file: /etc/hostapd.conf
    [ 104.271749] wlcore: down
    [ 104.739878] wlcore: PHY firmware version: Rev 8.2.0.0.195
    [ 104.835363] wlcore: firmware booted (Rev 8.8.0.0.13)
    Using interface wlan1 with hwaddr 84:dd:20:69:de:97 and ssid "MultiRole_AP"
    root@am335x-evm:/home# ifconfig
    eth0 Link encap:Ethernet HWaddr 1C:BA:8C:90:1D:58
    UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
    RX packets:810 errors:0 dropped:5 overruns:0 frame:0
    TX packets:1 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:1000
    RX bytes:69523 (67.8 KiB) TX bytes:322 (322.0 B)
    Interrupt:56

    lo Link encap:Local Loopback
    inet addr:127.0.0.1 Mask:255.0.0.0
    UP LOOPBACK RUNNING MTU:65536 Metric:1
    RX packets:0 errors:0 dropped:0 overruns:0 frame:0
    TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:0
    RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

    wlan1 Link encap:Ethernet HWaddr 84:DD:20:69:DE:97
    inet addr:10.4.30.34 Bcast:10.4.30.255 Mask:255.255.255.0
    UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
    RX packets:0 errors:0 dropped:0 overruns:0 frame:0
    TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:1000
    RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

    root@am335x-evm:/home# ifconfig wlan1 down
    [ 116.832896] wlcore: down
    root@am335x-evm:/home# ifconfig wlan1 10.4.30.34 netmask 255.255.255.0 up
    [ 138.830097] wlcore: PHY firmware version: Rev 8.2.0.0.195
    [ 138.925251] wlcore: firmware booted (Rev 8.8.0.0.13)
    root@am335x-evm:/home# hostapd -B /etc/hostapd.conf -P /var/run/hostapd.pid
    Configuration file: /etc/hostapd.conf
    [ 151.977775] wlcore: down
    nl80211: Failed to set interface wlan1 into AP mode
    nl80211 driver initialization failed.
    root@am335x-evm:/home#

    Please advise to solve this problem!

    Thanks anf Best Regards,
    Tri.
  • Hi Tri,

    Why is there an "ifconfig up" command before running the script? The hostapd will bring up the interface (mentioned in hostapd.conf file)
    Please ensure that you make the script in accordance with the AP Demo page at: processors.wiki.ti.com/.../WiLink8_WLAN_Demo:_Linux

    Regards,
    Gigi Joseph.
  • Dear Gigi!

    What should I do to enalbe wifi AP again, I did followed AP Demo page but after shutdown wlan1 I cannot create wifi AP again.

    I realized that the command "hostapd -B /etc/hostapd.conf -P /var/run/hostapd.pid" cannot run many time, if it already run one time, module will have error if I run this command again.

    Please advise!

    Thanks and Best Regards,

    Tri.

  • Hi Tri,

    Yes, you cannot run multiple instances of hostapd. You need to kill and restart it.

    Regards,
    Gigi Joseph.