I am using MKR GSM 1400(SAMD21) to get data from 10 different gateways and send those data to cloud.
For saving energy purposes I want the board to go sleep unless I have something in serial1(UART) or if half hour passed ( I am sending data to the cloud every half hour).
I don't have any external interrupt to wake up the board so I am not sure what to do and which sleep I should use.
Is there safe way to use rx as pin for interrupt?
I think you have to write your own "UART" stack to be able to put the SAMD21 into sleep and wake up from a UART RX interrupt. All the code I've seen here so far continuously use the "Serial.available()" polling or something to determine if data is in the UART buffer.
Do you know how to make the board sleep and listen to uart?
I do, but the first thing you have to tackle is how to reconfigure the SERCOM to allow receive interrupts. I have this code, but probably won't work with yours without substantial changes. The clocking mechanism on the SAMD21 (or Cortex in general) are so complicated that it's not very easy to adapt a working software....
You can try something like this
loop()
{
if(Serial.available())
{
char data = Serial.read();
// do something
}
LowPower.sleep();
}
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.
