-
1Step 1
For ESP8266
Populate R1, R2, R3, R4, R5 and R6. DON'T populate R7 or R14.Populate R13 to use GPIO6 for CH_EN.
R8 is an optional 10K pullup for RST, as only using the internal pullup can lead to stability issues.
For Power, C1 0.1uf and C8 10uf should always be populated. If using the RPi's 3V3 supply put a wire / jumper across the two pin header at the bottom. If using a regulator populate the SOT223 (e.g. with AMS1117 or LD1117S33) and populate C6 10uf and C7 0.1uf.
For Audio
The audio uses GPIO12 and GPIO13 to which you need to remap PWM0/PWM1 (see below).
You probably want to use components with good tolerances here unless you don't care about audio quality. Although it might not matter as not much care was taken with the routing, its just an easy 'add on'.Populate R9,R10 with 270R. C2,C3 with 33nf. R11, R12 with 150R. C4, C5 with 10uf. Then populate the PJ313D audio jack.
The two BAV99 SOT23 dual diodes are protection for the RPi's GPIO and are optional but very strongly recommended as its a few cheap diodes vs a potentially dead Pi. -
2Step 2
Software
Place this at the end of your /boot/config.txtdtoverlay=sdio,poll_once=off
Reboot.
-
3Step 3
Building the Driver
Install prerequisite packages on Raspbian to build the kernel.
#make sure everything is up to date sudo apt-get update && sudo apt-get -y upgrade #install tools sudo apt-get -y install bc rpi-update git libncurses5-dev
Get the kernel headers
cd ~ sudo wget https://raw.githubusercontent.com/notro/rpi-source/master/rpi-source -O /usr/bin/rpi-source && sudo chmod +x /usr/bin/rpi-source && /usr/bin/rpi-source -q --tag-update rpi-source --skip-gcc
If this bug isn't fixed https://github.com/notro/rpi-source/issues/17 then modify ./linux/Makefile and remove the line that reads
EXTRAVERSION = +
(line 4). Then create a new file in the ./linux directory called.scmversion
with just a+
character in it.Clone and install the ESP8089 driver.
cd ~ git clone https://github.com/al177/esp8089.git cd esp8089 make sudo make install
Then reboot. The module should come up and give you a wlan0 interface!
-
4Step 4
Rebooting
When you reboot the pi without removing power you may need to reset the esp8266. You can do this using the GPIO pin that you wired up to CH_EN (probably GPIO6)
echo 6 > /sys/class/gpio/export echo low > /sys/class/gpio/gpio6/direction echo high > /sys/class/gpio/gpio6/direction
If you need to reload the module without rebooting the pi, unload the driver first or it gets very upset.
sudo modprobe -r esp8089
-
5Step 5
Remapping Audio
Just add this to the bottom of /boot/config.txt
dtoverlay=pwm-2chan,pin=12,pin2=13,func=4,func2=4
You can force 3.5mm audio output (instead of hdmi) using raspi-config or by running
amixer cset numid=3 1
0=auto, 1=3.5mm, 2=hdmiTest it
wget http://www.freespecialeffects.co.uk/soundfx/sirens/police_s.wav sudo aplay police_s.wav
-
6Step 6
Debugging
Check
dmesg
For a line that reads:
mmc1: new high speed SDIO card at address 0001
Thats confirmation that your module is at least being read. If you're not getting an interface after this is probably because the driver is not being loaded.You can also try the below to check the ESP8266 is identifying as you'd expect.
sudo cat /sys/kernel/debug/mmc1/ios clock: 50000000 Hz actual clock: 41666666 Hz vdd: 21 (3.3 ~ 3.4 V) bus mode: 2 (push-pull) chip select: 0 (don't care) power mode: 2 (on) bus width: 0 (1 bits) timing spec: 2 (sd high-speed) signal voltage: 0 (3.30 V)
andpi@raspberrypi:~ $ cat /sys/bus/sdio/devices/mmc1\:0001\:1/modalias sdio:c00v6666d1111
-
7Step 7
1 bit mode
You shouldn't need to use 1 bit mode, 4 bit mode should just work without removing the flash. So you can skip this step. I've left it here in-case you really want to use it this way.
If you want /HOLD asserted on the flash populate R7 (you may want to put a value there, e.g. 200R). Don't populate R3 or R4.
If using 1 bit mode you can re use GPIO27 as the enable pin for the
ESP8266 so populate R14. Otherwise populate R13 and use GPIO6.If you're going to use the 1 bit mode you'll need the latest sdio device tree overlay. (this PR https://github.com/raspberrypi/linux/pull/1255).
sudo rpi-update sudo reboot
Should bring it to you if you don't have it.
The easiest way to check is to read /boot/overlays/README andcheck if the sdio section has the bus_width parameter.
1 bit mode users must include the bus width parameter in their sdio overlay params.
dtoverlay=sdio,poll_once=off,bus_width=1
1 Bit-mode users also need to clear the QE bit in the SPI flash's register. Otherwise the flash will ignore the HOLD pin. I have a simple python script here to enable you to do that. Just download and run it. Ideally put the ESP8266 to sleep first (e.g. GPIO27 or GPIO6 low).
echo 6 > /sys/class/gpio/export echo low > /sys/class/gpio/gpio6/direction
https://github.com/jacksonliam/rpi-bitbang-spiflash
wget https://raw.githubusercontent.com/jacksonliam/rpi-bitbang-spiflash/master/progflash.py sudo python progflash.py
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.
Thanks a lot, your way works !!! (ZERO + ESP-12F)
Earlier I tried the option oshlab.com/esp8266-raspberry-pi-gpio-wifi - it does not work, there is a clk and a strobe, but there is no data on the SD0-3 bus, not at all, not a single pulse.
Are you sure? yes | no