CC3351: Questions about country code getting and setting

Part Number: CC3351

Tool/software:

Hi TI's experts,

     About country code, we have the following questions:

     1. Does it support auto country code setting?

         Our expectation is that after the CC3351E Wi-Fi initialization is finished, default country code is set, for example "00", and only supports passive scan, then we will trigger a scan event and  the country code will be set automatically based on the beacon information from APs in the area. If CC3351E doesn't support auto country code setting, what is your suggestion to get and set country code based on the beacon information from APs in the area?

         The following related information was replied by TI before: "Yes, country code can be set manually via wpa_supplicant/hostapd.conf or via iw reg set. We support 802.11d for detection of country code adverstised by AP upon connection and generating reg domain change notification. Need clarification on: "If it fails to detect country code, such as when there is no AP nearby or the APs do not carry country code information, the Wi-Fi driver should set a special country code XX"

         How to config to enable 802.11d for detection of country code? For example, which command should be executed while switching to manual country code or automatic country code. 

         How can we get the reg domain change notificaion?

       2. Which command used to get country code from APs?  Using ‘iw wlan0 scan’ command is ok. Any other suggestion?

  • Hi Xianglong,

    The highlighted information in green is still true.

    How to config to enable 802.11d for detection of country code? For example, which command should be executed while switching to manual country code or automatic country code. 

    There is nothing the user has to do. When connecting to an AP and if the AP is broadcasting a country code, the mac80211 will detect the country code (reg domain) change and notify the wpa_supplicant as well. You can monitor the wpa_supplicant for the reg domain change. See example here. I set the country code to 00 (World), and then connected to my AP broadcasting country US. The wpa_supplicant prints out "CTRL-EVENT-REGDOM-CHANGE" with the country code it has changed to.

    root@am62xx-evm:/usr/share/cc33xx# ./sta_start.sh
    root@am62xx-evm:/usr/share/cc33xx# Successfully initialized wpa_supplicant
    
    root@am62xx-evm:/usr/share/cc33xx# iw reg get
    global
    country 00: DFS-UNSET
            (2402 - 2472 @ 40), (6, 20), (N/A)
            (2457 - 2482 @ 20), (6, 20), (N/A), AUTO-BW, PASSIVE-SCAN
            (2474 - 2494 @ 20), (6, 20), (N/A), NO-OFDM, PASSIVE-SCAN
            (5170 - 5250 @ 80), (6, 20), (N/A), AUTO-BW, PASSIVE-SCAN
            (5250 - 5330 @ 80), (6, 20), (0 ms), DFS, AUTO-BW, PASSIVE-SCAN
            (5490 - 5730 @ 160), (6, 20), (0 ms), DFS, PASSIVE-SCAN
            (5735 - 5835 @ 80), (6, 20), (N/A), PASSIVE-SCAN
            (57240 - 63720 @ 2160), (N/A, 0), (N/A)
    
    root@am62xx-evm:/usr/share/cc33xx# ./sta_connect-ex.sh sabeeh_5G NONE
    netid=0
    =========================
    OK
    OK
    OK
    root@am62xx-evm:/usr/share/cc33xx# wlan0: CTRL-EVENT-REGDOM-CHANGE init=BEACON_HINT type=UNKNOWN
    wlan0: CTRL-EVENT-REGDOM-CHANGE init=BEACON_HINT type=UNKNOWN
    wlan0: CTRL-EVENT-REGDOM-CHANGE init=BEACON_HINT type=UNKNOWN
    wlan0: CTRL-EVENT-REGDOM-CHANGE init=BEACON_HINT type=UNKNOWN
    wlan0: CTRL-EVENT-REGDOM-CHANGE init=BEACON_HINT type=UNKNOWN
    wlan0: SME: Trying to authenticate with e8:9c:25:b8:24:d4 (SSID=[  268.822843] wlan0: authenticate with e8:9c:25:b8:24:d4
    'sabeeh_5G' freq=5180 MHz)
    [  268.870086] wlan0: send auth to e8:9c:25:b8:24:d4 (try 1/3)
    [  268.891808] wlan0: authenticated
    wlan0: Trying to associate with e8:9c:25:b8:24:d4 (SSID='sabeeh_[  268.897767] wlan0: associate with e8:9c:25:b8:24:d4 (try 1/3)
    5G' freq=5180 MHz)
    [  268.914870] wlan0: RX AssocResp from e8:9c:25:b8:24:d4 (capab=0x1801 status=0 aid=17)
    [  268.927748] cc33xx: HE Disabled
    [  268.932398] wlan0: associated
    wlan0: Associated with e8:9c:25:b8:24:d4[  268.941068] cc33xx: Association complete.
    
    wlan0: CTRL-EVENT-CONNECTED - Connection to e8:9c:25:b8:24:d4 completed [id=0 id_str=]
    wlan0: CTRL-EVENT-SUBNET-STATUS-UPDATE status=0
    wlan0: CTRL-EVENT-REGDOM-CHANGE init=COUNTRY_IE type=COUNTRY alpha2=US
    

     2. Which command used to get country code from APs?  Using ‘iw wlan0 scan’ command is ok. Any other suggestion?

    Unfortunately I do not have any other easy solution. 'iw wlan0 scan' is probably the easiest. Otherwise you can implement the same nl80211 calls that iw uses on your own.

  • Note that this method of determining regulatory domain for compliance purposes is no longer legal in the United States, and has not been for a few years now. Simple reliance on country code of the connected AP alone is not sufficient to determine regulatory domain. 

    You must ensure that regardless of the country code adopted, no matter the means, the device remains legal (and does not transmit on channels 12/13). You can adopt whatever country code you want, but the end result still must be compliant operation.