Proper way to init phy_init and NVS?

rojer9
Posts: 17
Joined: Mon Dec 14, 2015 10:45 pm
Contact:

Proper way to init phy_init and NVS?

Postby rojer9 » Thu Dec 08, 2016 10:02 pm

ESP8266 used to ship a small init file for sys params area.
i see that esp-idf does not flash anything to these areas, but i'd like to initialize them to known state.
is it ok to just erase the area (i.e. fill with 0xff)?

ESP_Sprite
Posts: 9772
Joined: Thu Nov 26, 2015 4:08 am

Re: Proper way to init phy_init and NVS?

Postby ESP_Sprite » Fri Dec 09, 2016 1:37 am

Yes, that should work.

ESP_igrr
Posts: 2072
Joined: Tue Dec 01, 2015 8:37 am

Re: Proper way to init phy_init and NVS?

Postby ESP_igrr » Fri Dec 09, 2016 2:42 am

If you have selected an option "Use a partition to store PHY init data", then PHY init binary will be generated as part of the build process and will be flashed with "make flash" or "make phy_init_data-flash". If that option is not selected, PHY init data will be stored in .rodata of the application, so you don't need to erase anything.

Actually this option for using a partition for PHY init data is designed for manufacturers who need to provide different init data based on region, but with single application binary for all regions.

Regarding NVS, it should be able to initialize with any random data present in flash. If you want to make sure it doesn't contain any data, writing an empty 0xff binary to the location of NVS would indeed work.

rojer9
Posts: 17
Joined: Mon Dec 14, 2015 10:45 pm
Contact:

Re: Proper way to init phy_init and NVS?

Postby rojer9 » Fri Dec 09, 2016 10:24 am

ah, so there is an option to generate PHY data. i'll use it then.

i want "miot flash" to bring device to a known clean slate, so i think i'll erase NVS just to be sure.

thank you, gentlemen!

ESP_igrr
Posts: 2072
Joined: Tue Dec 01, 2015 8:37 am

Re: Proper way to init phy_init and NVS?

Postby ESP_igrr » Fri Dec 09, 2016 11:53 am

Well, PHY init data is always generated... In one case the object file with this data is linked into the application directly. In another case it is dumped as binary, and flashed to some location. I think most applications can use the default (don't place phy init data into partition, link it into application), which is just harder to get wrong.

zizoalbert
Posts: 7
Joined: Tue Jan 03, 2017 10:11 am

Re: Proper way to init phy_init and NVS?

Postby zizoalbert » Mon Jan 16, 2017 9:29 am

Hello,
I have a question about phy_init partition:
How can we get the factory configuration of this phy_init partition ?
Best wishes

ESP_igrr
Posts: 2072
Joined: Tue Dec 01, 2015 8:37 am

Re: Proper way to init phy_init and NVS?

Postby ESP_igrr » Mon Jan 16, 2017 10:41 am

Select "Use a partition to store PHY init data" in menuconfig, then run

make phy_init_data

Output file will be in build/phy_init_data.bin.

To flash just this file, run

make phy_init_data-flash

This file is also generated if you just run "make", and is flashed to the ESP32 if you run "make flash".

patakil
Posts: 8
Joined: Thu Apr 12, 2018 11:32 am

Re: Proper way to init phy_init and NVS?

Postby patakil » Fri Nov 05, 2021 7:51 pm

ESP_igrr wrote:
Fri Dec 09, 2016 2:42 am
If you have selected an option "Use a partition to store PHY init data", then PHY init binary will be generated as part of the build process and will be flashed with "make flash" or "make phy_init_data-flash". If that option is not selected, PHY init data will be stored in .rodata of the application, so you don't need to erase anything.

Actually this option for using a partition for PHY init data is designed for manufacturers who need to provide different init data based on region, but with single application binary for all regions.

Regarding NVS, it should be able to initialize with any random data present in flash. If you want to make sure it doesn't contain any data, writing an empty 0xff binary to the location of NVS would indeed work.


Could you please explain more about which case should CONFIG_ESP32_PHY_INIT_DATA_IN_PARTITION be enabled, and how will the esp-idf include region-specific init data? Will it check the host PC for the region?
We are going to release our product in multiple regions (US, EU, APAC) and I am wondering if I need this option to be enabled and take any further actions to meet the region-specific RF standards?

https://www.espressif.com/sites/default ... ide_en.pdf
https://www.esp32.com/viewtopic.php?t=1020
I found here more information. I can see now that if I want to save power I can fine-tune the radio however, I am more interested in the region-specific use case, which you explained above.

Thank you

Who is online

Users browsing this forum: No registered users and 76 guests