tinygo-org / tinygo

Go compiler for small places. Microcontrollers, WebAssembly (WASM/WASI), and command-line tools. Based on LLVM.
https://tinygo.org
Other
14.77k stars 865 forks source link

Wifi support for ESP32/ESP8266? #2024

Open Technerder opened 2 years ago

Technerder commented 2 years ago

I recently stumbled upon this project and was thrilled to see that some basic features such as I2C and SPI were supported on the ESP32/ESP8266. Are there any plans to support Wifi on the chips and if so when can we expect to see a bare/basic implementation in the main code base?

aykevl commented 2 years ago

I would absolutely love to see WiFi/BT support on these chips! However, it's going to be difficult because it doesn't have a lot of documentation. I've ordered an ESP32C3 which I want to try to add WiFi support to. Specifically the ESP32C3 because it uses the well documented RISC-V architecture instead of the sparsely documented (if at all) Xtensa architecture in the original ESP32. So my idea is that it should be a lot easier for that reason and when that works, I can use that knowledge for the original ESP32.

I can't give you a time for when it will be finished, like I can't give you a time for when anything will be finished. Sorry.

gedw99 commented 2 years ago

New hardware news

Is Rica-v based

https://www.reddit.com/r/homeautomation/comments/owzpou/espressif_to_release_new_esp32h2_microcontroller/?utm_source=share&utm_medium=ios_app&utm_name=iossmf

direct link : https://www.espressif.com/en/news/ESP32_H2

Dorbmon commented 2 years ago

I hope too...

scroot commented 2 years ago

i am also hoping for this...

wlwatkins commented 2 years ago

any update on this?

aykevl commented 2 years ago

Yes, please follow #2138 and https://github.com/tinygo-org/drivers/pull/320.

l1f commented 1 year ago

thank you @aykevl for your work! Are there any updates on this?

ngandalf commented 1 year ago

is there any news about wifi support on esp8266 / esp32 ?

conotto commented 1 year ago

You would be better off using ESP-AT firmware on your ESP and control it with something well supported like RP2040 (yes, i realize thats 2 chips but at least you can have something that works now). ESP8266/ESP32/ESP32-S2 are no longer actively developed or supported by Espressif, they now only recommend using ESP32-C2/C3 chips.

This is what i ended up doing.

ericmigi commented 1 year ago

@conotto I would love to chat about how you solved this - any chance you could DM me on twitter.com/ericmigi or send me an email (username@gmail.com)?

CrazyPandar commented 1 year ago

I found an ESP wifi driver, maybe this helps.

https://github.com/esp-rs/esp-wireless-drivers-3rdparty

aykevl commented 1 year ago

@CrazyPandar yes that's what we should use (see https://github.com/tinygo-org/drivers/pull/320#issuecomment-1284080185).

DatanoiseTV commented 1 year ago

In rust, this was implemented: https://github.com/esp-rs/esp-wifi Maybe this could be adopted to TinyGo?

aykevl commented 1 year ago

@DatanoiseTV yes, see my comment above (which links to https://github.com/tinygo-org/drivers/pull/320#issuecomment-1284080185). TL;DR: we should indeed use https://github.com/esp-rs/esp-wireless-drivers-3rdparty. But that's a lot of work and nobody has stepped up to do it yet.

pcting commented 4 months ago

what would be the process of integrating the esp-wireless-drivers-3rdparty code? i could give it a try, but i don't have much embedded experience. are we talking about linking in the .a files and generating go code to wrap functions in the c header files using cgo?

aykevl commented 4 months ago

@pcting please follow this PR instead: https://github.com/tinygo-org/drivers/pull/650 Once the ESP32-C3 is implemented, we could take a look at supporting the ESP32/ESP8266 but those are going to be a lot more work because they also need Xtensa interrupt support. I spent a few days trying to get Xtensa interrupt support working at some point, but gave up on it.

I recommend following the ESP32-C3 work.