Most recent activity
-
- 52 comments
- 14,092 views
-
-
Aha, that must be it!
I had misunderstood deep sleep and thought things would work like normal from the time it wakes up until it's done doing stuff. Classic example of RTFM :)
Espruino can't be woken by Serial/USART traffic (and will not receive data while in Deep Sleep). (…) To work around this, you'd need to implement RTS/CTS flow control in software (waking Espruino on RTS, and only setting CTS after setDeepSleep(0) has been called).
SIM7000 does support RTS/CTS hardware flow control, so I'll try that. Thank you!
Edit: The shield didn't though, so I ended up disabling/enabling it manually.
-
I've bought a shiny new SIM7000 GSM/LTE module that I've managed to get working with Espruino Pico.
My problem is that the USART interface stops working when I disconnect the Pico from the USB port and power it from a LiPo battery. I first used
Serial1
withUSB.setConsole(true)
, then triedSerial2
instead, without noticing any difference. The code runs fine, logging any errors to an array so I can check it later. But the USART connection goes quiet as soon as USB is disconnected – any AT commands sent to the module never get a response. If I connect it to the USB port again and use the Web IDE, everything is back to normal.What could be going on? Is there something obvious that I've missed when setting up USART?
I should mention that I've actually made my own version of the AT module, using promises instead of callbacks, plus a few other changes that I needed in order to get it to work with SIM7000 (and to understand what it was doing – really good programming excercise!). While the bug could lie somewhere in that code, it does work perfectly fine when connected to USB.
Relevant excerpts from my code (yes, no semicolons!):
const USART = Serial2 const BAUD = 115200 const PWRKEY = B4 const at = require('AT').setup(USART) // Enable the PWRKEY pin pinMode(PWRKEY, 'output') // Enable Espruino's deep sleep mode setDeepSleep(true) // Deal with any uncaught exceptions process.on('uncaughtException', logError) E.on('init', () => { USB.setConsole(true) USART.setup(BAUD) }) function test() { digitalPulse(PWRKEY, LOW, 100) // Power on // Listen for "SMS Ready" URC, time out after 10 seconds at.listen('SMS Ready', 10000) // similar to at.register() in the official module .then(…) // do stuff .catch(logError) // logs error to an array for later retrieval // When connected to USB, it receives "SMS Ready" 100% of the time // When connected to battery only, the SIM7000 module powers on but at.listen() times out with nothing being received // When connected back to USB again (without rebooting), AT commands are received }
I'm programming the Pico from the Web IDE using "Save on Send: Direct to Flash".
I've also tried putting
USB.setConsole(true)
at the very top of the code.Any help would be greatly appreciated!
-
No, not at all - I was only joking :)
Even still, I felt like an ungrateful kid begging for icecream after having been served a delicious cake :)
I actually have checked whether
for…of
was supported, but never thought of suggesting it here! Maybe it's been overlooked because iterators and loops are not as attractive as arrow keys and async/await.. -
Shouldn't be too hard to implement, should it? :)
Here you go https://github.com/espruino/Espruino :)
Now I regret saying that :) It came off wrong, sorry if it sounded like writing features for Espruino is easy! I'm sure it would take many hours to implement this, and I know you're not getting paid by the hour to work on Espruino. Instead I should thank you for making and continuously improving Espruino for free, and for providing such great support!
I looked around for JS polyfills for
Map
andSet
, and found one that was used by Firefox Nightly and Chrome Dev when the features were under the Enable Experimental JavaScript flag. It's also the smallest that I found (6KB, 2.77KB minified) and claims to have good performance.https://github.com/WebReflection/es6-collections
https://raw.githubusercontent.com/WebReflection/es6-collections/master/index.jsAs far as I can tell, it actually does roughly what your bodged up implementation does :)
I tested it on a Pico (had to move the exported functions to the bottom) and it seems to work fine, except for two issues:
- Although it shims iterators, Espruino doesn't support iterators or
for…of
(good point!) - The
.size
property is missing (requires support for getters inObject.defineProperty
)
https://gist.github.com/joakim/e70a8c1bb82b3cce32092cccfb99701d
Despite those issues, I'll give it a try on a project I'm working on later and see how it goes.
- Although it shims iterators, Espruino doesn't support iterators or
-
Oops, I merged a pull request too quickly.
I haven't released the latest changes on NPM though, so if you fetch the module using
npm install rollup-espruino
it should work (that is, use v0.2.1).. The updated example configuration in the README should be correct though, while the one in v0.2.1 may no longer work.I'll be working on this plugin soon, and will iron out any issues then. Hopefully in a few days!
Found this interesting tidbit in a thread some months back:
I've been secretly hoping for an Espruino board based on nRF91, so if this happens I'd be first in line to buy a few!
I know nRF91 is not production ready yet, but planned to be released later this year if I'm not mistaken. Is it still something you're just considering, or do you have concrete plans for doing something with it?
LTE M/NB-IoT is being rolled out at the end of the year here in Norway, which is nicely timed with the release of nRF91. Safe to say, I'd be very interested in an Espruino product with nRF91 some time thereafter :)
Just let me know if there's anything I can do to help, or if you're interested in hearing what I'm looking for in an LTE M/NB-IoT solution like this.