Change the country code for the W8997 Wi-Fi chipset

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Change the country code for the W8997 Wi-Fi chipset

5,490 Views
virti_choksi
Contributor III

Hello NXP Team,

We have successfully integrated the "SD-WLAN-SD-BT-8997-U16-MMC-W16.68.10.p162-16.26.10.p162-C4X16693_V4-MGPL" driver into Android 12 Linux 4.9.178 on our custom BG5CT-based platform. With this updated driver integrated into our image, we aimed to test Wi-Fi connections on specific channels using the country code=FR on the client side.

To achieve this, we added the parameter "reg_alpha2=FR" to the script responsible for loading the drivers. After making these changes, we conducted testing under various conditions.

reg_alpha2_FR.png

Condition 1:

  • From the UI, Wi-Fi is turned OFF.
  • The DUT is neither connected to any AP nor credentials are saved for any AP.
  • We rebooted the DUT.
  • Running the command "iw reg get" yielded "Country US: DFS-FCC."
  • From the UI, we turn ON the Wi-Fi.
  • Running the command "iw reg get" again resulted in "Country US: DFS-FCC."Condition2.png

Condition 2:

  • From the UI, Wi-Fi is turned ON.
  • The DUT is neither connected to any AP nor are credentials saved for any AP.
  • We rebooted the DUT.
  • Running the command "iw reg get" yielded "Country 00: DFS-UNSET."
  • From the UI, we turn OFF the Wi-Fi.
  • Running the command "iw reg get" again resulted in "Country 00: DFS-UNSET."

According to condition 1 When no AP is connected and Wi-Fi is OFF command "$iw reg get" should result in "Country US: DFS-FCC."

condition1.png

Our requirement: We want the Country code set as FR for all times irrespective of whether the wifi is ON or OFF and AP connected or NOT connected.

Question: After adding the "reg_alpha2=FR" Parameter to the script do we need to add any other parameter or make changes to the business logic of the code?

During our debugging, we found one IOCTL file named: /mlinux/moal_ioctl.c with a default condition in a function to set the region as the "US".

Default_US.png

0 Kudos
Reply
19 Replies

5,435 Views
Christine_Li
NXP TechSupport
NXP TechSupport

Hi, @virti_choksi 

Hope you are doing well and thanks for choosing NXP products.

If I am correct, you prefer to use 88W8997 in STA mode.

In connection state: the country code will be decided by the AP which 88W8997 connected to.

If you want to set the country code and keep it valid even Wi-Fi off or Not connect to any AP, you can set it when insmod driver, like below:

insmod cfg80211.ko ieee80211_regdom=US

In this way, you need to compile cfg80211 to separate .ko and insmod it separately. The country code will be written into cfg80211 database.

Please let me know if you still have any other queries.

Best regards,

Christine.

Tags (1)
0 Kudos
Reply

5,389 Views
virti_choksi
Contributor III

Hello Christine,

I hope you're doing well too, and thank you for your assistance with NXP products.

Yes, you are correct; I prefer using the 88W8997 in STA mode. Your explanation about the country code in the connection state makes sense. However, I do have a couple of questions regarding setting the country code:

- I want to set the country code with the reg_alpha2 parameter through the script which is responsible for loading the driver how can I set it with that parameter?

Thank you for your assistance, and I appreciate your prompt response.

Best regards,

Virti Choksi

0 Kudos
Reply

5,343 Views
Christine_Li
NXP TechSupport
NXP TechSupport

Hi, @virti_choksi 

Thanks for your feedback.

Yes, In common you can use reg_alpha2 parameter to set regulatory domain  when load Wi-Fi driver as you are using reg_alpha2=FR. But this commands has complex code logic, like different Linux kernel version, cntry_txpwr, NL80211_REGDOM_SET_BY_DRIVER and something else.

Usually we don't suggest to use reg_alpha2, but with iw commands to set country code.

iw reg set FR

 

Best regards,

Christine.

0 Kudos
Reply

5,335 Views
virti_choksi
Contributor III

Hello @Christine_Li,

Thank you for the response.

We attempted to set the country code using the "iw" command.

We identified a parameter, "country_ie_ignore," with the following options:

  • 0: Follow countryIE from AP and beacon hint (enable)
  • 1: Ignore countryIE from AP and beacon hint (disable)

