Chat freely about anything...

User avatar
By kolban
#35209 With the announcement of the Pi Zero in the last few days, I am very excited by the prospect. However, I note that it has no WiFi built in. I got to thinking that maybe we could attach an ESP8266 through the interface pins of the Pi Zero and write a kernel driver for Linux to drive the ESP8266. I suggest this as Linux already has a TCP/IP stack and we really don't want to invent or use private protocols (eg. serial AT) to interact with the partner board. If my theory holds, then, in principle, we could leverage the radio transmission (or related) protocols that are expected by the higher level TCP/IP stack in Linux and fire those through GPIO / SPI / I2C to an app flashed on the ESP8266 that would drive its appropriate low level components.

Does anyone know of any projects already going down this route ... the last thing I want to do is suggest another and would much rather join one that is already in flight.
User avatar
By kolban
#35217 @netstat,
That is indeed cool ... however, not quite what I had in mind. If I am understanding that instructable properly, it would allow Pi written applications to write AT serial commands to the ESP8266. While that is goodness ... imagine all the existing Pi based applications ... let us take for example a simple TCP program ... "ftp". The ftp application allows one to copy files to a remote FTP server. Under the covers, it uses the TCP/IP stack that is native on Linux to perform its requests. It knows nothing about ESP8266 nor does it know anything about AT command. It expects to use Sockets APIs such as:

* socket
* connect
* send
* close

to send data to a partner.

Now, within a Linux kernel, the TCP/IP stack eventually has to drive real hardware. For a Pi, that is either an Ethernet driver or a WiFi dongle ... and both of these have device drivers to provide a hardware abstraction layer. If we could do the job properly, we could electrically connect some GPIOs from a Pi to GPIOs on an ESP8266 such that signals from the Pi could be received by code running in the ESP8266. These signals could then drive the ESP8266 network layers (probably at the LWIP level). In addition, if we had a Linux device driver that "knew" how to drive the Pi GPIOs corresponding to Linux TCP stack requests, then the TCP/IP access from Pi through Linux through an ESP8266 device driver through Pi GPIO writes through ESP8266 firmware reads through ESP8266 radio transmissions .... would be transparent.

The result would be (in principle) that every Linux application that uses TCP/IP today would "just work".

Now if all this sounds like rocket science, I believe that if we had a group of folks who know Linux device driver writing, LWIP TCP/IP stack, Pi GPIO and ESP8266 programming ... it could be done. I think this may even be considered "business as usual".
User avatar
By bbx10node
#35226 A company in the UK is building a small expansion board (pHAT in Pi parlance) with an ESP8266 connected to the Pi Zero via UART ports. But there is no indication what firmware will be running in the ESP. It is not a shipping product so no telling when it will be available in the US. But it is easy enough to connect the UART ports an ESP dev board and regular Pi. I am not one of the lucky ones to get a Pi Zero but it mostly works like a regular Pi with the same expansion connector.

http://www.recantha.co.uk/blog/?p=13778

The advantage of using the ESP for WiFi is it keeps the Pi USB port available for something else such as BlueTooth. A disadvantage is UARTs are slow compared to SPI.

Does the ESP SDK support PPP/SLIP over UART and routing packets between PPP interface and WiFi interface? If so, it should be possible to bring up a PPP/SLIP connection over UARTs. And maybe over SPI. I might be able to help with this but am not a Linux kernel driver guru. But bringing up Linux PPP and routing does not require kernel changes. All can be done via command line utils and config files in /etc. Not sure about the ESP side though.

If I understand correctly, you are suggesting exporting the ESP low-level WiFi interface functions over SPI. This is much harder and might require kernel changes. I do not know much about how this would work.