Uart callback while sleeping


it’s still not clear to me if the imp can wakeup from sleeping when receiving data in the uart receive buffer. Should I declare a callback function in the uart configuration and declare a wakeup ?

UART events, just like DIGITAL_IN events and server events, will wake the imp from imp.wakeup() but not from imp.sleep() or server.sleepfor().


Thank You Peter, that´s perfect for what I plan to do : reading my home electricity meter which sends serial data every 30 seconds to the serial port of the imp :wink:
Now I have do deal with the important amount of data which exceeds the buffer size…

jee, I have my home electricity meter sendig pulses to my imp without any additional hardware, just the sensors.
Why so complicated?

yeah, you are right, I could do like you…but I did’t want my imp to be alive 100% of the time and counting pulses. My electricity meter can be configured to send serial data with a lot of interresting data, and this represents around 1K byte at each time…and this reading could be done asynchronously, when ever you want, once à minute or once an hour, so in the mean time the imp can return sleeping…

If you use imp.enablepowersave(true), the imp power consumption drops from ~90mA to ~7mA (and this will go down further with future releases), whilst being fully awake and able to receive serial, etc.

The power may be slightly higher depending on peripheral use, but it’s still a big power saving whilst being awake.

When the imp is sleeping (not imp.sleep, server.sleepfor), the clocks and peripherals are off and hence nothing will get received.

OK Hugo, but now I’m a bit lost again : does it mean that if I use imp.wakeup(), the callback function from serial receive will not be launched because the imp is sleeping ?