We added the "country_ie_ignore=1" parameter to the script responsible for loading the drivers. Subsequently, we attempted to set the country code using the "iw" utility. After making these changes, we followed a couple of steps to verify the applied modifications:

Method 1: Without setting the country code.

  • Rebooted the DUT.
  • Running the command "iw reg get" yielded "Country DE: DFS-ETSI."
  • Successfully pinged www.google.com.

Method 2: Setting the country code with the commands:

  • ifconfig wlan0 down
  • iw reg set FR
  • ifconfig wlan0 up
  • Running the command "iw reg get" yielded "Country FR: DFS-ETSI."
  • Turned ON the Wi-Fi through the UI
  • Running the command "iw reg get" again resulted in "Country FR: DFS-ETSI."
  • Successfully pinged www.google.com.

However, the setting is sustained for the particular session only, and we need to set the country code every time after the device is rebooted.

Question: How can we set the country code permanently?

0 Kudos
Reply

5,290 Views
Christine_Li
NXP TechSupport
NXP TechSupport

Hi, @virti_choksi 

Thanks for your trying.

But we don't suggest you to set country code permanently because after 88W8997 connected to one AP, it should follow the AP's settings. 

Hope my explanation be helpful for you.

Best regards,

Christine.

0 Kudos
Reply

5,203 Views
Christine_Li
NXP TechSupport
NXP TechSupport

Hi, @virti_choksi 

Anything I can do for you on this case?

I am not sure whether I misunderstood your meaning, if you mean only set permanently before connected to AP. You can use the method I mentioned before:

insmod cfg80211.ko ieee80211_regdom=FR

In this way, you need to compile cfg80211 to separate .ko and insmod it separately. The country code will be written into cfg80211 database.

For Android, the default cfg80211.ko file will be built into: 

out/target/product/your host product/obj/KERNEL_OBJ/net/wireless/

Please let me know if you still have any other queries.

 

Best regards,

Christine.

Tags (1)
0 Kudos
Reply

5,188 Views
virti_choksi
Contributor III

Hello @Christine_Li,

Thank you for your response.
Sorry for the late reply. I am working on your suggestion.
I will be testing it next week and let you know.

 

Best Regards,
Virti Choksi

 

 

0 Kudos
Reply

5,041 Views
virti_choksi
Contributor III

Hello @Christine_Li,

I apologize for the delay in my response.

I was successfully able to insert the cfg80211.ko module, but unfortunately, I am unable to scan the WiFi SSID on UI as well as through command line.

Here are the steps I followed:

1. I changed the module setting to loadable using "make menuconfig."

defconfig.png

2. I added the module to the "atv_s_9344727/device/synaptics/sequoia/BoardConfig.mk" file.

Boardconfig.png

3. I also added the module to the script responsible for loading the modules.detect_script.png

4. Then, I triggered the build and flashed the image to the DUT.

5. Upon flashing the image, I verified that the inserted modules were present.

lsmod.png

6. Then, using the wpa_cli utility, I attempted to scan the SSID, but I could not initiate a scan.

wpa_cli.png

Here is the content of the wpa_supplicant.conf file.

wpa_supplicant.png

My question is: Is there a specific sequence to follow while inserting the module, or did we miss any steps during the module insertion process?

I have also attached the log file below

0 Kudos
Reply

4,938 Views
Christine_Li
NXP TechSupport
NXP TechSupport

Hi, @virti_choksi 

Thanks for your feedback.

I checked your logs, and seems that Wi-Fi driver wasn't loaded successfully.

And I saw your menuconfig that have compiled cfg80211 into a module and you have built it into a cfg80211.ko file. After that insmod the ko to your board, but could you please insmod Wi-Fi driver(8997mlan.ko and sd8997.ko and bt driver:bt8xxx.ko )later after the board is ready to have a try?

Actually, I didn't meet this kind of issue before.

Or you can have a try with copy the cfg80211.ko,8997mlan.ko ,sd8997.ko and bt driver:bt8xxx.ko to /lib/modules/? 

Then check the /lib/firmware/nxp/ whether has related FW.

 

I am so sorry to let you know that we will start our National vacation from 29th/Sep-7th/Oct.

We will be back to office 8th/Oct.

Once case is closed automatically, please feel free to reopen it.

We could not reply you very frequently during vacation but we will try to answer back to you as quickly as we can, please help to understand that.

 

Best regards,

Christine.​

0 Kudos
Reply

