Skip to content

WiFi support for ESP32 #3723

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
zephyrbot opened this issue Jun 16, 2017 · 40 comments · Fixed by #32081
Closed

WiFi support for ESP32 #3723

zephyrbot opened this issue Jun 16, 2017 · 40 comments · Fixed by #32081
Labels
Feature Request A request for a new feature platform: ESP32 Espressif ESP32

Comments

@zephyrbot
Copy link
Collaborator

zephyrbot commented Jun 16, 2017

Reported by Leandro Pereira:

WiFi support requires binary blobs that currently assumes it's running on FreeRTOS. Figure out a way to use them on Zephyr.

(Imported from Jira ZEP-2288)

@zephyrbot zephyrbot added priority: medium Medium impact/importance bug area: Xtensa Xtensa Architecture Enhancement Changes/Updates/Additions to existing features labels Sep 23, 2017
@nashif nashif added Feature A planned feature with a milestone Feature Request A request for a new feature and removed Enhancement Changes/Updates/Additions to existing features Feature A planned feature with a milestone labels Oct 20, 2017
@lpereira lpereira removed their assignment May 18, 2018
GautierAtWork added a commit to GautierAtWork/zephyr-pub that referenced this issue Jun 8, 2018
Recent ESP-IDF provides OS-agnostic wifi binary, needed by zephyrproject-rtos#3723

Closes zephyrproject-rtos#8240

Signed-off-by: Gautier Seidel <[email protected]>
nashif pushed a commit that referenced this issue Jun 13, 2018
Recent ESP-IDF provides OS-agnostic wifi binary, needed by #3723

Closes #8240

Signed-off-by: Gautier Seidel <[email protected]>
@nashif nashif added platform: ESP32 Espressif ESP32 and removed area: Xtensa Xtensa Architecture labels Sep 21, 2018
@locomuco
Copy link
Contributor

locomuco commented Nov 1, 2018

for anybody who's interested, here is a application that can compile the ESP wifi lib against zephyr, but still quite a long way to go getting wifi running

@galak
Copy link
Collaborator

galak commented Nov 1, 2018

Adding reference to the #10539

@lpereira
Copy link
Collaborator

lpereira commented Nov 1, 2018

@galak #10539 is unrelated to @locomuco's application -- ESP8266 in that PR is being used as an external chip, running its stock firmware, rather than running Zephyr and driving the radio itself.

@nashif nashif added this to the unspecified milestone Feb 14, 2019
@mchodzikiewicz
Copy link

Hi, it's been a while... are there any updates on this?

@nashif nashif removed this from the future milestone May 21, 2019
@MarcDorner
Copy link

Hi, is there any update on the topic or further information how the status is?

@nashif nashif removed the priority: medium Medium impact/importance bug label Sep 5, 2019
@Skallwar
Copy link

There was some code to do this back when I was working on it, and some people actually made it work, but I don't know what's the status of it

Are we talking of this PR ?

@lpereira
Copy link
Collaborator

lpereira commented Jun 30, 2020 via email

@Skallwar
Copy link

That seems to be it, yeah.

Any idea why this has never been merged ?

Once this is working -- you probably want to add ESP32 support in mcuboot, too, to act as the second stage bootloader

The esp-idf bootloader is not sufficient ?

it should be trivial to hook up the ESP32 WiFi blob with Zephyr's network stack, IIRC.

Is it really a blob ? From what I see here it looks like no, but you maybe referring to something else ?

@lpereira
Copy link
Collaborator

The ESP-IDF bootloader could be used as a starting point, yes, but I think that the ideal situation for Zephyr would be using mcuboot so that the Zephyr tooling could be used.

You have to link with the blobs provided in https://github.com/espressif/esp32-wifi-lib (the "lib" directory is a git submodule pointing to this repo).

@locomuco
Copy link
Contributor

locomuco commented Jul 1, 2020

@Skallwar

https://github.com/locomuco/zephyr-esp32

this was the follow up to the previously mentioned PR, it was able to enable flash cache and link in the Wifi Blob, it's outdated, but might give good hints in the single commits

@Skallwar
Copy link

Skallwar commented Jul 15, 2020

The ESP-IDF bootloader could be used as a starting point, yes

I can not boot the hello world example with it, the boot is stuck at boot: Disabling RNG early entropy source... after loading the app. Beside on larger project, the app contains too much segments (here, segment = elf section) and the app will not be loaded.

I will maybe try to work on mcuboot

@nashif nashif removed their assignment Aug 4, 2020
@mahavirj
Copy link
Contributor

Update:

Feature branch that has functional networking (WiFi) on ESP32 can be found here.

Technical details:

  • This is still based on 2nd stage bootloader from ESP-IDF which does required flash cache setup for XIP enabled application
  • This feature branch has appropriate west manifest file to pick up correct base ESP-IDF repository (based on v4.2 version)
  • Toolchain should be based on revision xtensa-esp32-elf-gcc (crosstool-NG esp-2020r2) 8.2.0
  • All networking application should be functional, just that prj.conf should be added with credentials for WiFi network using CONFIG_WIFI_SSID="myssid" and CONFIG_WIFI_PASSWORD="mypassword"

Official PR (from Espressif) will still take some time but interim please feel free to give this a try and report any issues or feedback.

CC @ExtremeGTX @Skallwar @GautierAtWork

@lpereira
Copy link
Collaborator

lpereira commented Sep 24, 2020 via email

@chrta
Copy link
Collaborator

chrta commented Oct 13, 2020

