Dobrica Pavlinušić's random unstructured stuff
esp8089: Revision 13
use [esp8266] module over sdio on [cubieboard] as wifi card

{toc: }

^ links

https://hackaday.io/project/8678-rpi-wifi-hat
https://github.com/al177/esp8089

^ setup

^^ cubieboard pinout

.pre
root@cubieboard:/home/dpavlin# cat mmc3-sdio.txt
22 PI4 2 1 2 [mmc mmc3] SCD3_CMD
24 PI5 2 1 2 [mmc mmc3] SCD3_CLK
26 PI6 2 1 2 [mmc mmc3] SCD3_D0
28 PI7 2 1 2 [mmc mmc3] SCD3_D1
30 PI8 2 1 2 [mmc mmc3] SCD3_D2
32 PI9 2 1 2 [mmc mmc3] SCD4_D3
.pre

^^ ESP-201 pinout from top

.pre
15 IO0 13 IO15
14 IO2 12 IO13
18 D2 GPIO9 10 IO12
21 CLK GPIO6 9 IO14
20 CMD GPIO11 8 XPD GPIO16
22 D0 GPIO7 7 CHIP_EN
23 D1 GPIO8 32 RST
19 D3 GPIO10 6 TOUT ADC
16 IO4 24 IO5
3.3V GND
3.3V GND
.pre

^^ CH_EN mapping to GPIO pin

.pre
PE4 "132" => "PE4", -> CHIP_EN

root@cubieboard:/home/dpavlin/linux-gpio-pinout# modprobe esp8089 esp_reset_gpio=132 # PE4
[Sun Jun 30 19:19:24 2019]
***** EAGLE DRIVER VER:bdf5087c3deb*****

[Sun Jun 30 19:19:24 2019] ESP8089 reset via GPIO 132
[Sun Jun 30 19:19:35 2019] esp_sdio_init ------ RETRY ------
[Sun Jun 30 19:19:35 2019] ESP8089 reset via GPIO 132
[Sun Jun 30 19:19:35 2019] ESP8089 reset via GPIO 132
[Sun Jun 30 19:19:46 2019] esp_sdio_init ------ RETRY ------
[Sun Jun 30 19:19:46 2019] ESP8089 reset via GPIO 132
[Sun Jun 30 19:19:47 2019] ESP8089 reset via GPIO 132
[Sun Jun 30 19:19:58 2019] esp_sdio_init ------ RETRY ------
[Sun Jun 30 19:19:58 2019] ESP8089 reset via GPIO 132
[Sun Jun 30 19:19:58 2019] ESP8089 reset via GPIO 132
[Sun Jun 30 19:20:09 2019] esp_sdio_init ------ RETRY ------
[Sun Jun 30 19:20:09 2019] ESP8089 reset via GPIO 132
modprobe: ERROR: could not insert 'esp8089': No such device
[Sun Jun 30 19:20:10 2019] eagle sdio can not power up!

.pre

^ additional components

https://hackaday.io/project/8678-rpi-wifi/details

missing 200 ohm resistors on sdio lines

4.7k pullup on CH_PD https://github.com/al177/esp8089/issues/4

rpi needs dtoverlay=sdio,poll_once=false

it's still not clear to me do I have to remove spi flash or not

newer project with simpler overview

* https://hackaday.io/project/12980-pi2wifi
* https://sites.google.com/site/mincepi/pi2wifi

it suggests 33 ohm resistors on sdio, includes dts overlay)

https://hackaday.io/project/8678/instructions also suggest 33 ohm resistors...

^ clear the QE (quad enable) bit in the sreg2 of a W25Q40BV or similar

https://github.com/jacksonliam/rpi-bitbang-spiflash

^ bootloader

^^ setup boudrate to 74880

https://gist.githubusercontent.com/sentinelt/3f1a984533556cf890d9/raw/8a35958138b1167fce5c2301a73e2fe06aeb08d8/gistfile1.c

You have to first open terminal in some valid baud rate, and then force new speed for port with:

.pre
dpavlin@cubieboard:~/anybaud$ ./anyboud /dev/ttyS1 74880
Changed successfully.
.pre

^^ IO15 -> 3V3

My guess from espressif powerpoint this is sdio boot mode (and it's wrong)

.pre
ets Jan 8 2013,rst cause:1, boot mode:(7,7)

waiting for host
.pre

^^ IO15 -> GND

This is correct way to force SDIO mode, serial output is:

.pre
ets Jan 8 2013,rst cause:1, boot mode:(3,7)

load 0x40100000, len 31020, room 16

ets Jan 8 2013,rst cause:1, boot mode:(3,7)
.pre

It seems that esp tries to load first part, but fails and kernel module toggle CH_PD and resets it.
Time to try soldering resistors between 200 and 33 ohms I guess...