Looking at IDF v5.2.1 and beyond: with the rearchitected Netif component and the sequence of creating an Ethernet or a Wifi stack, was wondering based on documentation and examples (which only create one or other type of network stack):
Is there now a way to demolish e.g. Ethernet-based Netif instance and switch to (create and use) a Wifi stack without complete reboot and starting from scratch with another type of network? In old IDF versions there was no real possibility to do this (from memory, some tried and had memory leaks and heavier issues).
Although there are new/destroy, init/deinit pairs of netif APIs, many others (attaching driver etc.) don't seem to have counterparts to demolish cleanly, with no memory leaks etc. the stack. Footnote is that IDF5.2.x documentation makes remark about deinit not being supported yet - therefore, probably not possible to cleanly demolish things?
So whilst we could try it, the fact that no examples exist and couldn't find explicit mentions of this makes me wonder - hence any tips hugely appreciated, thank you.
Switching between Ethernet and Wifi without reboot
Re: Switching between Ethernet and Wifi without reboot
Hi there,
I realise this is a very old post, but does anyone have any information on whether this is possible. I need to do the same thing - ideally testing for a "good" ethernet connection at startup, and if not present then switching to Wifi.
The library function esp_netif_deinit still says not supported. The wifi example uses the esp_netif_destroy function, but I'm not sure if need to deinitialise first to be safe.
Thanks!
I realise this is a very old post, but does anyone have any information on whether this is possible. I need to do the same thing - ideally testing for a "good" ethernet connection at startup, and if not present then switching to Wifi.
The library function esp_netif_deinit still says not supported. The wifi example uses the esp_netif_destroy function, but I'm not sure if need to deinitialise first to be safe.
Thanks!
Re: Switching between Ethernet and Wifi without reboot
Hi ocpseq,
yes, it's possible for your particular use case. It's true that `esp_netif_deinit` is still not supported but you don't need to de-initialize the "netif" since you are going to use it for the WiFi interface. You just need to destroy Ethernet related "netif" instance.
For full Ethernet de-initialization sequence, please refer to https://github.com/espressif/esp-idf/bl ... ain.c#L215 Just remove `esp_netif_deinit()`. Right now it does not have any effect but it could have any in the future. Since you will need to use netif for WiFi, it's not intended to be deinit.
Regards,
Ondrej
yes, it's possible for your particular use case. It's true that `esp_netif_deinit` is still not supported but you don't need to de-initialize the "netif" since you are going to use it for the WiFi interface. You just need to destroy Ethernet related "netif" instance.
For full Ethernet de-initialization sequence, please refer to https://github.com/espressif/esp-idf/bl ... ain.c#L215 Just remove `esp_netif_deinit()`. Right now it does not have any effect but it could have any in the future. Since you will need to use netif for WiFi, it's not intended to be deinit.
Regards,
Ondrej
Re: Switching between Ethernet and Wifi without reboot
Hi Ondrej,
thank you for clarifying this, I wasn't sure whether the call to destroy would be sufficient to allow me to reuse.
So once I have done that, I should be able to initialise wifi (e.g. as per wifi_init_sta() in https://github.com/espressif/esp-idf/bl ... ple_main.c), but just leave out the call to esp_netif_init()? (As there is a note in ethernetInit() example saying this function should only be called once in application.)
Kind regards,
Oliver.
thank you for clarifying this, I wasn't sure whether the call to destroy would be sufficient to allow me to reuse.
So once I have done that, I should be able to initialise wifi (e.g. as per wifi_init_sta() in https://github.com/espressif/esp-idf/bl ... ple_main.c), but just leave out the call to esp_netif_init()? (As there is a note in ethernetInit() example saying this function should only be called once in application.)
Kind regards,
Oliver.
Who is online
Users browsing this forum: dmaxben, Semrush [Bot] and 10 guests
