Deep sleep serial monitor and flashing

in my firmware, I have a device set to periodically awake from deep sleep and publish some readings.

I do not have access to the electron board itself when it is inside its’ enclosure so I have a couple of issues I would like to address.

  1. is there a simple way to have a button which wakes the device from deep sleep and allows me to flash firmware to it (maybe put it into DFU mode or safe mode?)

  2. I have debugging coming through the serial monitor (using the arduino IDE or particle dev app) but whenever it goes into deep sleep it disconnects. Is there a way to make it automatically re-connect upon waking so I don’t have to keep pressing re-connect and invariably missing half of the serial data?

  1. Yes you can use the WKP pin - maybe even with a reed switch to keep the housing sealed.
    But why DFU or Safe Mode - you can check the WKP pin to keep the device from going back to sleep and hence accept OTA update.

  2. This is a “problem” with the terminal programs and OS, not with the devices.
    You can use CLI particle serial monitor --follow. This will permanently monitor the connection and try to connect once the device is recognised.

1 Like

Thank you, both of those are very useful pieces of information.

Great idea on the reed switch!

My thinking about modes was only that if I want to monitor the serial and then possibly flash over serial (which I guess requires listening mode actually)

I wonder whether I could somehow hookup WKP or listening mode to USB so that if the device connects to USB it wakes up and enters listening mode. That could be useful

You could use a comperator that only triggers when Vin exceeds 4.3V (or > Li+ voltage) to drive WKP high, but that will introduce some extra power draw - how much depends on implementation.