-
• #27
I have the same issue if "Save on send" is enabled.
function tempTo2a6e(temp) { var f = parseFloat(temp.toFixed(2)) * 100; if (tempTo2a6e.buf === undefined) tempTo2a6e.buf = new Uint8Array(2); tempTo2a6e.buf[0] = f & 0xff; tempTo2a6e.buf[1] = f >> 8 & 0xff; return tempTo2a6e.buf; } NRF.on('connect', function(){ digitalPulse(LED2, 1, 250); }); NRF.setServices({ 0x181A: { // Health Thermometer 0x2A6E: { // Temperature readable: true, value : tempTo2a6e(E.getTemperature()) }}, 0x180F : { // Battery Service 0x2A19: { // Battery Level readable: true, notify: true, value : [Puck.getBatteryPercentage()] }}}); setInterval(function(){ NRF.updateServices({ 0x181A: { // Health Thermometer 0x2A6E: { // Temperature value : tempTo2a6e(E.getTemperature()) }}, 0x180F: { 0x2A19: { value : [Puck.getBatteryPercentage()] } } }); }, 60000);
After few seconds, i get this error:
Writing...ERROR: Prompt not detected - upload failed. Trying to
recover... Compressed 32000 bytes to 956 Checking... Flash Magic Byte
is wrong There were 1 errors! Uncaught InternalError: Timeout on
jshFlashErasePage at line 1 col 1005 ...\n }\n });\n},
60000);");load(); -
• #28
@dklinkman and you can get it pretty reliably with the code that you posted? Please can you try doing the
peek32
posted above as well?The odd thing is that in @stevie4711's case it looks like the flash memory is empty - so it could be that there's actually some bug in the flash memory writing that causes a crash (rather than is being something to do with what is stored in flash).
-
• #29
@Gordon, yes pretty reliably with that code. I did it just now and I recreated the issue within 60 seconds. I had 2-3 successful saves before the one that failed.
Console:
>save() =undefined BLE Connected, so queueing service update for later Erasing Flash... Disconnected
Here are the results of the peeks after popping the battery and reconnecting:
>peek32(479232) =4294967295 >peek32(479236) =4294967295 >
-
• #30
I just had this issue in a 1v91 flashed puck (not the Uncaught Syntax error, but disconnections on
save()
andE.setBootCode()
). I canreset()
just fine, but it still crashes onsave()
. Can't remember what exactly I did to trigger this, but I was messing withNRF
and listening for button presses to sleep/wake BLE. And I did have "save on send" enabled by accident. I also did a lot of hardware reset,reset()
,save()
andE.setBootCode()
(roughly in that order) to try to fix things, but apparently I broke things even more :/The peek functions return the same as the others here, and the
erasePage
calls solved it. -
• #31
Next time it happens, please could you do:
for (var i=(120-3)*4096;i<120*4096;i+=32) { var s = i.toString(16); for (var x=0;x<32;x+=4) s+=" "+("00000000"+peek32(i+x).toString(16)).substr(-8); console.log(s); }
And post up what it reports?
That'll dump all the contents of the saved code area (which will probably take 30 seconds or so), but it should help me reproduce what's happening.
-
• #32
Having similar issues, I've been setting NRF Services and trying to save the code getting disconnects. I've manged to do a reset ( insert battery, hold button, wait for self test to finish ) then ran your code above and tried a save() ... disconnected. I think only the last part of the log is the interesting part "BT> SEND ERROR: NotSupportedError: GATT operation failed for unknown reason."
BT> Sending "s" BT> Sent BT> RX:"s" BT> Sending "a" BT> Sent BT> RX:"a" BT> Sending "c" BT> Sent BT> RX:"c" BT> Sending "v" BT> Sent BT> Sending "e" BT> RX:"v" BT> Sent BT> RX:"e" BT> Sending "\b" BT> Sent BT> RX:"\b \b" BT> Sending "\b" BT> Sent BT> RX:"\b \b" BT> Sending "\b" BT> Sent BT> RX:"\b \b" BT> Sending "v" BT> Sent BT> RX:"v" BT> Sending "e" BT> Sent BT> RX:"e" BT> Sending "(" BT> Sent BT> RX:"(" BT> Sending ")" BT> Sent BT> RX:")" BT> Sending "\r" BT> SEND ERROR: NotSupportedError: GATT operation failed for unknown reason. Disconnect callback... WARNING: [notify_warn] Disconnected >>> Disconnected
-
• #33
@Gordon Im not sure what the difference is but once a save from the command line stops working the only way I can get it back it be blanking out the code window and setting save on load and saving. Once that save is done, running save() on the command line works !
Connected > >dump() pinMode(D29, "input_pulldown", true); =undefined >save() Disconnected Connected > >dump() pinMode(D29, "input_pulldown", true); =undefined > _____ _ | __|___ ___ ___ _ _|_|___ ___ | __|_ -| . | _| | | | | . | |_____|___| _|_| |___|_|_|_|___| |_| http://espruino.com 1v91 Copyright 2016 G.Williams >Erasing Flash..... Writing... Compressed 32000 bytes to 8 Checking... Done! Loading 8 bytes from flash... =undefined >dump() pinMode(D29, "input_pulldown", true); =undefined >save() =undefined Erasing Flash..... Writing.... Compressed 32000 bytes to 1174 Checking... Done! >dump() pinMode(D29, "input_pulldown", true); =undefined > _____ _ | __|___ ___ ___ _ _|_|___ ___ | __|_ -| . | _| | | | | . | |_____|___| _|_| |___|_|_|_|___| |_| http://espruino.com 1v91 Copyright 2016 G.Williams >Erasing Flash..... Writing... Compressed 32000 bytes to 8 Checking... Done! Loading 8 bytes from flash... =undefined >load() =undefined Loading 8 bytes from flash... >dump() pinMode(D29, "input_pulldown", true); =undefined > 1 SENT
-
• #34
@Adam79 what I'm after is what's printed on the left hand side of the IDE. It should look like:
75000 00000000 00075008 00000000 ffffffff ffffffff ffffffff ffffffff ffffffff 75020 ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff 75040 ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff 75060 ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff 75080 ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff 750a0 ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ...
But probably without the FFs - you want to just paste the code right into the left hand side (not upload via the right).
-
• #35
@Gordon a dead end ?
Connected > >dump() pinMode(D29, "input_pulldown", true); =undefined >for (var i=(120-3)*4096;i<120*4096;i+=32) { : var s = i.toString(16); : for (var x=0;x<32;x+=4) : s+=" "+("00000000"+peek32(i+x).toString(16)).substr(-8); : console.log(s); :} 75000 ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff 75020 ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff 75040 ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff 75060 ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ... 77f60 ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff 77f80 ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff 77fa0 ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff 77fc0 ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff 77fe0 ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff deadbeef =undefined >save() Disconnected
-
• #36
also a reconnect after is non responsive, but a second connection works
>save() Disconnected Connected > Disconnected Connected > >dump() pinMode(D29, "input_pulldown", true); =undefined >
-
• #37
and the code
NRF.on('connect', function(addr) { digitalWrite(LED3,1); setTimeout(function () { digitalWrite(LED3,0); }, 750); }); NRF.on('disconnect', function(addr) { digitalWrite(LED1,1); setTimeout(function () { digitalWrite(LED1,0); }, 750); } ); NRF.setServices({ 0x1809 : { // Temp 0x2A6E: { // Temperature readable: true, value : [E.getTemperature().toFixed(2)] }}, 0x180F : { // Battery Service 0x2A19: { // Battery Level readable: true, value : [Puck.getBatteryPercentage().toFixed(0)] } } });
-
• #38
Actually no, that looks like it's helped a huge amount :)
I just reproduced it (deleted the first flash page, so my working Puck looked just like yours) and
save()
which worked fine before is now broken.So I'm pretty sure I know what the problem is and I can get a fix done for it - I'll try and get something sorted tomorrow morning.
-
• #39
Ok - thanks for you help! It's fixed now - it'll be in the 1v92 release
-
• #40
Winner ! :-)
-
• #42
What is it? If it's different problem then please can you post up in a new thread?
1v92 might be a week or two unless the saving is really causing a lot of trouble - right now there aren't any other fixes in it.
At some point I'll try and get cutting-edge builds for it set up - at least then it'd be easy to check out the current changes.
-
• #43
UPDATED: think the issue is an xcode caching issue
Yesterday I was developing an IOS app that connects to the puck and was working fine. I then hit the save issues. Now my app is getting null values when querying the services characteristics. Using Ligthblue (ble app) from OSX I can read the values fine.
console output from xcode
Puck.js de81 <CBService: 0x174261d00, isPrimary = YES, UUID = 6E400001-B5A3-F393-E0A9-E50E24DCCA9E> <CBService: 0x174261240, isPrimary = YES, UUID = Health Thermometer> <CBService: 0x17407fe00, isPrimary = YES, UUID = Battery> <CBCharacteristic: 0x1700b66e0, UUID = 2A6E, properties = 0x2, value = (null), notifying = NO> <CBCharacteristic: 0x1740b4c40, UUID = Battery Level, properties = 0x2, value = (null), notifying = NO> Disconnected from <CBPeripheral: 0x1740ff600, identifier = E96AFB2C-C040-4B7D-B7E8-99E5DC5C7614, name = Puck.js de81, state = disconnected>
I believe the issue started when playing with notify: true with the characteristics on the puck side of things, but with the save issue and this bug I lost track a little. So I was going to wait for 1.92 before I fully looked into the issue.
Also is there a function to list the pucks current services/characteristics ? without using external software ? something like NRF.getServices() ?
-
• #44
I'm afraid there isn't anything to list the services/characteristics - Espruino hands them over to the Bluetooth stack and it's a bit of a pain getting full info back.
But if you have any other issues with this, could you start a new thread? This one's already getting pretty confusing for anyone trying to find out why
save()
isn't working :)
It happened to me with various code snippets as far as I know. As simple as setting an interval which blinks an LED.