ESP01 MicroPython install

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
User avatar
Roberthh
Posts: 1311
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: ESP01 MicroPython install

Post by Roberthh » Fri Sep 23, 2016 6:54 pm

OK. Are you sure it's an 1 MByte flash chip? It should say 25Q80 on the 8 pin device.
You can also read out chip ID and flash ID:
esptool.py -p /dev/ttyUSB0 chip_id
esptool.py -p /dev/ttyUSB0 flash_id

kodefoo
Posts: 10
Joined: Wed Sep 21, 2016 3:56 am

Re: ESP01 MicroPython install

Post by kodefoo » Fri Sep 23, 2016 7:23 pm

Another observation is that it looks like the ESP01 I have is not really 1MB. I downloaded an arduino sketch to check this and this is what it gave me.

Flash real id: 001340C8
Flash real size: 524288

Flash ide size: 524288
Flash ide speed: 40000000
Flash ide mode: DIO
Flash Chip configuration ok.

Is the firmware too big to load?

Thanks.

User avatar
Roberthh
Posts: 1311
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: ESP01 MicroPython install

Post by Roberthh » Fri Sep 23, 2016 7:41 pm

Indeed. The firmware is too big. you could try to opt out some thing in esp8266/mpconfigport.h. But then you have to install the suite for building the SW.
You could try to load an older version. I succeeded in loading version 1.8 onto a 512k ESP01. It has no file system, but shows a stable REPL prompt.

kodefoo
Posts: 10
Joined: Wed Sep 21, 2016 3:56 am

Re: ESP01 MicroPython install

Post by kodefoo » Fri Sep 23, 2016 8:21 pm

Well it looks like we have success. I ran the following
C:\>esptool -pCOM6 -b115200 write_flash --flash_mode dio --verify --flash_size 4m 0 esp8266-20160503-v1.8.bin
esptool.py v1.1
Connecting...
Running Cesanta flasher stub...
Flash params set to 0x0200
Writing 495616 @ 0x0... 495616 (100 %)
Wrote 495616 bytes at 0x0 in 42.1 seconds (94.1 kbit/s)...
Leaving...
Verifying just-written flash...
Verifying 0x789aa (493994) bytes @ 0x00000000 in flash against esp8266-20160503-v1.8.bin...
-- verify OK (digest matched)

Then I connected via putty @ 115200.

could not open file 'main.py' for reading

#3 ets_task(401002fc, 3, 3fff5180, 4)
MicroPython v1.8-3-gcf139c6 on 2016-05-03; ESP module with ESP8266
Type "help()" for more information.
>>> print('OMG it worked!')
OMG it worked!
>>>

I DID flash v1.8 last night, but I was using a different flash mode and flash size. I guess Addicore modules are not consistent. That is disappointing. I was hoping they were 1MB so I could do more experimenting. I am still excited to play with the ESP01 now and then I can look at getting a larger board for an actual project.

Special thanks to RobertHH and kfricke for the advice and assistance!

User avatar
Roberthh
Posts: 1311
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: ESP01 MicroPython install

Post by Roberthh » Sat Sep 24, 2016 3:28 am

For a board, try Wemos D1. It's affordable and convenient to use.

lajthabalazs
Posts: 6
Joined: Thu Jan 12, 2017 8:13 pm

Re: ESP01 MicroPython install

Post by lajthabalazs » Thu Jan 12, 2017 8:34 pm

I got into some trouble installing micro python to a board that is allegedly a Wemos D1 Pro. When I connected to it through USB, a factory default application was outputting the available WiFi networks in a loop, so something was working.

I'm using 32 bit python 3.6 on a 64 bit Windows 10 laptop. I connect the board to an USB port, receive address COM6.

esptoo.py v1.3
Chip ID: 0x002c16a4
Flash ID: ef 4018 (16Mbytes)

When I run
python esptool.py -p COM6 write_flash --flash_mode dio --flash_size=16m --verify 0 esp8266-20170108-v1.8.7.bin

Everything goes smoothly:

Connecting....
Running Cesanta flasher stub...
Flash params set to 0x0230
Wrote 589824 bytes at 0x0 in 51.1 seconds (92.3 kbit/s)...
Leaving...
Verifying just-written flash...
Flash params set to 0x0230
Verifying 0x8f3cc (586700) bytes @ 0x00000000 in flash against esp8266-20170108-v1.8.7.bin...
-- verify OK (digest matched)