@mahavirj I tried to test your branch but failed, because the path to the source files in https://github.com/mahavirj/zephyr/blob/feature/esp32_networking_support_on_zephyr_v2.4.0-rc1/drivers/wifi/esp32/CMakeLists.txt#L69 did not match the correct paths in my esp-idf module (I used west and one manual git submodule update --init in esp-idf module). Maybe i did something wrong.
Could you describe the steps necessary to test your branch (especially how to get the correct esp-idf and what variables to set)?

@mahavirj
Copy link
Contributor

@chrta

Could you describe the steps necessary to test your branch (especially how to get the correct esp-idf and what variables to set)?

Please find instructions here. Let me know if you face any issues.

@chrta
Copy link
Collaborator

chrta commented Oct 14, 2020

Please find instructions here. Let me know if you face any issues.

Great, thank you. Now i could proceed a little bit further. My previous error was that i used the wrong hal (the old one not named espressif).
Now i am facing the next issue with the python modules that are required (when i execute "west build"). I am using Ubuntu 20.04 and the build step fails because the necessary python modules are not installed. I try to install them from the requirements.txt file from the hal, but that did not work either.
Can you add instructions how to install the required python modules, or what venv to use when executing the "west build" step?

Maybe you can enable the issues in your github fork and we can continue the discussion there? I do not want to spam this issue too much.

@mahavirj
Copy link
Contributor

Maybe you can enable the issues in your github fork and we can continue the discussion there?

Done. I have also reached out you on slack channel, in case that is faster.

@chrta
Copy link
Collaborator

chrta commented Oct 14, 2020

Just for reference: It works now, after fixing some python issues on my pc and applying espressif/esp-idf@96cfdf3 to esp-idf. Thank you @mahavirj for your support.

@timdesi
Copy link

timdesi commented Nov 5, 2020

@mahavirj i could confirm that WiFi on ESP32 works with your branch. Thx.

@vtothsvk
Copy link

vtothsvk commented Nov 16, 2020

Hi @mahavirj
I was trying out the WiFi support for ESP32 and encountered the following issue: each time I build an app and try to flash it I get an error pointing that no bootloader.bin is present in the build (also no partitions file is generated as well). Tried the CONFIG_BOOTLOADER_ESP_IDF=y option as well, still no bootloader was built.
Opened an issue on your repo as well about it.

@ExtremeGTX
Copy link
Collaborator

ExtremeGTX commented Nov 16, 2020

@vtothsvk I have this issue also on Windows 10, but you can use Linux for now if you want to try the wifi support.
I will try to find a fix for this issue.

@mahavirj
Copy link
Contributor

@ExtremeGTX FYI, fix for this is available here. We will ensure that this is part of PR for WiFi support on ESP32.

@beriberikix
Copy link

@mahavirj thanks for the updates! Is there an official PR yet for us to follow?

@mahavirj
Copy link
Contributor

@beriberikix Sorry for delayed reply, baseline PR is here #30424. Subsequent work will be based on this, it is waiting on more approvals and final merge.

@Nithyasrikannathal
Copy link

Please find instructions here. Let me know if you face any issues.

Great, thank you. Now i could proceed a little bit further. My previous error was that i used the wrong hal (the old one not named espressif). Now i am facing the next issue with the python modules that are required (when i execute "west build"). I am using Ubuntu 20.04 and the build step fails because the necessary python modules are not installed. I try to install them from the requirements.txt file from the hal, but that did not work either. Can you add instructions how to install the required python modules, or what venv to use when executing the "west build" step?

Maybe you can enable the issues in your github fork and we can continue the discussion there? I do not want to spam this issue too much.

how did you resolve the python isuue?

@Nithyasrikannathal
Copy link

@chrta

Could you describe the steps necessary to test your branch (especially how to get the correct esp-idf and what variables to set)?

Please find instructions here. Let me know if you face any issues.

I am facing a new issue which says that " C:/Users/NFI2KOR/zephyr3wifi/modules/hal/espressif/components/esp_timer/src/esp_timer_impl_frc_legacy.c:141:1: error: unknown type name 'portMUX_TYPE'
portMUX_TYPE s_time_update_lock = portMUX_INITIALIZER_UNLOCKED;
^~~~~~~~~~~~
C:/Users/NFI2KOR/zephyr3wifi/modules/hal/espressif/components/esp_timer/src/esp_timer_impl_frc_legacy.c:141:35: error: 'portMUX_INITIALIZER_UNLOCKED' undeclared here (not in a function)
portMUX_TYPE s_time_update_lock = portMUX_INITIALIZER_UNLOCKED;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~"
I gave west update . It gave error
" updating hal_espressif (modules/hal/espressif):
--- hal_espressif: fetching, need revision master"
fatal: couldn't find remote ref master
HEAD is now at 143df6755 CMakeLists.txt: make BL2 configurable
ERROR: update failed for project hal_espressif

Initially when i got this error i just cloned the https://github.com/mahavirj/hal_espressif inside the espressif folder. but i guess there is a issue

@WilliamGFish
Copy link
Collaborator

@Nithyasrikannathal
You may find that if you refresh the repo the issue goes away, there has been a number of changes in the Wi-Fi area.
Billy..

@Nithyasrikannathal
Copy link

@Nithyasrikannathal You may find that if you refresh the repo the issue goes away, there has been a number of changes in the Wi-Fi area. Billy..

Thanks for the reply. Can you please link the changes made or the updated thing? ?

@WilliamGFish
Copy link
Collaborator

@Nithyasrikannathal You may find that if you refresh the repo the issue goes away, there has been a number of changes in the Wi-Fi area. Billy..

Thanks for the reply. Can you please link the changes made or the updated thing? ?

If you look at the recently closed pull requests re wifi; you will see a number of changes to the shell which has had a knock on effect with many wifi drivers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Request A request for a new feature platform: ESP32 Espressif ESP32
Projects
None yet
Development

Successfully merging a pull request may close this issue.