• Hi,

    The issue is actually setDeepSleep(true) - basically this stops Espruino's high speed oscillator from running when it's idle, but that also stops the UART from receiving any data. It works on USB because Espruino knows when it's connected to USB there's no issue with power consumption, so it doesn't sleep.

    The simplest solution would be to keep setDeepSleep(false) whenever the SIM7000 is on, and only turn setDeepSleep(true) when you've got the SIM7000 off.

    However, if the SIM7000 can implement RTS/CTS flow control, you can toggle setDeepSleep pretty easily. You just do something like:

    setWatch(function(e) {
      if (e.state) { // NOT ready to send
        digitalWrite(CTS,1);
        setDeepSleep(true)
      } else { // ready to send
        setDeepSleep(false)
        digitalWrite(CTS,0);
      }
    }, RTS, {repeat:true});
    

    I'm pretty sure the polarity is normally inverted, but you might have to do some tests to make sure :)

  • 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.

About

Avatar for Joakim @Joakim started