Blue LED flashes, progress goes up to 100% and verification is successful.
However when I try to verify the content of the flash:
python esptool.py -p COM6 verify_flash --flash_size=16m 0x00000000 esp8266-20170108-v1.8.7.bin

I get an error:

Connecting....
Running Cesanta flasher stub...
Flash params set to 0x0030
Verifying 0x8f3cc (586700) bytes @ 0x00000000 in flash against esp8266-20170108-v1.8.7.bin...
-- verify FAILED (digest mismatch)

A fatal error occurred: Verify failed.

There is a difference in Flash params set to line, in first instance it's 0x0230, in second, it's 0x0030, I don't know if it means anything.

I read the content of the flash with read_flash, compared it with a binary diff tool, and look identical.

When I try to access the device with Putty, random characters are flashing, tried it with every usual baud rate from 9600 to 921600, nothing made sense. When I disconnect Putty, the blue led on the Wemos continues blinking. Doesn't stop after pressing Reset, or disconnecting. Stops after I perform any operation with esptool.

Is my board faulty? How could I troubleshoot the issue? Any help is appreciated.

lajthabalazs
Posts: 6
Joined: Thu Jan 12, 2017 8:13 pm

Re: ESP01 MicroPython install

Post by lajthabalazs » Thu Jan 12, 2017 8:48 pm

Read up on some troubleshooting on esptool wiki, and found that I have to add flash_mode dio option for verification:
python esptool.py -p COM6 verify_flash --flash_size=16m --flash_mode dio 0 esp8266-20170108-v1.8.7.bin

Now it's verifying correctly:

esptool.py v1.3
Connecting....
Running Cesanta flasher stub...
Flash params set to 0x0230
Verifying 0x8f3cc (586700) bytes @ 0x00000000 in flash against esp8266-20170108-v1.8.7.bin...
-- verify OK (digest matched)

But problem remains, I cannot access the device through putty, and can't detect the MicroPython-xxxxxx WiFi network.

torwag
Posts: 206
Joined: Fri Dec 13, 2013 9:25 am

Re: ESP01 MicroPython install

Post by torwag » Thu Jan 12, 2017 9:01 pm

Hi,
different things to try.
Did you erase the flash prior of flashing. This is sometimes needed. You can do this with the esptool too.
Did you make sure you had the correct settings in putty 115200 baud 8N1?
What means exactly you can't connect? It does not connect at all, or does it only show garbage output?
What happen if you press the reset button during connection?
Are you sure it is still COM6, Windows is a bit on the stupid side here and sometimes start to increase e.g. to COM7

Hope this gives some ideas.

lajthabalazs
Posts: 6
Joined: Thu Jan 12, 2017 8:13 pm

Re: ESP01 MicroPython install

Post by lajthabalazs » Thu Jan 12, 2017 11:50 pm

Thank you for getting back to me so fast.
I erased the flash every time before attempting to flash something. Based on my last try, flashing was successful, at least verification says so.

COM6 is still the port of the device, checked in device manager, and also this is the port that esptool connects to.

I double checked Putty, baud rate is set to 115200, and I have 8 data + 1 stop bit in Serial configuration.

When I'm starting Putty connection, I get half a line of flashing characters, I tried printscreening it, it's mostly wierd characters, but found bp[some weird character]lrlr and b[two weird characters]nn[wc]l[2*wc]l' several times. With different baud rates I get different result, sometimes it fills the screen, sometimes it's just a couple of lines.

I tried the reset thing, for a brief moment the stream stops, but then starts again.

While I'm connected through Putty, esptool refuses connection with "Access denied".

When I disconnect Putty, and run an esptool command, serial communication stops, and I get a proper response.

I'll try another image.

lajthabalazs
Posts: 6
Joined: Thu Jan 12, 2017 8:13 pm

Re: ESP01 MicroPython install

Post by lajthabalazs » Fri Jan 13, 2017 12:31 am

I reverted to python 2.7 - just in case. I tried a nodeMCU image, also tried NodeMCU pyflasher. Tried qio instead of dio as flash_mode. All with the same outcome.

There was one point, when, during a NodeMCU pyflasher session I got impatient and connected to the serial port with putty. I got a message about formatting file system, but otherwise the same thing over and over again.

Interesting thing: https://www.wemos.cc/verify_products tells me my chip doesn't exits ( 0x002c16a4).

Post Reply