-
-
Light Seeking System
Two photo resistors are positioned on opposite sides of a rectangular beam. It the beam is pointing at a light source both photoresistors produce equal values. If not aligned this balance is upset by the shadow of the beam and the difference in photo resistor output is used to rotate the beam using a stepper motor.
Gnd-- 10k--AnalogInPin--Photoresistor--3.3V
The code
//SeekSun1.js // 7 Mar 2017 // add stepper motor code // 4 Mar 2018 // Uses 2 photoresistors and 10k resistors to provide // two analog inputs // the LED color changes depending on the sign of the // difference between the analog inputs. // // | // pr1----|====pr2 // the vertical bar casts a shadow on the pr // this creates a difference in input values // use this to rotate the assembly so that the // difference in inputs is within the band // Stepper Motor Interface Configuration var action=0; var Step=A8;//LED1;//A8; var Dir=B7; var pp=new Uint8Array(32); // 16 microsteps *2, see BigEasy docs // Photo resistor Configuration var P1=B1; var P2=A7; pp.fill(1); //pulse time in ms pinMode(Step,"output"); pinMode(Dir,"output"); digitalWrite(Step,0); digitalWrite(Dir,0^action); clearInterval(); function move(d){ digitalWrite(Dir,d^action); digitalPulse(Step,0,pp); } var verbose=1;//0;//1; function clog(a){ if(verbose>0)console.log(a); } var band=0.01; pinMode(P1,'analog'); pinMode(P2,'analog'); clog(analogRead(P1)); clog(analogRead(P2)); var a,b,c,d; var sss=""; setInterval(function(){ a=analogRead(P1); b=analogRead(P2); sss=a.toString()+","; sss+=b.toString()+","; sss+=(a-b).toString(); clog(sss); c=a-b; d=c; if(d<0)d=d*-1; if(d<band){ digitalWrite(LED2,0); digitalWrite(LED1,0); //nomotion(); }else{ if(c<0){ digitalWrite(LED1,0); digitalWrite(LED2,1); //rotleft(); move(0); } if(c>0){ digitalWrite(LED2,0); digitalWrite(LED1,1); //rotright(); move(1); } }//end else },1000);
Stepper Motor Stuff
or
BigEasy2or for smaller stepper motors
EasyDriverWiring
Pico Bigeasy
Gnd Gnd
B7 Dir
A8 Step
Powered the BigEasy board with 12V
-
If you use console.log in a program but disconnect the program execution is blocked when the console buffer is full.
For example:
// Console.log blocks LED On/Off flashing when // disconnected var l=0; myinterval=setInterval(function () { digitalWrite(LED1,l=!l); }, 1000); var i=0; setInterval(function(){ console.log(i); i++; },200); // load program // LED is pulsing On an dOff // Console is displaying the count in i // Disconnect the WebIde // The LED action stops // Reconnect the WebIde // Buffered count is displayed // LED resumes action
and the output:
|_| http://espruino.com 1v95 Copyright 2017 G.Williams > =undefined 0 1 2 3 4 5 6 7 8 9 10 11 Disconnected ( the LED stops until reconnected) > 12 13 14 15 16
If you are using console.log to show the connection status etc. of a WiFi connection, disconnecting the WebIde will block the server.
Not complaining about this, just posting to let others know about this gotcha.
-
Using the PICOwifi.js Module
Require and create an instance of PICOwifi
var X=require('PICOwifi'); var Y=new X();
Setup some variables
// things to configure var ssid="your network name"; var key="your network password"; // used by PICOwifi module var Startagain=0; var myinterval; var verbose; //module is quiet //var verbose=1; // module console.logs
Create a task or a series of tasks
For example:
var page1 = "<!DOCTYPE html>\r\n<html>\r\n<body>\r\n\r\n<h1>My First Web Page</h1>\r\n<p>My first paragraph.\r\n</body>\</html>"; function mytask(){ console.log("Mytask"); //// Various user code can go here a simple hello page server //// is given as an example var http=require('http').createServer(function (req, res) { res.writeHead(200); console.log("hello"); res.write(page1); res.end(); res.on('close', function() {});//console.log("t2close"); }); req.on('data',function(data){});//,data);}); req.on('error',function(){});//console.log("reqerr");}); req.on('close',function(){});//console.log("reqcls");}); }).listen(8080); //end server //// end user code }//end my task
Setup function to start the wifi and check it periodically
function test(){ Y.connect(ssid,key,mytask); }//end test myinterval=setInterval(function () { // console.log("Test for error"); if(Startagain){ Startagain=0; test(); }//end of Startagain }, 2000); test();
The Startagain variable can be used in the task code to cause the WIFI to restart. A tasknumber could be used in Mytask to take the tasks through a series of tasks
-
Using the ringMod.js Module
Assuming that the ringMod.js module is located in th emodules folder of the WEBide sandbox.
Require the module in your code and for convience use a variable to specify the length of the rinf buffers.
var R=require('ringMod'); var dsize=432;
Declare an array of pointers to instances of ringMOD and then create the instances
For example:
var data=[]; data.push(new R("Date",dsize,Array,1,1,0,gettime,null,datestring,0)); data.push(new R("Temp F",dsize,Int16Array,100,9/5,32,E.getTemperature,null,tofixed,2)); data.push(new R("Temp C",dsize,Int16Array,100,1,0,E.getTemperature,null)); data.push(new R("Flow l/s",dsize,Int16Array,4096,1,0,analogRead,pinB1,tofixed,2)); data.push(new R("Pump",dsize,Int8Array,1,1,0,digitalRead,pinB3,tofixed,0)); data.push(new R("dhtTemp C",dsize,Int16Array,100,1,0,getTemp,null)); data.push(new R("dhtRH %",dsize,Int16Array,100,1,0,getRH,null));
The fields used when creating instances of ringMOD
ring(hname,size,type,mult,slope,intercept,logfunc,lfargs,format,fargs){
- hname - a string that is used for the column title in the final spreadsheet
- size - the length of the ring buffer
- type - the data type used to store the data. Examples Int16Array, Int8Array etv
- mult - multiplies the raw data before storage, divides the stored value before using
- slope - the linear regression slope used to scale raw values into engineering units (non-zero) If in doubt use 1.0
- intercept - the linear regression intercept used to scale raw values into engineering units (try 0.0)
logfunc - name the function or helper function used to obtain the raw data. Examples:
function gettime(a){ return clk.getDate(); }
lfargs - any argument needed to complte the logfunc. Example logfunc= "analogRead" and lgargs= B7, if not needed use null
format - name of helper function used to format the data Examples:
function datestring(a){ // console.log(a); return Date(a).toString(); } function tofixed(a,b){ return(a.toFixed(b)); }
fargs - argument used with the format function: For example format =tofixed and fargs=2
Inserting the data
Note the logflag used to suspend logging until the clock etc are ready to log.
function log() { var i; if(logflag>0){ for(i=0;i<data.length;i++)data[i].insert(); digitalWrite(LED1,l=!l); } }
Logging the data
The DHT22 returns data in a callback so call it first and in the callback save the DHT data and do the log()
// Do the logging at loginterval in ms setInterval(function(){ dht.read(function (a){ DHTt= a.temp; DHTrh= a.rh; // console.log("Temp is ",getTemp()); // console.log("RH is ",getRH()); log(); }); },loginterval);
The DHT temporary storage variables and the logfunct helper functions
var DHTt,DHTrh; function getTemp(){return DHTt;} function getRH(){return DHTrh;}
Creating the CSV data from the data array
The process.memoy() commands fix a bug that the cutting edge version of Espruino has fixed.
Send 10 lines at a time in the drain function to keep from using too much memory at a time.
function onPageRequest(req, res) { var i=0; var ii=0; var j=0; var sss=""; var a = url.parse(req.url, true); if (a.pathname.substr(-1)=="/") { // a slash at the end res.writeHead(200, {'Content-Type': 'text/html'}); // substitute your own html here // maybe a button to clear or reset the data log on the Pico res.write(page1+DweetID+page2); process.memory(); res.end(); }else{ //filename.csv after the URL slash to do csv files process.memory(); console.log("dl"); res.writeHead(200, {'Content-Type': 'text/csv'}); //write csv file header res.write("Station Name,"+DweetID+"\r"); res.write("Download Time,"+clk.getDate().toString()+"\r"); res.write("\r"); //write the column headers for the csv file for(j=0;j<data.length;j++)sss+=data[j].hname+","; sss=sss.slice(0,sss.length-1)+'\r'; // console.log("N,",sss); res.write("N,"+sss); i=0;j=0; // send the data res.on('drain',function(){ process.memory(); ///////////////////////////////////////// if(j>=data[0].cnt){ //logdata.length){ console.log("rend1"); res.end(); }else{ for(i=j;i<j+10;i++){ if(i<data[0].cnt){ sss=""; for(ii=0;ii<data.length;ii++) sss=sss+data[ii].getDatum(i)+","; sss=sss.slice(0,sss.length-1)+'\r'; res.write(i.toString()+","+sss); }else{ process.memory(); ///////////////////////////////////////// console.log("rend2"); if(j){ res.end(); j=0; }//end if j } }//next i j+=10; }//end else });//end on drain }//end else res.on('close', function() {});//console.log("t2close"); }); req.on('data',function(data){});//,data);}); req.on('error',function(){});//console.log("reqerr");}); req.on('close',function(){});//console.log("reqcls");}); }//end onPagerequest
- hname - a string that is used for the column title in the final spreadsheet
-
A WIFI Datalogger for Espruino PICO
What it does:
Connects to a Wifi router
Sends a Dweet containing the local IP address
Sets the PICO RTC to the time returned by the Dweet Service
DIsconnects and reconnects to the Wifi router
Serves a Web page that allows the client to enter the filename to assign to downloaded data.
Send the collected data in comma separated format CSV with a MIME header that opens an Excel spreadsheet.
Collects the data at specified intervals and stores it in ring buffers in RAM.
The Hardware
- Espruino PICO board running Espruino 1v95 or later software, and an ESP8266 mounted on a shim.
A pushbutton switch wired from pin B3 to ground. (Digital Read)
A 10k potentiometer or series of 10k resistors wired to vary the Voltage on pin B1 in a range of 0.0 to 3.0 Volts. (Analog Read)
(for one program) A DHT22 Relative Humidity and Temperature sensor with the power leads appropriately connected to ground and the 3.3 Volt busses and the output pin with a pullup resistor connected to PICO pin A7.
Items to edit in order to run the examples:
- Local Modules
In the upper right of the WebIDE is a 'gear' looking icon, hover the cursor over the icon and the word settings will appear. Click on the settings icon and then select Project. Use the "Select Directory for the Sandbox " to select or even create a sanbox directory. For example I create a sandbox named EspruinoModules. It has a number of sub-directories. We are interested in the one called \modules.
"C:\Users\jj\Documents\EspruinoModules\modules"
Copy the attached modules files to the folder:
"C:\Users\jj\Documents\EspruinoModules\modules\PICOwifi.js"
and
"C:\Users\jj\Documents\EspruinoModules\modules\ringMod.js"
- Editing the Programs to run the Demos
"C:\Users\jj\Documents\PICOwifi\logger\Ring\Post19Feb2018\PICOwifi-Dweet-Log-Test.js"
"C:\Users\jj\Documents\PICOwifi\logger\Ring\Post19Feb2018\PICOwifi-Dweet-Log-DHT22.js"
a. ssid - wifi name
b. key - wifi password
c. DweetID make up a name unique to you
d. timezone (-6 is for CST)
// things to configure var ssid="myssid"; var key="mykey"; //set DweetID to a unique value var DweetID="mydweetname"; // https://dweet.io/get/latest/dweet/for/mydweetname var verbose; //module is quiet //var verbose=1; // module console.logs var timezone=-6; var dsize=432;//144; var loginterval=1000;
The verbose refers to console output in the PICOwif module.
dsize it the length of the rung buffer used to store data.loginterval is the number of milliseconds between data samples.
The WebIDE output:
1v95 Copyright 2017 G.Williams >Start connection process =undefined null IP= 192.168.1.11 null Mytask 1 Sun Feb 18 2018 20:22:25 GMT-0600 Start connection process null IP= 192.168.1.11 null Mytask 2 dl rend1 dl rend1 dl rend2 rend2 rend2 rend2 rend2 rend2 rend2 rend1
The Dweet Page
From a browser enter the IP address
(substitute mysweet name)https://dweet.io/get/latest/dweet/for/mydweetname
The output displayed on the web page will be
{"this":"succeeded","by":"getting","the":"dweets","with":[{"thing":"lovelyDay823","created":"2018-02-19T02:22:25.410Z","content":{"IP":"192.168.1.11"}}]}
The Download Page
Using a browser enter the IP address of the PICO
For example:
To Download data from lovelyDay871 Name the .CSV file name where you want to save the data Click to download
For now just click. Later try changing the filename before clicking download. Try xxy.csv, xxx , and xx.txt.
For xxx.csv my Windows10 system displays a message at the bottom of the page that says:
What do you want to do with xxx.csv? From 192.168.1.11 Open, Save Cancel
The file is opened with Excel.
Example xxx.csv downloaded (see attached file):
Station Name lovelyDay871 Download Time Sun Feb 18 2018 16:59:12 GMT-0600 N Date Temp F Temp C Flow l/s Pump dhtTemp C dhtRH % 0 Sun Feb 18 2018 16:55:18 GMT-0600 79.07 25.7 0.67 1 21.6 40.1 1 Sun Feb 18 2018 16:55:19 GMT-0600 79.65 26.35 0.66 1 21.6 40.4 2 Sun Feb 18 2018 16:55:20 GMT-0600 80.02 26.15 0.67 1 21.6 40.2 3 Sun Feb 18 2018 16:55:21 GMT-0600 80.24 27.01 0.67 1 21.6 40.2
-
-
-
It's sounding like it really is a brick.
What do you have it connected to?
Chip, power, USB cable?
Other circuits?
Use Voltmeter to confirm 3 Volts. Do the LEDs flash when you plug it in?
Is the USB cable functioning with some other device?
If connected to other circuits can you disconnect and try it?
Certain pins have to be at the correct levels to program the chip.
Some other pins may be used by the SPI mode to talk to the flash chip.If you are using an Arduino kit to program it does the kit work with another device?
-
Try it without specifying a baud rate. I think ESPtool.py will try and find one that works.
For example this batch file to read the chip info::: Read ESP8288 or ESP32 chip info set /p pport=Enter a Com port echo %pport% pause esptool.py --port %pport% --no-stub chip_id esptool.py --port %pport% --no-stub read_mac esptool.py --port %pport% --no-stub flash_id pause
-
ESP32
A sometimes error message occurs when serving a web page.>E (36271) wifi: pp.c 3126
Is there a reference where this can be found?
The program:
//ESP32wifiDweetServec.js // 6 Feb2018 // http://www.espruino.com/Reference#Wifi var ssid="myssid"; var key="mypassword"; var port = 8080; //set DweetID to a unique value var DweetID="lovelyDay898"; // make up your own phrase // Use the following to get the Dweet containing the IP address // https://dweet.io/get/latest/dweet/for/lovelyDay898 ///////////////////// // Some globals var tasknumber=0; var IP; var MAC; var myinterval; var Clock = require("clock").Clock; var date=new Date(); //console.log(date); //console.log(date.toString()); var clk=new Clock(date.toString()); console.log(clk.getDate().toString()); var wifi = require('Wifi'); function putDweet(dweet_name, a, callback) { var data = ""; for (var n in a) { if (data.length) data+="&"; data += encodeURIComponent(n)+"="+encodeURIComponent(a[n]); } var options = { host: 'dweet.io', port: '80', path:'/dweet/for/'+dweet_name+"?"+data, method:'POST' }; // console.log(options); var http=require("http"); console.log(options); require("http").request(options, function(res) { var d = ""; res.on('errpr',function(e){console.log("err ",e);}); res.on('data', function(dta) { d+=dta;}); res.on('close', function(dta) { d+=dta; // console.log("d= ",d); if (callback) callback(d); }); }).end(); } function mytask1(){ console.log("Mytask 1"); putDweet(DweetID, {IP:IP}, function(d) { // console.log(d); var L = JSON.parse(d); // console.log(L); var x1= L.with.created; // console.log("x1=",x1); clk.setClock(Date.parse(x1)); console.log(clk.getDate().toString()); tasknumber=1; wifi.disconnect(); });//end putDweet //// end user code }//end my task1 ////////////////////////////////////////////////////// var page1 = "<!DOCTYPE html>\r\n<html>\r\n<body>\r\n\r\n<h1>My First Web Page</h1>\r\n<p>My first paragraph."; var page2="</p>\r\n\r\n<script>\r\ndocument.write(5 + 6);\r\n</script>\r\n\r\n</body>\r\n</html>"; function mytask2(){ console.log("Mytask 2"); //// Various user code can go here a simple hello page server //// is given as an example var http=require('http').createServer(function (req, res) { res.writeHead(200); console.log("hello"); res.write(page1); res.write(clk.getDate().toString()); res.write(page2); res.end(); res.on('close', function() {console.log("resclose"); }); req.on('data',function(data){console.log("req=",data);}); req.on('error',function(){console.log("reqerr");}); req.on('close',function(){console.log("reqcls");}); }).listen(8080); //end server //// end user code }//end my task2 function mytask(){ switch (tasknumber){ case 0: mytask1(); break; case 1: clearInterval( myinterval); mytask2(); break; default: tasknumber=0; }//end switch }//end mytask var onWiFiConnect=function(){ var IPobject= wifi.getIP(); IPobject= wifi.getIP(); //var IP = IPobject.ip; //var MAC = IPobject.mac; console.log("IP:"); console.log(IP); console.log("MAC:"); console.log(MAC); mytask(); }; wifi.on('disconnected', function(details) { console.log("disconnected"); wifi.connect(ssid, {password: key},onWiFiConnect()); }); setTimeout(function () { console.log("start"); // wifi.disconnect(); wifi.connect(ssid, {password: key},onWiFiConnect()); }, 3000);
And the output with tasknumber=1 to skip the dweet code
1v95 Copyright 2017 G.Williams Espruino is Open Source. Our work is supported only by sales of official boards and donations: http://espruino.com/Donate >Thu Jan 1 1970 00:00:00 GMT+0000 > =undefined start IP: 0.0.0.0 MAC: 24:0a:c4:00:97:2a Mytask 2 hello reqcls t2close hello reqcls t2close >E (36271) wifi: pp.c 3126
It serves the page, sometimes several times and then dies with this error.
-
Try this one with a valid ssid and key and then try it with a bogus ssid. Look for the disconnect message in the second case. Also there are console.log statements sprinkled in to clarify that the code executes in an order that you may not expect.
//ESP32wifi.js // 6 Feb2018 // http://www.espruino.com/Reference#Wifi var ssid="myssid"; var key="mypassword"; var port = 8080; console.log('start'); var wifi = require('Wifi'); console.log("1"); // use browser at your connected IP address // http://192.168.1.14:8080/ function processRequest (req, res) { console.log("XXX"); res.writeHead(200); res.end('<text>Hello World'); } console.log("2"); var onWiFiConnect=function(){ var IPobject= wifi.getIP(); IPobject= wifi.getIP(); var IP = IPobject.ip; var MAC = IPobject.mac; console.log("IP:"); console.log(IP); console.log("MAC:"); console.log(MAC); var http = require('http'); http.createServer(processRequest).listen(port); console.log(`Web server running at http://${wifi.getIP().ip}:${port}`); // }); }; console.log("3"); wifi.connect(ssid, {password: key},onWiFiConnect()); console.log("4"); wifi.on('disconnected', function(details) { console.log("disconnected"); }); console.log("5"); console.log(wifi.getIP());
Example output:
1v95 Copyright 2017 G.Williams Espruino is Open Source. Our work is supported only by sales of official boards and donations: http://espruino.com/Donate >start 1 2 3 IP: 192.168.1.14 MAC: 24:0a:c4:00:97:2a Web server running at http://192.168.1.14:8080 4 5 { "ip": "192.168.1.14", "netmask": "255.255.255.0", "gw": "192.168.1.1", "mac": "24:0a:c4:00:97:2a" } =undefined XXX XXX >
-
Here's another one closer to your version:
//ESP32wifi1.js // 5 Feb2018 var ssid="sasas"; var key="password"; console.log('start'); var wifi = require('Wifi'); var onWiFiConnect=function(){ var IPobject = wifi.getIP(); var IP = IPobject.ip; var MAC = IPobject.mac; console.log("IP:"); console.log(IP); // if IP is 0.0.0.0 failed to connect have to reset to clear console.log("MAC:"); console.log(MAC); }; wifi.connect(ssid, {password: key},onWiFiConnect());
And the output:
1v95 Copyright 2017 G.Williams Espruino is Open Source. Our work is supported only by sales of official boards and donations: http://espruino.com/Donate >start IP: 192.168.1.14 MAC: 24:0a:c4:00:97:2a =undefined >
-
-
Give this a try:
//ESP32wifi.js // 5 Feb2018 var ssid="ssid"; var key="keykey"; console.log('start'); var wifi = require('Wifi'); wifi.connect(ssid, {password: key}, function onWiFiConnect(){ console.log("xxx"); var IPobject = wifi.getIP(); var IP = IPobject.ip; var MAC = IPobject.mac; console.log("IP:"); console.log(IP); console.log("MAC:"); console.log(MAC); });
Which produces:
1v95 Copyright 2017 G.Williams Espruino is Open Source. Our work is supported only by sales of official boards and donations: http://espruino.com/Donate >start =undefined xxx IP: 192.168.1.14 MAC: 24:0a:c4:00:97:2a >
At first your code wouldn't load and would complain the module wifi was not found.
The cure was to exit WebIDE and uplug then start over. -
Try bringing up WebIDE and clicking on the "gear" (settings) in the upper right. Now click on communications and check to see if the baud rate is set to 115,200.
Here are the batch files I used to flash my Sparkfun ESP-32 Thing board.
Put them in the same directory as the ESP-32 files. From the file explorer click on the batch files to execute them.
First find out about the flash memory on the chip by running the ESPinfo.bat file:: Read ESP8288 or ESP32 chip info set /p pport=Enter a Com port echo %pport% pause esptool.py --port %pport% --baud 115200 --no-stub chip_id esptool.py --port %pport% --baud 115200 --no-stub read_mac esptool.py --port %pport% --baud 115200 --no-stub flash_id pause
You have to enter the com port as "com3" (no quotes in what you type)
Next run the batch file EraseFlash.bat
:: Erase flash set /p pport=Enter a Com port echo %pport% pause esptool.py --port %pport% erase_flash pause
Finally run the file FlashESP32.bat
:: Flash ESP32 chip with Espruino set /p pport=Enter a Com port echo %pport% pause esptool.py --port %pport% --baud 57600 write_flash --flash_freq 40m --flash_mode qio --flash_size 4MB 0x1000 bootloader.bin 0x10000 espruino_esp32.bin 0x8000 partitions_espruino.bin pause
I just noticed that you use flash mode dio. I used qio in the batch file.
ExpressIF produces devices with various flash memory chips that vary in size, speed and spi communications method. That's the difference in qio and dio.
Figuring out what kind of flash your device has is the basic problem. When I buy a new ESP8266 or ESP-32 I like to use putty to bring up the initial screen using 115,200 and 74,480 baud. The information displayed usually tells me the flash size and spi mode, never seen anyting about the speed. If you do this first you will know what the factory used.
Here's what I get from Putty and WebIDE after flashing with Espruino. Connect and press reset button on the ESP32 board.ets Jun 8 2016 00:22:57 rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT) ets Jun 8 2016 00:22:57 rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT) configsip: 0, SPIWP:0x00 clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00 mode:QIO, clock div:2 load:0x3fff0008,len:8 load:0x3fff0010,len:1932 ho 0 tail 12 room 4 load:0x40078000,len:10012 load:0x40080000,len:252 entry 0x40080034 _____ _ | __|___ ___ ___ _ _|_|___ ___ | __|_ -| . | _| | | | | . | |_____|___| _|_| |___|_|_|_|___| |_| http://espruino.com 1v95 Copyright 2017 G.Williams Espruino is Open Source. Our work is supported only by sales of official boards and donations: http://espruino.com/Donate
Here's the output at 74480 Baud of an ESP8266-12 using Putty.
ets Jan 8 2013,rst cause:2, boot mode:(3,7) load 0x40100000, len 2408, room 16 tail 8 chksum 0xe5 load 0x3ffe8000, len 776, room 0 tail 8 chksum 0x84 load 0x3ffe8310, len 632, room 0 tail 8 chksum 0xd8 csum 0xd8 2nd boot version : 1.6 SPI Speed : 40MHz SPI Mode : DIO SPI Flash Size & Map: 32Mbit(1024KB+1024KB) jump to run user1 @ 1000 rf cal sector: 128 (Then it switches to 115,200 and you get garbage)
A question for @MaBe. Does the memory size 4MB-c1 apply to ESP-32?
-
Try Putty at 115,200 Baud
Connect with Putty
Press reset (or momentarily ground the reset pin)
The output should look like this: (but look for errors)ets Jun 8 2016 00:22:57 rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT) ets Jun 8 2016 00:22:57 rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT) configsip: 0, SPIWP:0x00 clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00 mode:QIO, clock div:2 load:0x3fff0008,len:8 load:0x3fff0010,len:1932 ho 0 tail 12 room 4 load:0x40078000,len:10012 load:0x40080000,len:252 entry 0x40080034 _____ _ | __|___ ___ ___ _ _|_|___ ___ | __|_ -| . | _| | | | | . | |_____|___| _|_| |___|_|_|_|___| |_| http://espruino.com 1v95 Copyright 2017 G.Williams Espruino is Open Source. Our work is supported only by sales of official boards and donations: http://espruino.com/Donate >
Ground GPIO 0 pin and do a reset
The output should look like this.>ets Jun 8 2016 00:22:57 rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT) ets Jun 8 2016 00:22:57 rst:0x10 (RTCWDT_RTC_RESET),boot:0x3 (DOWNLOAD_BOOT(UART0/UART1/SDIO_REI_REO_V2) waiting for download
-
It were the watchdog timer doing the reset.
This works.var chk=1024; var tdata=new Uint8Array(chk); var i=0; tdata.fill(0x30); function draino(){ } D=new draino(); D.on('drain',function(){ console.log(i);i++; console.log(E.toString(tdata)); process.memory(); //fails if this is commented }); setInterval(function (){ D.emit('drain'); },100);
The emit and drain are simulating serving data to a socket.
Code for doing that would obsfucate the issue a bit more.Gordon has addressed the problem shown by commenting out the process.memory, but his fix isn't in the published 1v95 code yet.
Thanks for the tip about the watchdog. The ESP8266 Espruino is a different paradigm from the Pico. Is there a similar watchdog in the ESP32 Espruino?
-
Problem with E.toString in Espruino 1v95 on ESP8266-4MB
Erase flash
Flash the chip (uses DIO)
:: Flash ESP8288-12 4MB chip with Espruino set /p pport=Enter a Com port echo %pport% pause esptool.py --port %pport% --baud 115200 write_flash --flash_freq 40m --flash_mode dio --flash_size 4MB-c1 0x0000 "boot_v1.6.bin" 0x1000 espruino_esp8266_user1.bin 0x3FC000 esp_init_data_default.bin 0x3FE000 blank.bin pause
Run this program
var chk=512; var tdata=new Uint8Array(chk); var i; for(i=0;i<chk;i++){ tdata[i]=0x30; }//next i function test(){ for(i=0;i<100;i++){ console.log(i); console.log(E.toString(tdata)); process.memory(); //optional }//next i } setTimeout( function () { console.log("hello"); test(); }, 1000);
4 Here's the output
1v95 Copyright 2017 G.Williams Espruino is Open Source. Our work is supported only by sales of official boards and donations: http://espruino.com/Donate Flash map 4MB:1024/1024, manuf 0xc8 chip 0x4016 > =undefined hello 0 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 1
Skipping some output to save space
49 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 50 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 51 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 ets Jan 8 2013,rst cause:2, boot mode:(3,6) load 0x40100000, len 2408, room 16 tail 8 chksum 0xe5 load 0x3ffe8000, len 776, room 0 tail 8 chksum 0x84 load 0x3ffe8310, len 632, room 0 tail 8 chksum 0xd8 csum 0xd8 2nd boot version : 1.6 SPI Speed : 40MHz SPI Mode : DIO SPI Flash Size & Map: 32Mbit(1024KB+1024KB) jump to run user1 @ 1000 âäoärûg|ìdÄd`Äãr$þ _____ _ | __|___ ___ ___ _ _|_|___ ___ | __|_ -| . | _| | | | | . | |_____|___| _|_| |___|_|_|_|___| |_| http://espruino.com 1v95 Copyright 2017 G.Williams Espruino is Open Source. Our work is supported only by sales of official boards and donations: http://espruino.com/Donate Flash map 4MB:1024/1024, manuf 0xc8 chip 0x4016 >
-
I just flashed the same type of chip using this batch file a couple of days ago.
:: Flash ESP8288-12 4MB chip with Espruino :: CD C:\Users\jj\Documents\espruinoEsp8266Flash\espruino_1v95_esp8266 set /p pport=Enter a Com port echo %pport% pause esptool.py --port %pport% --baud 115200 write_flash --flash_freq 40m --flash_mode qio --flash_size 4MB 0x0000 "boot_v1.6.bin" 0x1000 espruino_esp8266_user1.bin 0x3FC000 esp_init_data_default.bin 0x3FE000 blank.bin pause :: To flash a 4MB esp8266 (e.g. esp-12) using the serial port use: :: esptool.py --port [/dev/ttyUSB0|COM1] --baud 115200 write_flash \ :: --flash_freq 80m --flash_mode qio --flash_size 32m \ :: 0x0000 "boot_v1.6.bin" 0x1000 espruino_esp8266_user1.bin \ :: 0x3FC000 esp_init_data_default.bin 0x3FE000 blank.bin
Give that a try.
If you get Espruino up and running then in the left window of WebIDE try to following commands:require("ESP8266).getFreeFlash()
and then
process.env
-
Try using the files in this directory
\espruinoEsp8266Flash\espruino_1v95_esp8266
not this directory
\espruinoEsp8266Flash\espruino_1v95_esp8266_4mb"
You might want to switch to ESPtool.py (Linux or windows)
I used to use the ExpressIF tool but switched to ESPtool.py because I can use batch files to do the flashing in a few mouse clicks:One gotcha is the ExpressIF tool flash size is given in bits, ESPtool.py uses bytes.
Which ESP8266 chip are you trying to flash?
-
Finaly got a 4MB ESP8266-12 (AI-Thinker ESP8266 MOD) assembled and working.
I used 10k pullup resistors on the reset, Enable and GPIO 0 pins and a 10k pulldown resistor on GPIO 15.
I used three batch files to run the ESPtool.py
I first copied the batch files to the folder:
"C:\Users\jj\Documents\espruinoEsp8266Flash\espruino_1v95_esp8266_4mb"
Run the batch files by clicking on them in file explorer after grounding GPIO 0 and resetting the chip.
Run ESPinfo.bat and get the following.C:\Users\jj\Documents\espruinoEsp8266Flash\espruino_1v95_esp8266_4mb>set /p pport=Enter a Com port Enter a Com port com3 C:\Users\jj\Documents\espruinoEsp8266Flash\espruino_1v95_esp8266_4mb>echo com3 com3 C:\Users\jj\Documents\espruinoEsp8266Flash\espruino_1v95_esp8266_4mb>pause Press any key to continue . . . C:\Users\jj\Documents\espruinoEsp8266Flash\espruino_1v95_esp8266_4mb>esptool.py --port com3 --baud 115200 --no-stub chip_id esptool.py v2.2.1 Connecting.... Detecting chip type... ESP8266 Chip is ESP8266EX Enabling default SPI flash mode... Chip ID: 0x00134e51 Hard resetting... C:\Users\jj\Documents\espruinoEsp8266Flash\espruino_1v95_esp8266_4mb>esptool.py --port com3 --baud 115200 --no-stub read_mac esptool.py v2.2.1 Connecting... Detecting chip type... ESP8266 Chip is ESP8266EX Enabling default SPI flash mode... MAC: 5c:cf:7f:13:4e:51 Hard resetting... C:\Users\jj\Documents\espruinoEsp8266Flash\espruino_1v95_esp8266_4mb>esptool.py --port com3 --baud 115200 --no-stub flash_id esptool.py v2.2.1 Connecting... Detecting chip type... ESP8266 Chip is ESP8266EX Enabling default SPI flash mode... Manufacturer: e0 Device: 4016 Detected flash size: 4MB Hard resetting... C:\Users\jj\Documents\espruinoEsp8266Flash\espruino_1v95_esp8266_4mb>pause Press any key to continue . . .
Then I did a reset of the chip and ran EraseFlash.bat.
Then I did a reset of the chip and ran
"C:\Users\jj\Documents\espruinoEsp8266Flash\espruino_1v95_esp8266_4mb\FlashESP8266_4M_40mhz.bat"
I un-grounded GPIO 0 and reset the chip.
Reconnect to WEBIDE and try the test program WSDesp8266C.js
It connects to my router and serves the HTML page but fails to transmit data via WebSockets.Try again
Put the batch files into the following folder
"C:\Users\jj\Documents\espruinoEsp8266Flash\espruino_1v95_esp8266"
Rerun the ESPinfo.bat, EraseFlash.bat and FlashESP8266_4M_40mhz.bat.
The WSDesp8266C.js program produces the following output:1v95 Copyright 2017 G.Williams Espruino is Open Source. Our work is supported only by sales of official boards and donations: http://espruino.com/Donate Flash map 4MB:512/512, manuf 0xe0 chip 0x4016 >Start connection process Try Connecting to WiFi faux =undefined Test for error null connected? err= null info= { "ip": "192.168.1.15", "netmask": "255.255.255.0", "gw": "192.168.1.1", "mac": "5c:cf:7f:13:4e:51" } Wi-Fi Connected n= 4 t: 0.018 sec n= 3 t: 0.095 sec [WS] "2048" n= 2 t: 0.179 sec [WS] "4096" n= 1 t: 0.256 sec [WS] "6144" n= 0 t: 1.133 sec [WS] "8192" n= 0 t: 1.135 sec n= 3 t: 1.241 sec [WS] "10240" n= 2 t: 1.312 sec [WS] "12288" n= 1 t: 1.383 sec [WS] "14336" n= 0 t: 1.453 sec [WS] "16384" n= 0 t: 1.455 sec n= 3 t: 1.527 sec [WS] "18432" n= 2 t: 2.325 sec [WS] "20480" n= 1 t: 2.394 sec [WS] "22528" n= 0 t: 2.470 sec [WS] "24576" n= 0 t: 2.473 sec n= 3 t: 2.541 sec [WS] "26624" n= 2 t: 2.617 sec [WS] "28672" n= 1 t: 2.685 sec [WS] "30720" n= 0 t: 2.757 sec [WS] "32768" n= 0 t: 2.759 sec n= 3 t: 2.839 sec [WS] "34816" n= 2 t: 2.940 sec [WS] "36864" n= 1 t: 3.013 sec [WS] "38912" n= 0 t: 3.089 sec [WS] "40960" n= 0 t: 3.092 sec n= 3 t: 3.168 sec [WS] "43008" n= 2 t: 3.243 sec [WS] "45056" n= 1 t: 3.317 sec [WS] "47104" n= 0 t: 3.388 sec [WS] "49152" n= 0 t: 3.391 sec n= 3 t: 3.457 sec [WS] "51200" n= 2 t: 3.526 sec [WS] "53248" n= 1 t: 4.493 sec [WS] "55296" n= 0 t: 4.567 sec [WS] "57344" n= 0 t: 4.569 sec n= 3 t: 4.646 sec [WS] "59392" n= 2 t: 4.715 sec [WS] "61440" n= 1 t: 4.780 sec [WS] "63488" n= 0 t: 4.853 sec [WS] "65536" n= 0 t: 4.855 sec n= 3 t: 4.932 sec [WS] "67584" n= 2 t: 4.998 sec [WS] "69632" n= 1 t: 5.075 sec [WS] "71680" n= 0 t: 5.146 sec [WS] "73728" n= 0 t: 5.148 sec n= 3 t: 5.221 sec [WS] "75776" n= 2 t: 5.294 sec [WS] "77824" n= 1 t: 5.366 sec [WS] "79872" n= 0 t: 5.432 sec [WS] "81920" n= 0 t: 5.434 sec n= 3 t: 5.499 sec [WS] "83968" n= 2 t: 6.244 sec [WS] "86016" n= 1 t: 6.310 sec [WS] "88064" n= 0 t: 6.389 sec [WS] "90112" n= 0 t: 6.391 sec n= 3 t: 6.459 sec [WS] "92160" n= 2 t: 6.528 sec [WS] "94208" n= 1 t: 6.597 sec [WS] "96256" n= 0 t: 6.668 sec [WS] "98304" n= 0 t: 6.669 sec n= 3 t: 6.739 sec [WS] "100352" n= 2 t: 6.810 sec [WS] "102400" n= 1 t: 7.732 sec [WS] "104448" n= 0 t: 7.800 sec [WS] "106496" n= 0 t: 7.802 sec n= 3 t: 7.872 sec [WS] "108544" n= 2 t: 7.944 sec [WS] "110592" n= 1 t: 8.013 sec [WS] "112640" n= 0 t: 8.083 sec [WS] "114688" n= 0 t: 8.085 sec n= 3 t: 8.155 sec [WS] "116736" n= 2 t: 8.233 sec [WS] "118784" n= 1 t: 8.299 sec [WS] "120832" n= 0 t: 8.367 sec [WS] "122880" n= 0 t: 8.369 sec n= 3 t: 8.446 sec [WS] "124928" n= 2 t: 8.513 sec [WS] "126976" n= 1 t: 8.587 sec [WS] "129024" n= 0 t: 8.659 sec [WS] "131072" n= 0 t: 8.662 sec n= 3 t: 8.730 sec [WS] "133120" n= 2 t: 8.797 sec [WS] "135168" n= 1 t: 8.871 sec [WS] "137216" n= 0 t: 8.939 sec [WS] "139264" n= 0 t: 8.941 sec n= 3 t: 9.012 sec [WS] "141312" n= 2 t: 9.079 sec [WS] "143360" n= 1 t: 9.152 sec [WS] "145408" n= 0 t: 9.221 sec [WS] "147456" n= 0 t: 9.224 sec n= 3 t: 9.290 sec [WS] "149504" n= 2 t: 9.363 sec [WS] "151552" n= 1 t: 9.434 sec [WS] "153600" n= 0 t: 12.071 sec [WS] "155648" n= 0 t: 12.073 sec n= 3 t: 12.153 sec [WS] "157696" n= 2 t: 12.229 sec [WS] "159744" n= 1 t: 12.302 sec [WS] "161792" n= 0 t: 12.372 sec [WS] "163840" n= 0 t: 12.374 sec n= 3 t: 12.449 sec [WS] "165888" n= 2 t: 12.513 sec [WS] "167936" n= 1 t: 12.584 sec [WS] "169984" n= 0 t: 12.653 sec [WS] "172032" n= 0 t: 12.655 sec n= 3 t: 12.738 sec [WS] "174080" n= 2 t: 12.821 sec [WS] "176128" n= 1 t: 12.889 sec [WS] "178176" n= 0 t: 12.960 sec [WS] "180224" n= 0 t: 12.963 sec n= 3 t: 13.033 sec [WS] "182272" n= 2 t: 13.104 sec [WS] "184320" n= 1 t: 13.171 sec [WS] "186368" n= 0 t: 13.248 sec [WS] "188416" n= 0 t: 13.250 sec n= 3 t: 13.319 sec [WS] "190464" n= 2 t: 13.385 sec [WS] "192512" n= 1 t: 14.278 sec [WS] "194560" n= 0 t: 14.349 sec [WS] "196608" n= 0 t: 14.352 sec n= 3 t: 14.425 sec [WS] "198656" n= 2 t: 14.500 sec [WS] "200704" n= 1 t: 14.568 sec [WS] "202752" n= 0 t: 14.635 sec [WS] "204800" n= 0 t: 14.637 sec n= 3 t: 14.716 sec [WS] "206848" n= 2 t: 14.792 sec [WS] "208896" n= 1 t: 14.860 sec [WS] "210944" n= 0 t: 14.935 sec [WS] "212992" n= 0 t: 14.938 sec n= 3 t: 15.015 sec [WS] "215040" n= 2 t: 15.079 sec [WS] "217088" n= 1 t: 15.147 sec [WS] "219136" n= 0 t: 15.213 sec [WS] "221184" n= 0 t: 15.215 sec n= 3 t: 15.286 sec [WS] "223232" n= 2 t: 15.355 sec [WS] "225280" n= 1 t: 16.028 sec [WS] "227328" n= 0 t: 16.100 sec [WS] "229376" n= 0 t: 16.103 sec n= 3 t: 16.175 sec [WS] "231424" n= 2 t: 16.249 sec [WS] "233472" n= 1 t: 16.323 sec [WS] "235520" n= 0 t: 16.391 sec [WS] "237568" n= 0 t: 16.393 sec n= 3 t: 16.462 sec [WS] "239616" n= 2 t: 16.535 sec [WS] "241664" n= 1 t: 16.604 sec [WS] "243712" n= 0 t: 16.673 sec [WS] "245760" n= 0 t: 16.675 sec n= 3 t: 16.743 sec [WS] "247808" n= 2 t: 16.810 sec [WS] "249856" n= 1 t: 16.878 sec [WS] "251904" n= 0 t: 16.948 sec [WS] "253952" n= 0 t: 16.950 sec n= 3 t: 17.023 sec [WS] "256000" n= 2 t: 17.089 sec [WS] "258048" n= 1 t: 17.166 sec [WS] "260096" n= 0 t: 17.244 sec [WS] "262144" n= 0 t: 17.246 sec n= 3 t: 17.316 sec [WS] "264192" n= 2 t: 18.124 sec [WS] "266240" n= 1 t: 18.194 sec [WS] "268288" n= 0 t: 18.265 sec [WS] "270336" n= 0 t: 18.268 sec n= 3 t: 18.339 sec [WS] "272384" n= 2 t: 18.407 sec [WS] "274432" n= 1 t: 18.477 sec [WS] "276480" n= 0 t: 18.543 sec [WS] "278528" n= 0 t: 18.546 sec n= 3 t: 18.612 sec [WS] "280576" n= 2 t: 19.313 sec [WS] "282624" n= 1 t: 19.378 sec [WS] "284672" n= 0 t: 19.447 sec [WS] "286720" n= 0 t: 19.449 sec n= 3 t: 19.528 sec [WS] "288768" n= 2 t: 19.599 sec [WS] "290816" n= 1 t: 19.666 sec [WS] "292864" n= 0 t: 19.734 sec [WS] "294912" n= 0 t: 19.736 sec n= 3 t: 19.815 sec [WS] "296960" n= 2 t: 19.886 sec [WS] "299008" n= 1 t: 19.955 sec [WS] "301056" n= 0 t: 20.031 sec [WS] "303104" n= 0 t: 20.034 sec n= 3 t: 20.109 sec [WS] "305152" n= 2 t: 20.179 sec [WS] "307200" n= 1 t: 20.245 sec [WS] "309248" n= 0 t: 20.316 sec [WS] "311296" n= 0 t: 20.318 sec n= 3 t: 20.391 sec [WS] "313344" n= 2 t: 20.464 sec [WS] "315392" n= 1 t: 20.532 sec [WS] "317440" n= 0 t: 20.602 sec [WS] "319488" n= 0 t: 20.604 sec n= 3 t: 20.685 sec [WS] "321536" n= 2 t: 20.753 sec [WS] "323584" n= 1 t: 20.830 sec [WS] "325632" n= 0 t: 20.899 sec [WS] "327680" n= 0 t: 20.901 sec n= 3 t: 20.967 sec [WS] "329728" n= 2 t: 21.037 sec [WS] "331776" n= 1 t: 21.104 sec [WS] "333824" n= 0 t: 21.172 sec [WS] "335872" n= 0 t: 21.174 sec n= 3 t: 21.245 sec [WS] "337920" n= 2 t: 21.345 sec [WS] "339968" n= 1 t: 21.440 sec [WS] "342016" n= 0 t: 21.509 sec [WS] "344064" n= 0 t: 21.512 sec n= 3 t: 21.586 sec [WS] "346112" n= 2 t: 21.661 sec [WS] "348160" n= 1 t: 21.731 sec [WS] "350208" n= 0 t: 21.798 sec [WS] "352256" n= 0 t: 21.801 sec n= 3 t: 21.876 sec [WS] "354304" n= 2 t: 21.971 sec [WS] "356352" n= 1 t: 22.041 sec [WS] "358400" n= 0 t: 22.109 sec [WS] "360448" n= 0 t: 22.112 sec n= 3 t: 22.185 sec [WS] "362496" n= 2 t: 22.253 sec [WS] "364544" n= 1 t: 22.321 sec [WS] "366592" n= 0 t: 22.388 sec [WS] "368640" n= 0 t: 22.389 sec n= 3 t: 22.455 sec [WS] "370688" n= 2 t: 22.522 sec [WS] "372736" n= 1 t: 22.589 sec [WS] "374784" n= 0 t: 22.657 sec [WS] "376832" n= 0 t: 22.659 sec n= 3 t: 22.730 sec [WS] "378880" n= 2 t: 22.801 sec [WS] "380928" n= 1 t: 22.869 sec [WS] "382976" n= 0 t: 22.939 sec [WS] "385024" n= 0 t: 22.941 sec n= 3 t: 23.008 sec [WS] "387072" n= 2 t: 23.078 sec [WS] "389120" n= 1 t: 23.149 sec [WS] "391168" n= 0 t: 23.219 sec [WS] "393216" n= 0 t: 23.221 sec n= 3 t: 24.147 sec [WS] "395264" n= 2 t: 24.227 sec [WS] "397312" n= 1 t: 24.296 sec [WS] "399360" n= 0 t: 24.361 sec [WS] "401408" n= 0 t: 24.364 sec n= 3 t: 24.439 sec [WS] "403456" n= 2 t: 24.518 sec [WS] "405504" n= 1 t: 25.341 sec [WS] "407552" n= 0 t: 25.408 sec [WS] "409600" n= 0 t: 25.410 sec n= 3 t: 25.481 sec [WS] "411648" n= 2 t: 25.556 sec [WS] "413696" n= 1 t: 25.621 sec [WS] "415744" n= 0 t: 25.691 sec [WS] "417792" n= 0 t: 25.693 sec n= 3 t: 25.765 sec [WS] "419840" n= 2 t: 25.830 sec [WS] "421888" n= 1 t: 28.289 sec [WS] "423936" n= 0 t: 28.356 sec [WS] "425984" n= 0 t: 28.358 sec n= 3 t: 28.439 sec [WS] "428032" n= 2 t: 29.252 sec [WS] "430080" n= 1 t: 29.325 sec [WS] "432128" n= 0 t: 29.396 sec [WS] "434176" n= 0 t: 29.398 sec n= 3 t: 29.467 sec [WS] "436224" n= 2 t: 29.541 sec [WS] "438272" n= 1 t: 29.609 sec [WS] "440320" n= 0 t: 29.679 sec [WS] "442368" n= 0 t: 29.682 sec n= 3 t: 29.758 sec [WS] "444416" n= 2 t: 31.375 sec [WS] "446464" n= 1 t: 31.443 sec [WS] "448512" n= 0 t: 31.510 sec [WS] "450560" n= 0 t: 31.512 sec n= 3 t: 31.589 sec [WS] "452608" n= 2 t: 31.655 sec [WS] "454656" n= 1 t: 31.724 sec [WS] "456704" n= 0 t: 32.612 sec [WS] "458752" n= 0 t: 32.614 sec n= 3 t: 32.683 sec [WS] "460800" n= 2 t: 32.757 sec [WS] "462848" n= 1 t: 32.833 sec [WS] "464896" n= 0 t: 32.905 sec [WS] "466944" n= 0 t: 32.907 sec n= 3 t: 32.975 sec [WS] "468992" n= 2 t: 33.041 sec [WS] "471040" n= 1 t: 33.803 sec [WS] "473088" n= 0 t: 33.875 sec [WS] "475136" n= 0 t: 33.877 sec n= 3 t: 33.953 sec [WS] "477184" n= 2 t: 34.017 sec [WS] "479232" n= 1 t: 34.087 sec [WS] "481280" n= 0 t: 34.162 sec [WS] "483328" n= 0 t: 34.164 sec n= 3 t: 34.241 sec [WS] "485376" n= 2 t: 34.307 sec [WS] "487424" n= 1 t: 34.373 sec [WS] "489472" n= 0 t: 35.107 sec [WS] "491520" n= 0 t: 35.109 sec n= 3 t: 35.182 sec [WS] "493568" n= 2 t: 35.251 sec [WS] "495616" n= 1 t: 35.318 sec [WS] "497664" n= 0 t: 35.394 sec [WS] "499712" n= 0 t: 35.397 sec n= 3 t: 35.478 sec [WS] "501760" n= 2 t: 35.545 sec [WS] "503808" n= 1 t: 35.618 sec [WS] "505856" n= 0 t: 35.689 sec [WS] "507904" n= 0 t: 35.691 sec n= 3 t: 36.604 sec [WS] "509952" n= 2 t: 36.672 sec [WS] "512000" n= 1 t: 36.738 sec [WS] "514048" n= 0 t: 36.814 sec [WS] "516096" n= 0 t: 36.816 sec n= 3 t: 36.886 sec [WS] "518144" n= 2 t: 36.951 sec [WS] "520192" n= 1 t: 37.026 sec [WS] "522240" n= 0 t: 37.095 sec [WS] "524288" n= 0 t: 37.097 sec n= 3 t: 37.168 sec [WS] "526336" n= 2 t: 37.240 sec [WS] "528384" n= 1 t: 37.309 sec [WS] "530432" n= 0 t: 37.377 sec [WS] "532480" n= 0 t: 37.379 sec n= 3 t: 37.445 sec [WS] "534528" n= 2 t: 37.518 sec [WS] "536576" n= 1 t: 37.589 sec [WS] "538624" n= 0 t: 37.656 sec [WS] "540672" n= 0 t: 37.658 sec n= 3 t: 38.473 sec [WS] "542720" n= 2 t: 38.547 sec [WS] "544768" n= 1 t: 38.622 sec [WS] "546816" n= 0 t: 38.689 sec [WS] "548864" n= 0 t: 38.691 sec n= 3 t: 38.767 sec [WS] "550912" n= 2 t: 38.835 sec [WS] "552960" n= 1 t: 38.900 sec [WS] "555008" n= 0 t: 38.974 sec [WS] "557056" n= 0 t: 38.977 sec n= 3 t: 40.535 sec [WS] "559104" n= 2 t: 40.609 sec [WS] "561152" n= 1 t: 40.682 sec [WS] "563200" n= 0 t: 40.747 sec [WS] "565248" n= 0 t: 40.749 sec n= 3 t: 40.825 sec [WS] "567296" n= 2 t: 40.905 sec [WS] "569344" n= 1 t: 40.969 sec [WS] "571392" n= 0 t: 41.039 sec [WS] "573440" n= 0 t: 41.041 sec n= 3 t: 41.117 sec [WS] "575488" n= 2 t: 41.185 sec [WS] "577536" n= 1 t: 41.253 sec [WS] "579584" n= 0 t: 41.331 sec [WS] "581632" n= 0 t: 41.333 sec n= 3 t: 41.457 sec [WS] "583680" n= 2 t: 41.524 sec [WS] "585728" n= 1 t: 41.592 sec [WS] "587776" n= 0 t: 43.310 sec [WS] "589824" n= 0 t: 43.312 sec n= 3 t: 43.384 sec [WS] "591872" n= 2 t: 43.464 sec [WS] "593920" n= 1 t: 43.535 sec [WS] "595968" n= 0 t: 43.604 sec [WS] "598016" n= 0 t: 43.607 sec n= 3 t: 43.685 sec [WS] "600064" n= 2 t: 43.749 sec [WS] "602112" n= 1 t: 43.818 sec [WS] "604160" n= 0 t: 43.889 sec [WS] "606208" n= 0 t: 43.892 sec n= 3 t: 43.971 sec [WS] "608256" n= 2 t: 44.038 sec [WS] "610304" n= 1 t: 44.104 sec [WS] "612352" n= 0 t: 44.194 sec [WS] "614400" n= 0 t: 44.196 sec n= 3 t: 45.118 sec [WS] "616448" n= 2 t: 45.184 sec [WS] "618496" n= 1 t: 45.252 sec [WS] "620544" n= 0 t: 45.324 sec [WS] "622592" n= 0 t: 45.326 sec n= 3 t: 45.396 sec [WS] "624640" n= 2 t: 45.471 sec [WS] "626688" n= 1 t: 45.538 sec [WS] "628736" n= 0 t: 46.349 sec [WS] "630784" n= 0 t: 46.352 sec n= 3 t: 46.471 sec [WS] "632832" n= 2 t: 46.549 sec [WS] "634880" n= 1 t: 46.613 sec [WS] "636928" n= 0 t: 46.679 sec [WS] "638976" n= 0 t: 46.681 sec n= 3 t: 46.754 sec [WS] "641024" n= 2 t: 46.821 sec [WS] "643072" n= 1 t: 47.575 sec [WS] "645120" n= 0 t: 47.641 sec [WS] "647168" n= 0 t: 47.643 sec n= 3 t: 47.714 sec [WS] "649216" n= 2 t: 47.787 sec [WS] "651264" n= 1 t: 47.862 sec [WS] "653312" n= 0 t: 47.926 sec [WS] "655360" n= 0 t: 47.928 sec n= 3 t: 48.006 sec [WS] "657408" n= 2 t: 48.079 sec [WS] "659456" n= 1 t: 48.145 sec [WS] "661504" >reset(); =undefined
661,504 * 8 / 48.125 = 109,964 Bits per second
-
Batch flashing file for ESP8266 -12 4MB
Use Putty at 74880 Baud GPIO 0 not grounded connect and then reset the chip.
Note the SPI Speed, the SPI Mode and the Flash Size in bits.
ets Jan 8 2013,rst cause:2, boot mode:(3,7) load 0x40100000, len 1396, room 16 tail 4 chksum 0x89 load 0x3ffe8000, len 776, room 4 tail 4 chksum 0xe8 load 0x3ffe8308, len 540, room 4 tail 8 chksum 0xc0 csum 0xc0 2nd boot version : 1.4(b1) SPI Speed : 40MHz SPI Mode : DIO SPI Flash Size & Map: 8Mbit(512KB+512KB) jump to run user1 @ 1000
Run ESPinfo.bat
Ground GPIO 0 and reset the chip, run ESPinfo.bat
C:\Users\jj\Documents\espruinoEsp8266Flash\espruino_1v95_esp32>set /p pport=Enter a Com port Enter a Com port com3 C:\Users\jj\Documents\espruinoEsp8266Flash\espruino_1v95_esp32>echo com3 com3 C:\Users\jj\Documents\espruinoEsp8266Flash\espruino_1v95_esp32>pause Press any key to continue . . . C:\Users\jj\Documents\espruinoEsp8266Flash\espruino_1v95_esp32>esptool.py --port com3 --baud 115200 --no-stub chip_id esptool.py v2.2.1 Connecting.... Detecting chip type... ESP8266 Chip is ESP8266EX Enabling default SPI flash mode... Chip ID: 0x00134e51 Hard resetting... C:\Users\jj\Documents\espruinoEsp8266Flash\espruino_1v95_esp32>esptool.py --port com3 --baud 115200 --no-stub read_mac esptool.py v2.2.1 Connecting... Detecting chip type... ESP8266 Chip is ESP8266EX Enabling default SPI flash mode... MAC: 5c:cf:7f:13:4e:51 Hard resetting... C:\Users\jj\Documents\espruinoEsp8266Flash\espruino_1v95_esp32>esptool.py --port com3 --baud 115200 --no-stub flash_id esptool.py v2.2.1 Connecting... Detecting chip type... ESP8266 Chip is ESP8266EX Enabling default SPI flash mode... Manufacturer: e0 Device: 4016 Detected flash size: 4MB Hard resetting... C:\Users\jj\Documents\espruinoEsp8266Flash\espruino_1v95_esp32>pause Press any key to continue . . .
Flashing the 4MB Espruino
Ground GPIO 9 reset the chip
Run the batch file
"C:\Users\jj\Documents\espruinoEsp8266Flash\espruino_1v95_esp8266_4mb\FlashESP8266_4M.bat":: Flash ESP8288 4MB chip with Espruino set /p pport=Enter a Com port echo %pport% pause esptool.py --port %pport% --baud 115200 write_flash --flash_freq 80m --flash_mode qio --flash_size 4MB 0x0000 "boot_v1.6.bin" 0x1000 espruino_esp8266_user1.bin 0x3FC000 esp_init_data_default.bin 0x3FE000 blank.bin pause
C:\Users\jj\Documents\espruinoEsp8266Flash\espruino_1v95_esp8266_4mb>set /p pport=Enter a Com port Enter a Com port com3 C:\Users\jj\Documents\espruinoEsp8266Flash\espruino_1v95_esp8266_4mb>echo com3 com3 C:\Users\jj\Documents\espruinoEsp8266Flash\espruino_1v95_esp8266_4mb>pause Press any key to continue . . . C:\Users\jj\Documents\espruinoEsp8266Flash\espruino_1v95_esp8266_4mb>esptool.py --port com3 --baud 115200 write_flash --flash_freq 80m --flash_mode qio --flash_size 4MB 0x0000 "boot_v1.6.bin" 0x1000 espruino_esp8266_user1.bin 0x3FC000 esp_init_data_default.bin 0x3FE000 blank.bin esptool.py v2.2.1 Connecting.... Detecting chip type... ESP8266 Chip is ESP8266EX Uploading stub... Running stub... Stub running... Configuring flash size... Flash params set to 0x004f Compressed 3856 bytes to 2763... Wrote 3856 bytes (2763 compressed) at 0x00000000 in 0.3 seconds (effective 120.1 kbit/s)... Hash of data verified. Compressed 509332 bytes to 340820... Wrote 509332 bytes (340820 compressed) at 0x00001000 in 30.3 seconds (effective 134.6 kbit/s)... Hash of data verified. Compressed 128 bytes to 75... Wrote 128 bytes (75 compressed) at 0x003fc000 in 0.0 seconds (effective 63.5 kbit/s)... Hash of data verified. Compressed 4096 bytes to 26... Wrote 4096 bytes (26 compressed) at 0x003fe000 in 0.0 seconds (effective 1973.9 kbit/s)... Hash of data verified. Leaving... Hard resetting... C:\Users\jj\Documents\espruinoEsp8266Flash\espruino_1v95_esp8266_4mb>pause Press any key to continue . . .
Run WEBIDE
unground GPIO 0, reset the chip
Connected > >reset() =undefin _____ _ | __|___ ___ ___ _ _|_|___ ___ | __|_ -| . | _| | | | | . | |_____|___| _|_| |___|_|_|_|___| |_| http://espruino.com 1v95 Copyright 2017 G.Williams Espruino is Open Source. Our work is supported only by sales of official boards and donations: http://espruino.com/Donate Flash map 4MB:512/512, manuf 0xe0 chip 0x4016 >
If Forth like honk then!