-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When trying to connect to GSM with arduino GSM1400. Watchdog timer resets the board #22
Comments
I've a problem like yours. The code runs smoothly if I remove the line Basic Code:
|
Hi, I think it’s better to use the RTC Zero library. I use it instead of the sleepy dog library and works much better. |
I've tested using an LCD to display (because the USB doesn't work after waking it up) that uses SPI communication and it worked. |
@martinl1, did u managed to make the USB/Serials work after waking the board up? |
@SWoto I don't know who MartinL1 is in this thread, but this code works for me:
|
With this code, even though I can still see the USB, I can't print anything. However the code is still working, except for the Serial, the LED keep blinking in the correct time.
With
If I use the |
I'm testing it with a SparkFun Thing Plus - SAMD51. Full code: #include <Adafruit_SleepyDog.h>
int times = 0;
int sleepMS = 0;
void setup() {
pinMode(LED_BUILTIN, OUTPUT);
digitalWrite(LED_BUILTIN, HIGH); // Show we're awake
Serial.begin(115200);
while(!Serial); // wait for Arduino Serial Monitor (native USB boards)
Serial.println("Adafruit Watchdog Library Sleep Demo!");
Serial.println();
}
void loop() {
Serial.println("Going to sleep in one second...");
delay(3000);
USBDevice.detach();
digitalWrite(LED_BUILTIN, LOW); // Show we're asleep
sleepMS = Watchdog.sleep(4000);
digitalWrite(LED_BUILTIN, HIGH); // Show we're awake again
USBDevice.init();
USBDevice.attach();
Serial.print("I'm awake now! I slept for ");
Serial.print(sleepMS, DEC);
Serial.println(" milliseconds.");
Serial.println();
times += 0;
} |
Try commenting out this line: It should look like this: |
@Rock-N-RollaMann, thanks for your fast reply. The board would only get stuck there if the board had, somehow, reseted itself. Otherwise it shouldn't go back to the setup... |
I commented some parts of the code and also removed the USBDevice.dettach() so I could see the logs.
We can see in the line 247 that the USB is disabled and than enabled (don't know why it does it just after disabling it). __WFI(); // Wait for interrupt (places device in sleep mode)
Serial.println("after: before __DSB() and __WFI()");
USB->DEVICE.CTRLA.bit.ENABLE = 1; // Enable the USB peripheral
Serial.println("sleep: After USB->DEVICE.CTRLA.bit.ENABLE = 1;");
while (USB->DEVICE.SYNCBUSY.bit.ENABLE)
; // Wait for synchronization But the only thing that changed was that I lost the usb connection earlier than before... To make sure that the problem isn't with the USBDevice, I removed the Watchdog and used a simple delay and it worked, the USB "goes out", wait for the delay and them "comes back" and print in the Serial Monitor. Serial.println("Going to sleep in three second...");
delay(2500);
digitalWrite(LED_BUILTIN, LOW); // Show we're asleep
USBDevice.detach();
delay(2500);
digitalWrite(LED_BUILTIN, HIGH); // Show we're awake again
USBDevice.init();
USBDevice.attach();
delay(5000);
Serial.print("I'm awake now! I slept for ");
Serial.print(sleepMS, DEC);
Serial.println(" milliseconds.");
Serial.println();
times += 0; |
Coming back to the inital issue:
I also have the same annoying behavior - this library seems to be just incompatible with MKR GSM 1400 as soon as you try to open the GSM connection, and even without putting the board asleep! Or does anyone has a workaround to make it work? |
The issue is IMHO that when the SAMD is interupted by the watchdog, it doesn't read the serial AT console and some bytes get lost. Can lead to a freeze but it's flaky behaviour. The modem is full computer and doesn't know that the SAMD is not listening. |
I am trying to use the sleepydog library in a project that i am building that uses the GSM1400 arduino Board. The library works fine always until you try to connect with the arduino library to GSM network. If you disable the watchdog, the GSM connection is successful and works normally. And when i say it resets the board, the reset is immediate, it does not occur after the time that the watchdog is setup passes. Any ideas?
The text was updated successfully, but these errors were encountered: