While we are used to USB WiFi adapters, embedded devices typically use SDIO WiFi cards, and for good reasons – they’re way more low-power, don’t take up a USB port, don’t require a power-sipping USB hub, and the SDIO interface is widely available. However, SDIO cards and modules tend to be obscure and proprietary beyond reason. Enter ESP-Hosted – Espressif’s firmware and driver combination for ESP32 (press release)(GitHub), making your ESP32 into a WiFi module for either your Linux computer (ESP-Hosted-NG) or MCU (ESP-Hosted-FG). In particular, ESP-Hosted-NG his turns your SPI- or SDIO-connected ESP32 (including -S2/S3/C2/C3/C6 into a WiFi card, quite speedy and natively supported by the Linux network stack, as opposed to something like an AT command mode.
We’ve seen this done with ESP8266 before – repurposing an ESP8089 driver from sources found online, making an ESP8266 into a $2 WiFi adapter for something like a Pi. The ESP-Hosted project is Espressif-supported, and it works on the entire ESP32 lineup, through an SDIO or even SPI interface! It supports 802.11b/g/n and even Bluetooth, up to BLE5, either over an extra UART channel or the same SDIO/SPI channel; you can even get BT audio over I2S. If you have an SPI/SDIO port free and an ESP32 module handy, this might just be the perfect WiFi card for your Linux project!
There are some limitations – for instance, you can’t do AP mode in the NG (Linux-compatible) version. Also, part of the firmware has blobs in it, but a lot of the firmware and all of the driver are modifiable in case you need your ESP32 to do even more than Espressif has coded in – this is not fully open-source firmware, but it’s definitely way more than the Broadcom’s proprietary onboard Raspberry Pi WiFi chip. There’s plenty of documentation, and even some fun features like raw transport layer access. Also, of note is that this project supports ESP32-C6, which means you can equip your project with a RISC-V-based WiFi adapter.
Title image from [zhichunlee].
What’s the reason you cannot do AP mode?
Let’s hope that one day someone will come with a free radio stack for the ESP32, those binary blobs makes me sick:
https://zeus.ugent.be/blog/23-24/esp32-reverse-engineering-continued/
no idea why no AP mode – the FG (first generation) part does support it, at least! and, yes, this project is seriously promising!
In fairness, the ESP8089 driver was Espressif-supported too.
I found the original driver in a damp corner of GitHub as part of a Rockchip tablet sdk (damn, has it already been 8 years?!). But at the time it wasn’t advertised or distributed officially by Espressif. Sprite_tm graciously convinced their legal to GPLv2 the host driver code and Apache license the device blob. Even though it never made it into the kernel, a few hacker projects were able to be commercialized because of the permissive license.
There really aren’t any other hacker-accessible wifi network adapters like this without resorting to USB, so I’m glad to see them continue the trend even if the binary blobs make us cringe a bit.
oh hey it’s wonderful to see you here! your work on the driver has powered the ZeroPhone for like, five years? it’s quite impressive ^_^ and thank you so much for the backstory!
Hey! Thank you for all the early testing and feedback on the driver, and for helping keep HaD alive!
Have we come full circle? The esp8266 was meant for adding wifi to other systems. This whole “you can run code on it” has just been an enjoyable diversion it seems. We’re back to using them as wifi chipsets. Lovely!
Came here to say exactly this! Espressif got discovered by the community, people started running code on the processor, and it turned into an embedded platform. Adding WiFi to something else was literally what the things were originally for though!
using a slip via serial interface works pretty well if you don’t need the speed. Its pretty basic. https://github.com/martin-ger/esp_slip_router
Zimodem is also a good one for the at command set.
For a “microcontroller” use, what do you go for? Esp as a wifi module in conjonction with another microcontroller or as a standalone?
I’m having a bit of trouble deciding how much energy I have to put into the espressif ecosystem.
I grew out of the Arduino ecosystem and really hitting the ceilling of what the basic chips can offer in terms of space and more generally performance. I especially got accustomed to their libraries and the ease of use, but got bitten back by assumption made by some of these libraries (defining some interrupt for example) and the way the Arduino framework was written (blocking..).
So I’m in the process of pulling myself out of this framework and go a step further with a more “serious” or at least capable and up to date plateform.
Stm32 family seems to be a very serious contender, bonus point being ARM based. Esp32 very interesting for the whole Bluetooth/wifi.
I feel like there is no point, you choose the platform most suited to the task and write some abstraction for your microcontroller so that if it has to be changed, it easily could.
I still would find interesting how many times do you use an Esp8266 or esp32 (any from the family) as a co processor and in which configuration?
…(blocking..)…
Check out FreeRTOS on the ESP32 (especially the -S3). The learning curve isn’t too steep and you suddenly have two cpu cores to play with.
Oh, and on the “how many times” question… the first time I used an ESP as a coprocessor was pretty much the last, as it was obvious from the start that the ESP was a much better choice for most (but not quite all) things than my micro of choice up until that time.
STM32 is a good choice but if you want to stick with ESP32 if you need WiFi or Bluetooth, you can just use it with their own IDE or VS Code extension which is much better than the Arduino support for it, it allows much better control of what it is doing and is built on FreeRTOS which is worth knowing anyway.
Not too sure about the multi-link documentation line, Arya. Those of us with poorer vision and some colour blindness (me!) might consider it a little bit too “entertaining” to find all of the links in that sentence (hover-and-click mode). :-) Good article though, thanks!
ohhh yeah gotta reconsider this, thank you for letting me know!
“Also, of note is that this project supports ESP32-C6, which means you can equip your project with a RISC-V-based WiFi adapter.”
Is there any reason to care that my wifi adapter runs on a RISC V processor? Someone please sell this to me as if it matters.
Your wallet may care. ESP32-C3 sells in qty 1 for $1 on Digikey, while the original ESP32-D0WD sells for $1.50. Part of that extra $0.50 goes to Cadence for royalties on two Tensilica cores.
I think only the -C6 is RISC-V, though. That one sells for $1.85 at qty 1 on digikey, so price doesn’t appear to be the deciding factor here.
Nope, all of the C-series is RISC-V, as are the P and H series. The only remaining Tensilica arch products are the ESP8266, original ESP32, and ESP32-S series, and even the ESP32-S3 has a RISC-V core for power management. If that wasn’t the case, it would be a miracle that the fleet of ESP32-C3 boards I have is running ESPHome I built with PlatformIO target toolchain-riscv32-esp.
I just think it’s neat, and, there’s a good few people who would think so too, which makes it into a nice feature in line with the RISC-V future
having multiple links in one word, such as in “documentation” is not great from an accessibility standpoint.
It would be ever so sweet if the C6 would support LPWAN in this mode too!
Can you submit that to the upstream kernel?
Add a binary package for a kernel module for all versions of armbian?
More boards other than RPI should benefit from this.
I have a hunch that would require +- widely accessible hardware first, so people better start putting ESPs on their boards!
Is there something like this that operates over the USB transport? It’d be cool to use my spare Xiao modules as USB wifi/BT adapters.