nRF7002DK, Set region return no error on wrong country code but after 10s

  • List of valid country code:
    https://nrfconnectdocs.nordicsemi.com/ncs/latest/nrf/protocols/wifi/regulatory_support.html#wifi-regulatory-channel-rules

    static const char *const valid_country_codes[] = {
        /* Group 1 */
        "AD", "AL", "AT", "BA", "BE", "BG", "CH", "CY", "CZ", "DE",
        "DK", "EE", "ES", "FI", "FR", "GR", "HU", "IE", "IS", "IT",
        "LI", "LT", "LU", "LV", "MC", "MD", "ME", "MK", "MT", "NL",
        "NO", "PL", "PT", "RO", "SE", "SI", "SK",
        /* Group 2 */
        "AF", "AI", "AN", "AW", "BL", "BT", "BY", "ET", "GF", "GL",
        "GP", "KH", "LS", "MF", "MQ", "MR", "MW", "OM", "PF", "PM",
        "RE", "SA", "SR", "TD", "VC", "WF", "WS", "YT", "ZW",
        /* Group 3 */
        "AE", "AR", "BF", "CF", "CI", "CO", "GH", "HN", "JM", "LB",
        "LK", "MX", "PE", "PG", "RW", "SN", "TH", "TT", "VN", "VU",
        /* Group 4 */
        "AS", "BM", "FM", "HT", "MH", "MP", "NI", "PW", "VI",
        /* Group 5 */
        "BS", "CX", "KY", "MN", "MU", "PY", "TC", "UG",
        /* Countries (A to D) */
    	"DZ", "AM", "AU", "AZ", "BH", "BD", "BB", "BZ", "BO", "BR",
    	"BN", "CA", "CL", "CN", "CR", "HR", "CU", "DM", "DO",
    	/* Countries (E to J) */
    	"EC", "EG", "GE", "GD", "GU", "GT", "GY", "HK", "IN", "ID",
    	"IR", "IL", "JP", "JO",
    	/* Countries (K to R) */
    	"KZ", "KE", "KP", "KR", "KW", "MO", "MY", "MV", "MA", "NP",
    	"NZ", "NG", "PK", "PA", "PH", "PR", "QA", "RU",
    	/* Countries (S to Z) */
    	"KN", "LC", "SV", "RS", "SG", "ZA", "SY", "TW", "TZ", "TG",
    	"TN", "TR", "UA", "GB", "US", "UY", "UZ", "VE", "YE",
    };

  • Hi,

     

    I am currently looking into this, and will get back to you and give a more in-depth answer after recreating the problem.

     

    Kind regards,

    Håkon

  • Hi,

     

    I added this function to the wifi/sta sample, and called it just after net_mgmt_callback_init() in main() function:

    static int wifi_set_reg(void)
    {
    	struct net_if *iface;
    	struct wifi_reg_domain reg = { 0 };
    	int ret;
    
    	reg.oper = WIFI_MGMT_SET;
    	uint8_t low = 'X'; uint8_t high = 'Y';
    	iface = net_if_get_first_wifi();
    	if (iface == NULL) {
    		LOG_ERR("No Wi-Fi interface found");
    		return -1;
    	}
    
    	reg.country_code[0] = low;
    	reg.country_code[1] = high;
    	reg.force = false;
    
    	ret = net_mgmt(NET_REQUEST_WIFI_REG_DOMAIN, iface, &reg, sizeof(reg));
    	if (ret) {
    		LOG_ERR("Regulatory setting failed %d", ret);
    		return -1;
    	}
    
    	printk("Regulatory set to %c%c for interface %d\n", reg.country_code[0],
    		reg.country_code[1], net_if_get_by_iface(iface));
    
    	return 0;
    }
    
    int main(void)
    {
    	int ret = 0;
    
    	net_mgmt_callback_init();
    	wifi_set_reg();
    	....

     

    And the output is as follows:

    00:00:11.840,270] <err> wifi_nrf: nrf_wifi_fmac_set_reg: Failed to set regulatory information
    [00:00:11.840,301] <err> wifi_nrf: nrf_wifi_supp_set_country: nrf_wifi_fmac_set_reg failed
    [00:00:11.840,362] <err> wpa_supp: wpa_drv_zep_set_country: set_country op failed
    [00:00:11.840,454] <err> wpa_supp: Failed to set country code 'XY'
    Regulatory set to XY for interface 1

     

    meaning that net_mgmt() returns 0 (success) in this scenario, and uses 10 seconds to return.

    Clear bugs from our side, which I will report internally. Thank you so much for notifying us and helping us improve our delivery!

     

    Kind regards,

    Håkon

Related