ESP IoT pHAT Flashing


#1

Hi,

I have found some quite interesting firmware that I would like to get onto the ESP IoT pHAT if possible. Here is a link to the firmware:

There is a python utility that can be used to flash the firmware available here:

I have tried it but it does not connect. I suspect this is because the ESP8266 isn’t in a flash-able state which can only be achieved by having the GPIO 0 pin of the ESP8266 grounded when reset.

Can you provide any instructions as to how this can be achieved? or at lease let us know what Pi GPIO pins are mapped to what ESP8266 pins.

Cheers,

Mike :)


#2

Hi Mike! You’re absolutely correct, we’re working on a learning portal article to cover this. :-)

The two pins you’ll need to toggle are:

  • BCM#17 is connected to RESET
  • BCM#27 is connected to GPIO0

Hopefully you know what to do with that information already, if not watch this space for an article!


#3

I have managed to get the ESP ready by executing the following python:

import RPi.GPIO as GPIO

GPIO.setmode(GPIO.BCM) # set board mode to Broadcom

GPIO.setwarnings(False)

GPIO.setup(17, GPIO.OUT)
GPIO.setup(27, GPIO.OUT)

GPIO.output(27, 0)
GPIO.output(17, 1)
GPIO.output(17, 0)

but when I try out the esptool (just trying to get something before I attempt a flash) the following happens:

Maybe I will wait for your instructions ;)


#4

While I was tinkering I used the following command (requires wiringPi to be installed!):

gpio write 2 0; gpio write 0 0; sleep 1; gpio write 0 1; python esptool.py -p /dev/ttyAMA0 -b 115200 write_flash 0x00 firmware.bin

This will all be wrapped up in some helpers we’re working on longer term!


#5

so you’d pull GPIO 0 down low first then high (with a pause in between)?


#6

@RogueM that command is using wiringPi (which has it’s own pin numbering).

The toggled pin (wiringPi #0) is to reset the ESP8266 and the other pin is to put it into programming mode, the sleep is belt and braces and far longer than should be necessary. :-)


#7

oh, yeah I realise that, I meant that @mikehole is pulling GPIO 17 high then low, rather than the other way around, which is the problem I suspect. And, yeah, I realise it got confusing when I decided to take shortcuts in expressing the pin numbering system ;-)


#8

Bingo! I was leaving the ESP GPIO low (so the light on the board stayed on)

Next step flashing :)


#9

Hurrah! What firmware are you going to use?


#10

ESP Link:

It’s on and connected to my WiFi…


#11

Sweet! Let us know how you get on. :-)

If you wanted to do a little write-up of the process we could put it up on the Learning Portal. :-)


#12

Sure will!

Now this is cool, turn the console back on and bingo there it is:


#13

So the bad news is that I can not now get the ESP8266 back into a flashing mode :/ I wanted to try some of my own binaries but each time I try to flash anything it doesn’t connect


#14

Can you paste your full flashing command here and the output?


#15

Just remembered that I turned the console back on to show off the console via the web. So switched it off again and all working.

Apologies for wasting time sure you all have better things to do!


#16

Just glad you figured it out! An easy gotcha that one. :-)


#17

Actually while we are at it do you know what firmware the pHAT comes with? I have tried to get this one https://github.com/espressif/ESP8266_AT but once flashed I can’t get anything out od minicom.

Here is the command used to flash:

gpio write 2 0; gpio write 0 0; sleep 1; gpio write 0 1; python …/esptool/esptool.py -p /dev/ttyAMA0 -b 115200 write_flash -fs 32m -ff 80m 0x00000 boot_v1.1.bin 0x1000 user1.bin 0x7C000 esp_init_data_default.bin 0x7E000 blank.bin


#18

this is the firmware info a ESP-IoT pHAT gives me out of the box:

AT version:0.40.0.0(Aug 8 2015 14:45:58)
SDK version:1.3.0
Ai-Thinker Technology Co.,Ltd.
Build:1.3.0.2 Sep 11 2015 11:48:04

which I ~think~ is this one:


but @jon has to confirm.


#19

If I can find a thread about compiling on Windows I will be rocking :s


#20

Cygwin on Windows should give you the tools?

disclaimer: I am a complete n00b when it comes to the ESP8266, don’t take ~anything~ I say on the subject with any degree of reliability, just suggestions with a possible, if coincidental, value!