4,759 Views
virti_choksi
Contributor III

Hello @Christine_Li ,

We attempted to insert the drivers after the board was ready, but the issue still persists.
All the .ko files are at /vendor/lib/modules/.
I also checked for the driver firmware binary at /vendor/firmware/nxp/.

Can we set the parameter "ieee80211_regdom=FR" if the cfg80211 module is built as a kernel module instead of a loadable module? if yes how can we set it in the source code?

On the DUT we also observed that "ieee80211_regdom" is READ-ONLY.regdom_param.png

 

Best Regards,

Virit Choksi

0 Kudos
Reply

4,743 Views
Christine_Li
NXP TechSupport
NXP TechSupport

Hi, @virti_choksi 

Have you load Wi-Fi driver successfully?

If you load Wi-Fi driver with ieee80211_regdom=FR, then it will be written into  /sys/module/cfg80211/parameters/ieee80211_regdom.

Yes, this file is Read-only in default.

If you want to change to another country code, you may need to rmmod and insmod Wi-Fi driver again with the new country code.

Best regards,

Christine.

0 Kudos
Reply

4,731 Views
Christine_Li
NXP TechSupport
NXP TechSupport

Hi, @virti_choksi 

I did a local test on 88W9098 instead of 88W8997 for you. I believe the working method should be same with 88W8997.

Please refer to my test steps and test results in the attachment.

Hope my test can help you somehow.

I also tested the scan function and connected to AP, it can work well.

 

Best regards,

Christine.

Tags (1)
0 Kudos
Reply

4,685 Views
Christine_Li
NXP TechSupport
NXP TechSupport

Hi, @virti_choksi 

Does it work well on your side refer to my test steps?

Hope it can help you somehow.

If still need further support, please let me know. 

 

Best regards,

Christine.

0 Kudos
Reply

4,662 Views
Christine_Li
NXP TechSupport
NXP TechSupport

Hi, @virti_choksi 

Anything else I can help you on this case?

If no, this thread will be closed automatically. 

 

Best regards,

Christine.

0 Kudos
Reply

4,622 Views
virti_choksi
Contributor III

Hello, @Christine_Li,

As you suggested in the document you shared, I attempted to run the wpa_supplicant manually. It partially worked because I could scan the SSID through the command line. However, I encountered an issue where I couldn't scan the SSID from the UI.

Here is the content of the wpa_supplicant.conf file.

wpa_supplicant .png

Additionally, I'd like to know if there is a way to scan the SSID automatically without having to enable the wpa_supplicant utility manually, as it was working before we loaded the cfg80211.ko module at runtime?

Best Regards, 
Virti Choksi

0 Kudos
Reply

4,589 Views
Christine_Li
NXP TechSupport
NXP TechSupport

Hi, @virti_choksi 

1. Can you please check whether you have changed the boot.img after compiling the cfg80211 into module?

2. Please check and make sure you add the cfg80211.ko to load driver script, should be init.insmod.sh

3.Please make sure only start one wpa_supplicant service. Android will start this service automatically when device booted, if you start one time in the command line, then please reboot your device and try to scan in UI.

4.After above checking, if the issue is still exist, please help to provide related logcat.log, then I will check it further.

 

Best regards,

Christine.

 

0 Kudos
Reply

4,580 Views
Christine_Li
NXP TechSupport
NXP TechSupport

Hi, @virti_choksi 

You can also have a try with below method:

Edit file:vendor/nxp-opensource/kernel_imx/net/wireless/reg.c:

static char *ieee80211_regdom = "00";

to:

static char *ieee80211_regdom = "FR";

In this way, it is not necessary to compile cfg80211 to module, keep it compile into kernel.

Try this way, please!

 

Best regards,

Christine.

 

Tags (1)
0 Kudos
Reply

4,610 Views
Christine_Li
NXP TechSupport
NXP TechSupport

Hi, @virti_choksi 

How about re-enable Wi-Fi on the UI after disable it?

After re-enable, still can not scan SSID?

Let me have a try with Android platform tomorrow and let you know the result.

I tested it on Linux before, It worked fine as my test result attached to you.

 

Best regards,

Christine.

Tags (1)
0 Kudos
Reply

5,249 Views
Christine_Li
NXP TechSupport
NXP TechSupport

Hi, @virti_choksi 

Anything else I can do for you on this case?

 

Best regards,

Christine.

0 Kudos
Reply