Skip to content

Conversation

@sylvioalves
Copy link
Contributor

This PR is part of the #29394.

It adds support for ESP32 WiFI SoC.

Note: Zephyr has no support yet for non-offloaded wifi. Once we have support for it, we shall integrate.

Closes #3723.

@github-actions
Copy link

github-actions bot commented Feb 8, 2021

The following projects have a revision update in this Pull Request:

Name Old Revision New Revision
hal_espressif zephyrproject-rtos/hal_espressif@416ae58 zephyrproject-rtos/hal_espressif@1610702 (zephyr)

Note: This message is automatically posted and updated by the Manifest GitHub Action.

@sylvioalves sylvioalves force-pushed the feature/wifi_support branch 4 times, most recently from bde7b2c to b863887 Compare February 8, 2021 14:43
@sylvioalves sylvioalves force-pushed the feature/wifi_support branch 3 times, most recently from cac0be4 to ff4520c Compare February 8, 2021 20:32
@zephyrbot zephyrbot added area: Wi-Fi Wi-Fi area: Xtensa Xtensa Architecture labels Feb 9, 2021
@zephyrbot zephyrbot requested a review from Kludentwo February 9, 2021 12:36
@sylvioalves
Copy link
Contributor Author

@mniestroj PTAL

@sylvioalves
Copy link
Contributor Author

sylvioalves commented Feb 24, 2021

@carlescufi @tbursztyka ok, make sense. @rlubos, I'll wait some input from you as well before moving ahead. Thanks.
Perhaps renaming the base folder do espressif and subfolders with device specific is also a good approach.

@mniestroj
Copy link
Member

  • drivers/wifi/esp/ (already in tree) is a offloaded network driver for any Zephyr platform, which is connected over UART to ESP chip hosting ESP-AT firmware.
  • drivers/wifi/esp32/ (submitted here) is a network driver that will run natively on esp32 chip.

There will be no shared code between both drivers. Maybe we should move drivers/wifi/esp/ to drivers/wifi/esp-at/ to make space for native driver introduced in this PR?

@rlubos
Copy link
Contributor

rlubos commented Feb 24, 2021

Well, we don't have exactly the same case in the tree yet (unless I miss something), the closest I could find is the eswifi which have to implementations - one utilizing socket offloading and other using net offloading. But in this case the drivers share some common sources, the socket offloading is optional (https://github.com/zephyrproject-rtos/zephyr/blob/master/drivers/wifi/eswifi/CMakeLists.txt#L22).

Since the implementations are separate here IMO the cleanest would be to move them into some subdirectories under drivers/wifi/esp and then have top level Kconfig with a general menuconfig WIFI_ESP switch and a choice WIFI_ESP_MODE to select between WIFI_ESP_NATIVE and WIFI_ESP_OFFLOADED. Based on the selection, the appropriate subdirectory could be added in the CMakeLists.txt. This should have minimal impact on the existing and new code/Cmake files/Kconfig files.

@sylvioalves
Copy link
Contributor Author

Well, we don't have exactly the same case in the tree yet (unless I miss something), the closest I could find is the eswifi which have to implementations - one utilizing socket offloading and other using net offloading. But in this case the drivers share some common sources, the socket offloading is optional (https://github.com/zephyrproject-rtos/zephyr/blob/master/drivers/wifi/eswifi/CMakeLists.txt#L22).

Since the implementations are separate here IMO the cleanest would be to move them into some subdirectories under drivers/wifi/esp and then have top level Kconfig with a general menuconfig WIFI_ESP switch and a choice WIFI_ESP_MODE to select between WIFI_ESP_NATIVE and WIFI_ESP_OFFLOADED. Based on the selection, the appropriate subdirectory could be added in the CMakeLists.txt. This should have minimal impact on the existing and new code/Cmake files/Kconfig files.

I am ok with this approach.
I'll PR this in here and we can continue discussing any necessary modifications.

@mniestroj
Copy link
Member

Since the implementations are separate here IMO the cleanest would be to move them into some subdirectories under drivers/wifi/esp and then have top level Kconfig with a general menuconfig WIFI_ESP switch and a choice WIFI_ESP_MODE to select between WIFI_ESP_NATIVE and WIFI_ESP_OFFLOADED. Based on the selection, the appropriate subdirectory could be added in the CMakeLists.txt. This should have minimal impact on the existing and new code/Cmake files/Kconfig files.

I don't agree about choosing driver "mode" over Kconfig. Those are two different drivers, for two different platforms. One is utilizing ESP chip connected over UART, the other runs natively on ESP. The offloaded driver doesn't even need to communicate with ESP (can be any other WiFi capable chip), as long as the other end is implementing all the AT commands documented (implemented) in ESP-AT interface.

So I would consider two possibilities:

  1. use drivers/wifi/esp-at/ and drivers/wifi/esp32/ (I opt for that),
  2. use drivers/wifi/esp/at/ and drivers/wifi/esp/esp32/, both should be supported simultaneously, without any Kconfig "choice".

@rlubos
Copy link
Contributor

rlubos commented Feb 24, 2021

Those are two different drivers, for two different platforms. One is utilizing ESP chip connected over UART, the other runs natively on ESP.

This sheds some new light on the topic, thanks. Based on the previous discussion I had an impression we talk about two variants of a driver for ESP chip, just integrated with the network stack at a different level. But from what you say, the offloaded driver can run on any device with ESP connected over UART/SPI, right? @tbursztyka @carlescufi Based on this feedback, do you still think it makes sense to "merge" the two drivers?

@sylvioalves
Copy link
Contributor Author

sylvioalves commented Feb 24, 2021

@mniestroj great point. If adding as Kconfig option, it should be possible to use both simultaneously as each one implements different stuff.
If option 1 (use drivers/wifi/esp-at/ and drivers/wifi/esp32/ (I opt for that)) is the way, we won't have to change this PR regarding that.

@mniestroj
Copy link
Member

But from what you say, the offloaded driver can run on any device with ESP connected over UART/SPI, right?

Right. Currently only UART, but potentially could be other bus as well.

If option 1 (use drivers/wifi/esp-at/ and drivers/wifi/esp32/ (I opt for that)) is the way, we won't have to change this PR regarding that.

Correct. I can rename s/esp/esp-at/ if others agree that is the way to go.

@mniestroj
Copy link
Member

@tsvehagen Including you into discussion, as the original author of ESP offloaded driver.

@carlescufi
Copy link
Member

@tbursztyka @carlescufi Based on this feedback, do you still think it makes sense to "merge" the two drivers?

No, I don't. I think that the proposal by @mniestroj makes sense.

@nandojve
Copy link
Member

Since I use this to keep some infrastructure in subsys, I would like to mention that agreed with @mniestroj proposal.

@sylvioalves
Copy link
Contributor Author

@mahavir, PTAL

@sylvioalves sylvioalves force-pushed the feature/wifi_support branch 2 times, most recently from 443346a to 2dc61ab Compare February 25, 2021 15:29
@sylvioalves sylvioalves requested a review from nandojve February 25, 2021 16:27
shubhamkulkarni97 and others added 2 commits February 25, 2021 15:29
add support for esp32 wifi

Signed-off-by: Shubham Kulkarni <shubham.kulkarni@espressif.com>
add esp32 wifi station  board example

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
Copy link
Member

@nandojve nandojve left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the dtsi file as suggest by @galak.

Great!

@nashif nashif merged commit 7fe8b71 into zephyrproject-rtos:master Feb 25, 2021
@sylvioalves sylvioalves deleted the feature/wifi_support branch February 25, 2021 23:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

WiFi support for ESP32