From abe5b272c6dab1c6d91492b218b7df50e1f463e7 Mon Sep 17 00:00:00 2001 From: Linar Yusupov Date: Wed, 28 Apr 2021 10:02:01 +0300 Subject: [PATCH] nRF52: increased watchdog timeout value [skip ci] --- README.md | 4 ++-- software/firmware/source/SoftRF/src/platform/nRF52.cpp | 2 +- .../source/libraries/Adafruit_SleepyDog/README.md | 3 +-- .../libraries/Adafruit_SleepyDog/library.properties | 4 ++-- .../libraries/Adafruit_SleepyDog/utility/WatchdogAVR.cpp | 9 +++++---- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 09a0997e2..99d8e733f 100644 --- a/README.md +++ b/README.md @@ -53,10 +53,10 @@ GNSS|Model(s)|First appearance|       Status& ---|:---:|:---:|:---:|--- Generic
NMEA|[Standalone](https://github.com/lyusupov/SoftRF/wiki/Standalone-Edition)|Q4 2016|![](https://via.placeholder.com/140x70/00A000/000000?text=Good)|  [U-blox](https://en.wikipedia.org/wiki/U-blox)
6/7/8|1 [**Prime Mark II**](https://github.com/lyusupov/SoftRF/wiki/Prime-Edition-MkII)
2 [Retro](https://github.com/lyusupov/SoftRF/wiki/Retro-Edition)
3 [**Uni Edition**](https://github.com/lyusupov/SoftRF/wiki/Uni-Edition)|Q2 2018|![](https://via.placeholder.com/140x70/00A000/000000?text=Good)|  -[Hangzhou ZhongKe](http://www.icofchina.com/)
AT6558|[**Prime Mark II**](https://github.com/lyusupov/SoftRF/wiki/Prime-Edition-MkII)|Q2 2019|![](https://via.placeholder.com/140x70/00A000/000000?text=Good)|  +[Hangzhou ZhongKe](http://www.icofchina.com/)
AT6558|[1 **Prime Mark II**](https://github.com/lyusupov/SoftRF/wiki/Prime-Edition-MkII)
2 [**Mini**](https://github.com/lyusupov/SoftRF/wiki/Mini-Edition)
3 Badge|Q2 2019|![](https://via.placeholder.com/140x70/00A000/000000?text=Good)|  [Sony
CXD5603GF](https://www.sony-semicon.co.jp/e/products/lsi/gps/product.html)|[**Dongle**](https://github.com/lyusupov/SoftRF/wiki/Dongle-Edition)|Q4 2019|![](https://via.placeholder.com/140x70/00A000/000000?text=Good)|  [MediaTek](https://en.wikipedia.org/wiki/MediaTek)
MT3339|1 [**Raspberry**](https://github.com/lyusupov/SoftRF/wiki/Raspberry-Edition)
2 [**Uni**](https://github.com/lyusupov/SoftRF/wiki/Uni-Edition)|Q3 2020|![](https://via.placeholder.com/140x70/00A000/000000?text=Good)|  -[GOKE](http://www.goke.com/en/)
GK9501|1 [**Mini**](https://github.com/lyusupov/SoftRF/wiki/Mini-Edition)
2 Badge|Q3 2020|![](https://via.placeholder.com/140x70/00A000/000000?text=Good)|  +[GOKE](http://www.goke.com/en/)
GK9501|[**Mini**](https://github.com/lyusupov/SoftRF/wiki/Mini-Edition)|Q3 2020|![](https://via.placeholder.com/140x70/00A000/000000?text=Good)|  # Documentation diff --git a/software/firmware/source/SoftRF/src/platform/nRF52.cpp b/software/firmware/source/SoftRF/src/platform/nRF52.cpp index ed3a482de..8ece02fa2 100644 --- a/software/firmware/source/SoftRF/src/platform/nRF52.cpp +++ b/software/firmware/source/SoftRF/src/platform/nRF52.cpp @@ -1143,7 +1143,7 @@ static void nRF52_UATModule_restart() static void nRF52_WDT_setup() { - Watchdog.enable(8000); + Watchdog.enable(12000); } static void nRF52_WDT_fini() diff --git a/software/firmware/source/libraries/Adafruit_SleepyDog/README.md b/software/firmware/source/libraries/Adafruit_SleepyDog/README.md index 025f4bd3d..b72b13ba7 100644 --- a/software/firmware/source/libraries/Adafruit_SleepyDog/README.md +++ b/software/firmware/source/libraries/Adafruit_SleepyDog/README.md @@ -10,5 +10,4 @@ Currently supports the following hardware: * Adafruit Feather M4 (ATSAMD51). * Arduino Leonardo or other 32u4-based boards (e.g. Adafruit Feather) WITH CAVEAT: USB Serial connection is clobbered on sleep; if sketch does not require Serial comms, this is not a concern. The example sketches all print to Serial and appear frozen, but the logic does otherwise continue to run. You can restore the USB serial connection after waking up using `USBDevice.attach();` and then reconnect to USB serial from the host machine. * Partial support for Teensy 3.X and LC (watchdog, no sleep). - -Adafruit Trinket and other boards using ATtiny MCUs are NOT supported. +* ATtiny 24/44/84 and 25/45/85 diff --git a/software/firmware/source/libraries/Adafruit_SleepyDog/library.properties b/software/firmware/source/libraries/Adafruit_SleepyDog/library.properties index d5c32c7db..6010bf494 100644 --- a/software/firmware/source/libraries/Adafruit_SleepyDog/library.properties +++ b/software/firmware/source/libraries/Adafruit_SleepyDog/library.properties @@ -1,9 +1,9 @@ name=Adafruit SleepyDog Library -version=1.3.2 +version=1.4.0 author=Adafruit maintainer=Adafruit sentence=Arduino library to use the watchdog timer for system reset and low power sleep. paragraph=Arduino library to use the watchdog timer for system reset and low power sleep. category=Other url=https://github.com/adafruit/Adafruit_SleepyDog -architectures=* +architectures=avr,samd,nrf52,teensy diff --git a/software/firmware/source/libraries/Adafruit_SleepyDog/utility/WatchdogAVR.cpp b/software/firmware/source/libraries/Adafruit_SleepyDog/utility/WatchdogAVR.cpp index 63d7b2c3e..cb5e3446f 100644 --- a/software/firmware/source/libraries/Adafruit_SleepyDog/utility/WatchdogAVR.cpp +++ b/software/firmware/source/libraries/Adafruit_SleepyDog/utility/WatchdogAVR.cpp @@ -55,13 +55,14 @@ int WatchdogAVR::sleep(int maxPeriodMS) { // watchdog reset only triggers the interrupt (and wakes from deep sleep) // and not a full device reset. This is a timing critical section of // code that must happen in 4 cycles. - WDTCSR |= (1 << WDCE) | (1 << WDE); // Set WDCE and WDE to enable changes. - WDTCSR = wdps; // Set the prescaler bit values. - WDTCSR |= (1 << WDIE); // Enable only watchdog interrupts. + _WD_CONTROL_REG |= + (1 << WDCE) | (1 << WDE); // Set WDCE and WDE to enable changes. + _WD_CONTROL_REG = wdps; // Set the prescaler bit values. + _WD_CONTROL_REG |= (1 << WDIE); // Enable only watchdog interrupts. // Critical section finished, re-enable interrupts. sei(); - // Disable USB if it exists +// Disable USB if it exists #ifdef USBCON USBCON |= _BV(FRZCLK); // freeze USB clock PLLCSR &= ~_BV(PLLE); // turn off USB PLL