*** NOTE *** Baudrate: Use 74880 where ever 76800 is used! (2020-11-16)
To get something going, I started out on the https://www.espruino.com/ESP8266 page. The regular test code that connects to the module and then to my local wireless LAN threw only something like ...no ready after reset in my face. Reading up hinted Espruino module or baud rate. Module change did not help. So I used the code to discover the baud rate... this though did not help either...
Since it did not talk back at all in this baud rate discovery code - I got empty string back for all of the listed baud rates, I wondered if really nothing comes back or the discovery code is just not up to task. Several actions I took:
I packed the discovery code into an onInit() called 1 second after upload completion.
I connected theESP8266 TX and connected it to a free pin on pico and added a watch on it:
function gLED(e) { digitalWrite(LED2,e.state); }
setWatch(gLED,B8,{repeat:true, edge:"both", debounce:0});
I delayed the sending of the AT+GMR\r\n call by 100[ms] after the reset
Now got something going... right after the reset to the point where I got input buffer overrun.
In other words the module was not dead... the baud rate discover had the reset short coming... sending code with different baud rate without reset did not produce anything but empty string. With the reset I god information, but still all gibberish... When I initially worked on the module a couple years ago, I had used an oscilloscope and figured empirically by just looking at the signals that there was a baud rate of something 76400... searching around, I notice that others encountered 76800. Therefore I added this baud rate as well to the list of others.
Now I got something legible back... proper mode - 3 - but other than that, not very nice: very old version of firmware... something like ...ets Jan 8 2013, rst cause:2, boot mode:(3,7)...
I tried now - with 'proper' baud rate different versions of the ESP8266 module with no success... all failed with something like ...no ready after reset....
To get more information, I updated python from 2.7.5 to 2.7.15 and got the esptool in python installed from https://github.com/espressif/esptool - I would need it anyway for updating - and I did some reading using PICO as the mediator - or - USB to Serial. This is the modified 'bridge' code i used:
// ESP09BridgeOnPico.js
// (c)20181026 allObjects
// PICO plays the role of USB-SERIAL to talk to ESP8266
var serial = Serial2;
function onInit() {
var r = (typeof toBootLoader == "undefined")
? true
: ! toBootLoader;
console.log((r)?"run":"boot");
digitalWrite(B9,1); // CH_PD: H
digitalWrite(A1,r); // GPIO0: L - load / H|float - run
digitalWrite(A10,0); // pulse reset RST
digitalWrite(A10,1);
// -------------------------
serial.setup(76800, { rx: A3, tx : A2 });
serial.on('data', function(d) { USB.write(d); });
USB.on('data', function(d) { serial.write(d); });
Serial1.setConsole();
}
var toBootLoader = true;
setTimeout(onInit,1000);
In bootloader mode, esptool could read the chip_id and flash_id. The chip_id showed ES8266 as expected, but the memory showed 8Mbit - 1MB.
$ python2 ../esptool/esptool.py --port /dev/cu.usbmodem1421 chip_id
esptool.py v2.6-beta1
Serial port /dev/cu.usbmodem1421
Connecting...
Detecting chip type... ESP8266
Chip is ESP8266EX
Features: WiFi
MAC: 18:fe:34:9c:15:3b
Uploading stub...
Running stub...
Stub running...
Chip ID: 0x009c153b
Hard resetting via RTS pin...
$
and
$ python2 esptool.py -p /dev/cu.usbmodem1421 flash_id
esptool.py v2.6-beta1
Serial port /dev/cu.usbmodem1421
Connecting...
Detecting chip type... ESP8266
Chip is ESP8266EX
Features: WiFi
MAC: 18:fe:34:9c:15:3b
Uploading stub...
Running stub...
Stub running...
Manufacturer: ef
Device: 4014
Detected flash size: 1MB
Hard resetting via RTS pin...
It took though always two attempts after a power connect. The first choked in the esptool on the double listing of the USB to Serial device /dev/cu.usbmodem1421 in OSX (only bottom of the stack trace shown):
...
...
File "/usr/local/lib/python2.7/site-packages/serial/serialposix.py", line 501, in read
'device reports readiness to read but returned no data '
I usually connect to the second one... so I tried the first one, and it got worse: python claimed that the device would be busy and cannot be opened and read from...
...
...
File "/usr/local/lib/python2.7/site-packages/serial/serialposix.py", line 268, in open
raise SerialException(msg.errno, "could not open port {}: {}".format(self._port, msg))
serial.serialutil.SerialException: [Errno 16] could not open port /dev/cu.usbmodem1421: [Errno 16] Resource busy: '/dev/cu.usbmodem1421'
python2 ../esptool/esptool.py --port /dev/cu.usbmodem1421 \
> write_flash --flash_freq 40m --flash_mode qio --flash_size 8m \
> 0x0000 "boot_v1.4(b1).bin" 0x1000 512+512/user1.1024.new.2.bin \
> 0xfc000 esp_init_data_default.bin 0x7e000 blank.bin 0xfe000 blank.bin
------ (second attempt):
WARNING: Flash size arguments in megabits like '8m' are deprecated.
Please use the equivalent size '1MB'.
Megabit arguments may be removed in a future release.
esptool.py v2.6-beta1
Serial port /dev/cu.usbmodem1421
Connecting...
Detecting chip type... ESP8266
Chip is ESP8266EX
Features: WiFi
MAC: 18:fe:34:9c:15:3b
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Flash params set to 0x0020
Compressed 2752 bytes to 2006...
Wrote 2752 bytes (2006 compressed) at 0x00000000 in 0.3 seconds (effective 81.2 kbit/s)...
Hash of data verified.
Compressed 278676 bytes to 202043...
Wrote 278676 bytes (202043 compressed) at 0x00001000 in 26.7 seconds (effective 83.4 kbit/s)...
Hash of data verified.
Compressed 128 bytes to 76...
Wrote 128 bytes (76 compressed) at 0x000fc000 in 0.0 seconds (effective 57.1 kbit/s)...
Hash of data verified.
Compressed 4096 bytes to 26...
Wrote 4096 bytes (26 compressed) at 0x0007e000 in 0.0 seconds (effective 3014.5 kbit/s)...
Hash of data verified.
Compressed 4096 bytes to 26...
Wrote 4096 bytes (26 compressed) at 0x000fe000 in 0.0 seconds (effective 2984.9 kbit/s)...
Hash of data verified.
Leaving...
Hard resetting via RTS pin...
After successful flashing, I was still not successful to connect to the device... same error: ....no ready after RST...
My last shot was now something a first for me: put Espruino on a non-Espruino board... something I was always discouraging people to do, because ESP8266 is just not the right setup... Taking the combined binary and ignoring the extra 512KB in the ESP-09 vs the ESP-01, I successfully could flash the ESP-09 - of course - as Murphy wants to be part of the game - only the second attempt was successful:
python2 ../esptool/esptool.py --port /dev/cu.usbmodem1421 write_flash --flash_freq 40m --flash_mode qio --flash_size 8m 0x0000 espruino_2v00_esp8266_combined_512.bin
WARNING: Flash size arguments in megabits like '8m' are deprecated.
Please use the equivalent size '1MB'.
Megabit arguments may be removed in a future release.
esptool.py v2.6-beta1
Serial port /dev/cu.usbmodem1421
Connecting...
Detecting chip type... ESP8266
Chip is ESP8266EX
Features: WiFi
MAC: 18:fe:34:9c:15:3b
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Flash params set to 0x0020
Compressed 524288 bytes to 324783...
Wrote 524288 bytes (324783 compressed) at 0x00000000 in 43.0 seconds (effective 97.6 kbit/s)...
Hash of data verified.
Leaving...
Hard resetting via RTS pin...
Too lazy to dig up a USB-Serial cable, I switched my Espruino Bridge on PICO to run mode and loaded the bridge - w/ 76800 talking to ESP-09: Great... for the begin... bad gibberish at the end:
There is still some gibberish... until Espruino in ESP-09 switches to 115200, and logo and everything shows nice... Going back to my baud rate discovery shows that some stuff comes in at 76800 and then Espruino switches baud rate to 115200.
Next step is really getting this USB-Serial cable out... to test the Wifi part... of course, I could manually load the modules through the console... but that's not fun.
I still hope to be able to get back and just drop ESP on ESP-09 rather than Espruino. May be I should have listened to the comment on the espressif page with the AT 0.50.0.0 download - see screenshot.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
*** NOTE *** Baudrate: Use
74880
where ever 76800 is used! (2020-11-16)To get something going, I started out on the https://www.espruino.com/ESP8266 page. The regular test code that connects to the module and then to my local wireless LAN threw only something like ...no ready after reset in my face. Reading up hinted Espruino module or baud rate. Module change did not help. So I used the code to discover the baud rate... this though did not help either...
Since it did not talk back at all in this baud rate discovery code - I got empty string back for all of the listed baud rates, I wondered if really nothing comes back or the discovery code is just not up to task. Several actions I took:
onInit()
called 1 second after upload completion.I connected theESP8266 TX and connected it to a free pin on pico and added a watch on it:
I added a reset - A01 on RST:
I delayed the sending of the
AT+GMR\r\n
call by 100[ms] after the resetNow got something going... right after the reset to the point where I got input buffer overrun.
In other words the module was not dead... the baud rate discover had the reset short coming... sending code with different baud rate without reset did not produce anything but empty string. With the reset I god information, but still all gibberish... When I initially worked on the module a couple years ago, I had used an oscilloscope and figured empirically by just looking at the signals that there was a baud rate of something 76400... searching around, I notice that others encountered 76800. Therefore I added this baud rate as well to the list of others.
This is the final discovery code:
Now I got something legible back... proper mode - 3 - but other than that, not very nice: very old version of firmware... something like
...ets Jan 8 2013, rst cause:2, boot mode:(3,7)...
I tried now - with 'proper' baud rate different versions of the ESP8266 module with no success... all failed with something like
...no ready after reset...
.To get more information, I updated python from 2.7.5 to 2.7.15 and got the esptool in python installed from https://github.com/espressif/esptool - I would need it anyway for updating - and I did some reading using PICO as the mediator - or - USB to Serial. This is the modified 'bridge' code i used:
In bootloader mode, esptool could read the chip_id and flash_id. The chip_id showed ES8266 as expected, but the memory showed 8Mbit - 1MB.
and
It took though always two attempts after a power connect. The first choked in the esptool on the double listing of the USB to Serial device
/dev/cu.usbmodem1421
in OSX (only bottom of the stack trace shown):I usually connect to the second one... so I tried the first one, and it got worse: python claimed that the device would be busy and cannot be opened and read from...
Now I was looking for updating the ESP8266 ESP-09 module... and found the 0.50 - declared old by espressif, but tested by @Gordon... - https://bbs.espressif.com/viewtopic.php?f=46&t=1123
After successful flashing, I was still not successful to connect to the device... same error:
....no ready after RST...
My last shot was now something a first for me: put Espruino on a non-Espruino board... something I was always discouraging people to do, because ESP8266 is just not the right setup... Taking the combined binary and ignoring the extra 512KB in the ESP-09 vs the ESP-01, I successfully could flash the ESP-09 - of course - as Murphy wants to be part of the game - only the second attempt was successful:
Too lazy to dig up a USB-Serial cable, I switched my Espruino Bridge on PICO to run mode and loaded the bridge - w/ 76800 talking to ESP-09: Great... for the begin... bad gibberish at the end:
A via 9600 baud to 115200 got my bridge working and I can see Espruino on ESP-09:
There is still some gibberish... until Espruino in ESP-09 switches to 115200, and logo and everything shows nice... Going back to my baud rate discovery shows that some stuff comes in at 76800 and then Espruino switches baud rate to 115200.
Next step is really getting this USB-Serial cable out... to test the Wifi part... of course, I could manually load the modules through the console... but that's not fun.
I still hope to be able to get back and just drop ESP on ESP-09 rather than Espruino. May be I should have listened to the comment on the espressif page with the AT 0.50.0.0 download - see screenshot.
1 Attachment