-
Eventually, I found the answer in this post , thanks Gordon and Ollie!
The browsers on iphone are all based on something that's not friends with HTTP/1.o. -
The datasheet for pico's chip lists the current characteristics in Table 12.
Output current sunk/sourced by any I/O and control pin 25mA. Total
output current sunk/sourced by sum of all I/O and control pins
12omAThis current consumption must be correctly distributed over all I/Os
and control pins. The total output current must not be sunk/sourced
between two consecutive power supply pins referring to high pin count
LQFP packages. -
-
Hi,
I'm trying to flash an ESP-12f board with espruino_esp8266_user1.bin from espruino_1v90_esp8266 which I got from the Download page. Seems to erase and flash ok but when conneting I get this error...
$þERROR: JshPinState [#defines](http://forum.espruino.com/search/?q=%23defines) have changed, please update pinStateToString() 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 : 80MHz SPI Mode : QIO SPI Flash Size & Map: 32Mbit(512KB+512KB) jump to run user1 @ 1000
I flashed it just the same way I did for espruino_1v89_esp8266, with 1v90 I get the error with 1v89 I don't
C:\Espruino>python "esptool-master/esptool-master/esptool.py" --port COM3 --baud 115200 erase_flash esptool.py v1.3-dev Connecting... Running Cesanta flasher stub... Erasing flash (this may take a while)... Erase took 9.5 seconds C:\Espruino>python "esptool-master/esptool-master/esptool.py" --port COM3 --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 esptool.py v1.3-dev Connecting... Running Cesanta flasher stub... Flash params set to 0x004f Writing 4096 @ 0x0... 4096 (100 %) Wrote 4096 bytes at 0x0 in 0.4 seconds (89.3 kbit/s)... Writing 462848 @ 0x1000... 462848 (100 %) Wrote 462848 bytes at 0x1000 in 40.1 seconds (92.3 kbit/s)... Writing 4096 @ 0x3fc000... 4096 (100 %) Wrote 4096 bytes at 0x3fc000 in 0.4 seconds (89.8 kbit/s)... Writing 4096 @ 0x3fe000... 4096 (100 %) Wrote 4096 bytes at 0x3fe000 in 0.4 seconds (89.5 kbit/s)... Leaving... C:\Espruino>
-
Hi .Neil,
I have a pico connected to a ESP8266 development board and see the same memory leak problem you have found.
I added a couple of things and the leak seems to have disappeared completely (at least I think so - not really any clue of what a memory leak actually is!)
I have a 10uF electrolytic capacitor between Vcc and GND.
Also I removed the onInit() because I don't understand what that bit does?
var tries=0; Serial2.setup(115200, { rx: A3, tx : A2 }); var wifi = require("ESP8266WiFi_0v25").connect(Serial2, function(err) { if (err) throw err; wifi.reset(function(err) { if (err) throw err; console.log("Connecting to WiFi"); wifi.connect(WIFI_NAME, WIFI_PASS, function(err) { if (err) throw err; console.log("Connected"); setInterval(function () { require("http").get("http://www.espruino.com", function(res) { console.log("Response: ",res); res.on('data', function(d) { }); }); console.log("Attempt #" + ++tries); console.log(process.memory()); }, 15000); }); }); });
It's been running a for a while now, here's the console log.
Attempt #121 { "free": 4091, "usage": 1009, "total": 5100, "history": 583, "stackEndAddress": 536958448, "flash_start": 134217728, "flash_binary_end": 378024, "flash_code_start": 134234112, "flash_length": 393216 } Response: httpCRs { "headers": { "Date": "Sat, 17 Dec 2016 13:46:41 GMT", "Server": "Apache/2.4.18 (Ubuntu)", "Set-Cookie": "PHPSESSID=u97rcqv8b6e38cjertl64c6ti6; path=/", "Expires": "Thu, 19 Nov 1981 08:52:00 GMT", "Cache-Control": "no-store, no-cache, must-revalidate", "Pragma": "no-cache", "Vary": "Accept-Encoding", "Connection": "close", "Content-Type": "text/html; charset=UTF-8" }, "httpVersion": "1.1", "statusCode": "200", "statusMessage": "OK" }
Does this maybe help to pin down the leak?
-
-
I tried again with stringify and checked my browsers are up to date and working with websockets at websocketstest.com and still no joy on the mobile devices but it works beautifully on the PC. Maybe it's IOS?
-
Hi .Neil,
On my ESP8266 board (ESP-12F), the blue LED does 2 or 3 very quick flashes then a very short pause then one more quick flash. Then it's in bootloader mode. Also I found I needed to powercycle it first, erase it with...
python "...esptool.py" --port COM3 --baud 115200 erase_flash
then powercycle again before flashing and powercycle again before using it.
I know you're using a different board but hope that helps.
-
Hi Ducky, thanks for this example.
I added a line to print the value of msg in the console...var server = require('ws').createServer(onPageRequest); server.listen(8000); server.on("websocket", function(ws) { ws.on('message',function(msg) { console.log("Pos = "+msg); }); });
I've connected to the ESP8266 over TCP using the Espruino Web IDE so I can see the console.
On the PC I see the value updating as I move the controls but when I try the same from a tablet or phone I don't see the value of msg updating, I've tried chrome and safari browsers, why?
-
I like this tutorial.. http://www.espruino.com/Logging+to+Google+Sheets
You can log the data to a google docs spreadsheet, make a graph of the columns containing your data, then your graph updates in realtime as new data comes in! -
-
Hi, I was playing around with a SIM900 a few months ago and everything was going good but today I'm seeing "Module NetworkJS not found" and "Module http not found" in orange boxes down in the lower right corner of the WebIDE?
I see the same warnings with my code and the code in tutorial http://www.espruino.com/SIM900
Are those built in with the firmare? Here's my board information..
VERSION 1v85
BUILD_DATE Feb 25 2016
BUILD_TIME 14:33:58
GIT_COMMIT 0671a2d91de45a0e05c4b2b385264cf2ef16e463
BOARD PICO_R1_3
CHIP STM32F401CDU6
CHIP_FAMILY STM32F4
FLASH 393216
RAM 98304
SERIAL 35002800-13513430-36363435
CONSOLE USB
EXPORTS [object Object] -
-
Yep, with parity:'e' all the framing errors are gone.
Serial1.setup(100000, {rx:B7,parity:'e',stopbits:2}); Serial1.on('framing', function() { console.log("frame"); }); Serial1.on('parity', function() { console.log("parity"); }); Serial1.on('data', function(data) { console.log(E.toUint8Array(data)); }); Output... new Uint8Array([15]) new Uint8Array([172, 96, 5, 43]) new Uint8Array([88, 193, 10, 86, 176]) new Uint8Array([130, 21, 172, 96, 5]) new Uint8Array([43, 88, 193, 10, 86, 176]) new Uint8Array([130, 21, 0, 0])
0x0F is the startbyte, the following 22 bytes are the payload, then the next byte is for flags which show if the receiver has dropped frames or if the signal has been lost and then the last byte is the endbyte 0x00. The framerate is about 7ms but it wibbles at bit so I can't think of anyway to sync using timing.
The startbyte and endbyte could potentially appear in the payload so I'm watching for 0x00 followed by 0x0F to mark the start of a frame, then when the 25 bytes have been received I check the last byte is 0x00 for validation.
Hers's my code using Serial.on('data'...
/* Module for interfacing with FrSky SBUS radio control receivers Serial1.setup(100000, {rx:B7,parity:'e',stopbits:2}); mysbus = require('SBUSON').connect(Serial1, function(data){ console.log(data); }); */ function decode(frame, callback) { arr = E.toUint8Array(frame); callback({ ch1 : ((arr[0] | arr[1]<<8) & 0x07FF), ch2 : ((arr[1]>>3 | arr[2]<<5) & 0x07FF), ch3 : ((arr[2]>>6 | arr[3]<<2 | arr[4]<<10) & 0x07FF), ch4 : ((arr[4]>>1 | arr[5]<<7) & 0x07FF), ch5 : ((arr[5]>>4 | arr[6]<<4) & 0x07FF), ch6 : ((arr[6]>>7 | arr[7]<<1 | arr[8]<<9) & 0x07FF), ch7 : ((arr[8]>>2 | arr[9]<<6) & 0x07FF), ch8 : ((arr[9]>>5 | arr[10]<<3) & 0x07FF), ch9 : ((arr[11] | arr[12]<<8) & 0x07FF), ch10 : ((arr[12]>>3 | arr[13]<<5) & 0x07FF), ch11 : ((arr[13]>>6 | arr[14]<<2 | arr[15]<<10) & 0x07FF), ch12 : ((arr[15]>>1 | arr[16]<<7) & 0x07FF), ch13 : ((arr[16]>>4 | arr[17]<<4) & 0x07FF), ch14 : ((arr[17]>>7 | arr[18]<<1 | arr[19]<<9) & 0x07FF), ch15 : ((arr[19]>>2 | arr[20]<<6) & 0x07FF), ch16 : ((arr[20]>>5 | arr[21]<<3) & 0x07FF), ch18 : (arr[22] & 0x0001) ? 2047:0, ch19 : ((arr[22] >> 1) & 0x0001) ? 2047:0, framelost : ((arr[22] >> 2) & 0x0001) ? true:false, failsafe : ((arr[22] >> 3) & 0x0001) ? true:false, }); } exports.connect = function (serial, callback) { dest = { state: 'sync', last: '', write : function(data) { switch(this.state){ case 'sync': buff = data; if (this.last === "\x00" && buff.substr(0,1) == "\x0F"){ this.state = 'read'; } break; case 'read': buff += data; if (buff.length > 24) { if (buff.substr(24,1) === "\x00") { this.state = 'sync'; decode(buff.substr(1,23), callback); }else{ buff = buff.substr(buff.length - buff.indexOf("\x0F",1)); } } break; } this.last = data.substr(-1,1); } }; Serial1.on('data', function(data) { dest.write(data); }); };
I seem to have bytes going missing sometimes when the callback's called
-
Here's my code using pipe:
/* Module for interfacing with FrSky SBUS radio control receivers Serial2.setup(100000, {rx:A3,parity:E,stopbits:2}); mysbus = require('SBUS').connect(Serial2, function(data){ console.log(data); }); */ function decode(frame, callback) { arr = E.toUint8Array(frame); callback({ ch1 : ((arr[0] | arr[1]<<8) & 0x07FF), ch2 : ((arr[1]>>3 | arr[2]<<5) & 0x07FF), ch3 : ((arr[2]>>6 | arr[3]<<2 | arr[4]<<10) & 0x07FF), ch4 : ((arr[4]>>1 | arr[5]<<7) & 0x07FF), ch5 : ((arr[5]>>4 | arr[6]<<4) & 0x07FF), ch6 : ((arr[6]>>7 | arr[7]<<1 | arr[8]<<9) & 0x07FF), ch7 : ((arr[8]>>2 | arr[9]<<6) & 0x07FF), ch8 : ((arr[9]>>5 | arr[10]<<3) & 0x07FF), ch9 : ((arr[11] | arr[12]<<8) & 0x07FF), ch10 : ((arr[12]>>3 | arr[13]<<5) & 0x07FF), ch11 : ((arr[13]>>6 | arr[14]<<2 | arr[15]<<10) & 0x07FF), ch12 : ((arr[15]>>1 | arr[16]<<7) & 0x07FF), ch13 : ((arr[16]>>4 | arr[17]<<4) & 0x07FF), ch14 : ((arr[17]>>7 | arr[18]<<1 | arr[19]<<9) & 0x07FF), ch15 : ((arr[19]>>2 | arr[20]<<6) & 0x07FF), ch16 : ((arr[20]>>5 | arr[21]<<3) & 0x07FF), ch18 : (arr[22] & 0x0001) ? 2047:0, ch19 : ((arr[22] >> 1) & 0x0001) ? 2047:0, framelost : ((arr[22] >> 2) & 0x0001) ? true:false, failsafe : ((arr[22] >> 3) & 0x0001) ? true:false, }); } exports.connect = function (serial, callback) { dest = { state: 'sync', last: '', write : function(data) { switch(this.state){ case 'sync': buff = data; if (this.last === "\x00" && buff.substr(0,1) == "\x0F"){ this.state = 'read'; } break; case 'read': buff += data; if (buff.length > 24) { if (buff.substr(24,1) === "\x00") { this.state = 'sync'; decode(buff.substr(1,23), callback); }else{ buff = buff.substr(buff.length - buff.indexOf("\x0F",1)); } } break; } this.last = data.substr(-1,1); } }; serial.pipe(dest,{chunkSize : 25}); };
-
Good suggestion, thanks Gordon, I tried that and got this:
Serial1.setup(100000, {rx:B7,parity:E,stopbits:2}); Serial1.on('framing', function() { console.log("frame"); print(E.toUint8Array(Serial1.read(25))); }); new Uint8Array([15, 174, 112, 133]) frame new Uint8Array([43]) frame new Uint8Array([92]) frame new Uint8Array([225]) frame new Uint8Array([10, 87]) frame new Uint8Array([184, 194, 21, 174, 112, 133]) frame new Uint8Array([43]) frame new Uint8Array([92]) frame new Uint8Array([225]) frame new Uint8Array([10, 87]) frame new Uint8Array(0) frame new Uint8Array(0) frame
-
-
Hi, I'm writing a module to interface with a radio control receiver, the receiver has a serial interface which is like the Futaba SBUS protocol.
I'm piping the serial data, which comes in frames of 25 bytes, to an object with a write method so I've set the chunksize option to 25 but when I console.log the data being written to the object I see randomly sized chucks of 2-8 bytes?
So the module is kind of working now but I want to make some further refinements, I tried using the 'end' and 'complete' options but nothing seems to happen, is it the 'end' of the chunk or something else? I've tried reducing the chunksize. What indicates when the pipe activity is complete or the when source has finished? Are the end/complete functions written like 'function end() {...}' or should they be functions of the object, how would I go about that?
-
yep, works a treat. It's all good