I tried with this piece of code modelled after code I used previously and is also mentioned at https://www.espruino.com/ESP8266 to update my 'blue' ESP8266 ESP-01:
// ESP01BridgeOnPixl2.js
// PixlJS plays the role of USB-SERIAL to talk to ESP8266
//
// setup for update ESP8266
//
// Pixl - ESP8266 ESP-01
//
// Pixl Color ESP8266 Run Pgm
// (ESP-01) Mode3 Mode1
// -----------------------------------
// RX D0 - YEL - UTXD
// TX D1 - BLU - URXD
// GND - BLK - GND
// 3.3V - RED - VCC
// D8 - WHT - RST H H
// D9 - BRN - GPIO0 H|F L
// D10 - GRN - GPIO2 H H
// D11 - ORG - CH_PD H|3.3 H|3.3
//
// *F=Float, 3.3=3.3V,
// H/L w/ Resistor to rail or MC pin
//
// see https://www.espruino.com/WiFi
// Advanced ESP8266 Reflashing:
// install MacOS xcode and python 3.8+ and pip
// (curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py)
// install esptool (python3 -m pip install esptool) into current dir
// browse https://www.espruino.com/files/ and download required
// ESP8266 firmware into current dir; latest for ESP-01:
// https://www.espruino.com/files/ESP8266_AT25-SDK112-512k.bin
// execute folloing cmd value in terminal window in current dir
var cmd=`
python3 ./esptool.py --chip esp8266 --no-stub \\
--port /dev/cu.Bluetooth-Incoming-Port \\
write_flash --flash_mode dio 0 ESP8266_AT25-SDK112-512k.bin
`;
function onInit() {
pinMode(D8 ,"output"); D8.set();
pinMode(D9 ,"output");
pinMode(D10,"output");
pinMode(D11,"output");
// Setup serial
Serial1.setup(74880,{rx:D0,tx:D1});
// Bridge Serial and Bluetooth
Serial1.on('data',d=>Bluetooth.write(d));
Bluetooth.on('data',d=>Serial1.write(d));
// boot module in bootloader mode
digitalWrite(D10, 1); // GPIO2
digitalWrite(D8 , 0); // RST reset...
digitalWrite(D8 , 1); // ...reset
digitalWrite(D11, 0); // CH_PD make sure WiFi starts off
digitalWrite(D9 , 0); // GPIO0 into boot mode
digitalWrite(D11, 1); // CH=PD turn on wifi
console.log("Now disconnect IDE and exec this command in termianl:");
console.log(cmd);
LoopbackA.setConsole();
}
setTimeout(onInit,9999);
This is the console output, indicating that connection does not happen. I'm not sure about the port - I used /dev/cu.Blue... and /dev/tty.Blue... - but both fail the same way:
Console output:
>
ets Jan 8 2013,rst cause:1, boot mode:(1,0)
Now disconnect IDE and exec this command in termianl:
python3 ./esptool.py --chip esp8266 --no-stub \
--port /dev/tty.Bluetooth-Incoming-Port \
write_flash --flash_mode dio 0 ESP8266_AT25-SDK112-512k.bin
Prompt not detected - upload failed. Trying to recover...
Terminal (McaOS) output:
$ python3 ./esptool.py --chip esp8266 --no-stub \
> --port /dev/tty.Bluetooth-Incoming-Port \
> write_flash --flash_mode dio 0 ESP8266_AT25-SDK112-512k.bin
esptool.py v3.1-dev
Serial port /dev/tty.Bluetooth-Incoming-Port
Connecting........_____....._____....._____....._____....._____....._____....._____
A fatal error occurred: Failed to connect to ESP8266: Timed out waiting for packet header
$
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.
@Gordon / @user118421,
I tried with this piece of code modelled after code I used previously and is also mentioned at https://www.espruino.com/ESP8266 to update my 'blue' ESP8266 ESP-01:
This is the console output, indicating that connection does not happen. I'm not sure about the port - I used /dev/cu.Blue... and /dev/tty.Blue... - but both fail the same way:
Console output:
Terminal (McaOS) output: