Hi,
We have one requirement in which we need to either turn off WiFi Radio if it's working and on and turn on WiFi Radio if it's in OFF state but it should not create any impact or effect to running application core functionality. As I know that there are two separate cores into ESP32 chip in which one core is for Application core which is specific for tasks and application etc while another core is for WIFI/BLE core in which WiFi and BLE Radios are running.
So, does it possible to turn off WiFi Radio while module is running into AP mode or STA mode?
If yes then please provide me sample code or examples to do it something like that
Need API to turn off WiFi Radio which is in separate core
Need API to turn off WiFi Radio which is in separate core
Regards,
Ritesh Prajapati
Ritesh Prajapati
Re: Need API to turn off WiFi Radio which is in separate core
If you need to maintain the WiFi connection then the "modem sleep" mode is probably want you want. I just mentioned it in a reply to you on another post:
http://esp32.com/viewtopic.php?f=13&t=770
If you want to disable WiFi permanently, you can set the mode to NULL:
You can call this from any task, it's managed by the RTOS and therefore thread-safe. However when you re-enable the WiFi it will need to reestablish the AP connection, get an IP address, etc. Modem sleep mode is much less disruptive.
http://esp32.com/viewtopic.php?f=13&t=770
If you want to disable WiFi permanently, you can set the mode to NULL:
Code: Select all
esp_wifi_set_mode(WIFI_MODE_NULL);
esp-idf runs an SMP RTOS environment so the division of cores is more flexible than this. You can run application code on both cores, or you can pin tasks (like "threads" or in a full-size OS) to a particular core if necessary. RTOS primitives (queues, semaphores, etc.) allow communciation between tasks on different CPUs. The WiFi APIs are implemented like this.Ritesh wrote:As I know that there are two separate cores into ESP32 chip in which one core is for Application core which is specific for tasks and application etc while another core is for WIFI/BLE core in which WiFi and BLE Radios are running.
Re: Need API to turn off WiFi Radio which is in separate core
Hi, As I have checked into ESP32-IDF RTOS API and found that they have provided APIs to enter module into light sleep and deep sleep mode but not found any modem sleep enum to switch into that mode.ESP_Angus wrote:If you need to maintain the WiFi connection then the "modem sleep" mode is probably want you want. I just mentioned it in a reply to you on another post:
http://esp32.com/viewtopic.php?f=13&t=770
If you want to disable WiFi permanently, you can set the mode to NULL:You can call this from any task, it's managed by the RTOS and therefore thread-safe. However when you re-enable the WiFi it will need to reestablish the AP connection, get an IP address, etc. Modem sleep mode is much less disruptive.Code: Select all
esp_wifi_set_mode(WIFI_MODE_NULL);
esp-idf runs an SMP RTOS environment so the division of cores is more flexible than this. You can run application code on both cores, or you can pin tasks (like "threads" or in a full-size OS) to a particular core if necessary. RTOS primitives (queues, semaphores, etc.) allow communciation between tasks on different CPUs. The WiFi APIs are implemented like this.Ritesh wrote:As I know that there are two separate cores into ESP32 chip in which one core is for Application core which is specific for tasks and application etc while another core is for WIFI/BLE core in which WiFi and BLE Radios are running.
Do you have e any idea or any information for that?
My aim is to turn off WiFi Radio whenever required and turned it ON back whenever required from application core.
Let me know your feedback or suggestions for that..
Regards,
Ritesh Prajapati
Ritesh Prajapati
Re: Need API to turn off WiFi Radio which is in separate core
Might the API called esp_wifi_start() and esp_wifi_stop() be used in this case? I haven't seen any state diagrams but these sound like they will dynamically switch on and off WiFi. I have to guess that after a call to esp_wifi_stop(), there won't be any radio transmissions or receptions.
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32
Re: Need API to turn off WiFi Radio which is in separate core
The call for modem sleep mode is esp_wifi_set_ps(), although (sorry I missed this yesterday) it's not yet supported in the esp-idf WiFi libraries (support will be added soon):Ritesh wrote:Hi, As I have checked into ESP32-IDF RTOS API and found that they have provided APIs to enter module into light sleep and deep sleep mode but not found any modem sleep enum to switch into that mode.
http://esp-idf.readthedocs.io/en/latest ... _ps_type_t
As mentioned in my previous reply, the critical difference is whether you want to maintain WiFi association (either from ESP32 STA to the AP, or from other STAs tothe ESP32 AP) while the WiFi radio is turned off.Ritesh wrote: My aim is to turn off WiFi Radio whenever required and turned it ON back whenever required from application core.
If the answer is yes, the answer is modem sleep support once it becomes available.
If the answer is no, you can use the suggestions earlier in this thread (esp_wifi_start()/esp_wifi_stop() or esp_wifi_set_mode()) to disable/enable the entire WiFi stack. When you re-enable the radio it will need to reassociate with the access point.
Who is online
Users browsing this forum: No registered users and 270 guests