- Important Notes for Portenta_H7
- Why do we need this DoubleResetDetector_Generic library
- Changelog
- Prerequisites
- Installation
- Packages' Patches
- 1. For Adafruit nRF52840 and nRF52832 boards
- 2. For Teensy boards
- 3. For Arduino SAM DUE boards
- 4. For Arduino SAMD boards
- 5. For Adafruit SAMD boards
- 6. For Seeeduino SAMD boards
- 7. For STM32 boards
- 8. For RP2040-based boards using Earle Philhower arduino-pico core
- 9. For Portenta_H7 boards using Arduino IDE in Linux
- 10. For RTL8720DN boards using AmebaD core
- 11. For SAMD21 and SAMD51 boards using ArduinoCore-fab-sam core
- 12. For Seeeduino RP2040 boards
- 13. For Seeeduino nRF52840 boards
- Purpose
- How It Works
- Examples
- Example checkWaitingDRD
- Debug Terminal Output Samples
- 1. SAMD_WiFiNINA on SAMD NANO_33_IOT using FlashStorage_SAMD
- 2. minimal on RASPBERRY_PI_PICO using LittleFS
- 3. minimal on MBED RASPBERRY_PI_PICO using LittleFS
- 4. minimal on Nano RP2040 Connect using LittleFS
- 5. minimal on Rtlduino RTL8720DN using FlashStorage
- 6. minimal on Nano 33 BLE using LittleFS
- 7. minimal on PORTENTA_H7_M7 using LittleFS
- Libraries using ESP_DoubleResetDetector or DoubleResetDetector_Generic library
- Debug
- Troubleshooting
- Issues
- TO DO
- DONE
- Contributions and Thanks
- Contributing
- License
- Copyright
The LittleFS of the new Portenta_H7 board currently tested OK with only maximum 8 files. The files, from 9 and up, somehow strangely can't be written and / or read. This is possibly a bug in the ArduinoCore-mbed mbed_portenta core
. The same behaviour is observed from core v2.0.0 up to v2.4.1.
If LittleFS size is reduced to 1024KB, test is OK with only maximum 4 files.
Beware and keep checking for updates.
Why do we need this DoubleResetDetector_Generic library
DoubleResetDetector_Generic is a library for the Arduino AVR, Teensy, SAM DUE, SAMD21, SAMD51, STM32F/L/H/G/WB/MP1, nRF52, RASPBERRY_PI_PICO, RTL8720DN, Nano_33_BLE, Portenta_H7, etc. boards to detects a double reset, within configurable timeout (default 10s) seconds, so that an alternative start-up mode can be used. Example use cases are to allow re-configuration of a device's WiFi / MQTT / Blynk credentials.
The RP2040-based boards, such as Nano RP2040 Connect, RASPBERRY_PI_PICO, ADAFRUIT_FEATHER_RP2040 and GENERIC_RP2040, are currently supported using Earle Philhower's arduino-pico core or Arduino mbed OS for RP2040/Nano boards.
This library is based on, modified, bug-fixed and improved from Stephen Denne's DoubleResetDetector
and Khoi Hoang's ESP_DoubleResetDetector
to add support for AVR, Teensy, SAM DUE, SAMD, STM32, nRF52, RTL8720DN, RP2040-based boards, Nano_33_BLE, Portenta_H7, etc.
Currently, DoubleResetDetector
only supports ESP8266 using RTC memory, and ESP_DoubleResetDetector
only ESP8266 and ESP32.
This library can be used to detect a double reset within a predetermined time to force the program to enter a special operation such as Config Portal, Clear Default Data, etc., using :
- EEPROM for AVR, Teensy boards.
FlashStorage_SAMD library
for SAMD21 and SAMD51 boards (ZERO, MKR, NANO_33_IOT, M0, M0 Pro, AdaFruit Itsy-Bitsy M4, etc.)FlashStorage_STM32F1 library
for STM32F1 and STM32F3 boardsFlashStorage_STM32 library
for STM32F/L/H/G/WB/MP1 boardsDueFlashStorage library
for SAM DUEAdafruit's LittleFS/InternalFS
for nRF52- LittleFS for RP2040-based boards, such as RASPBERRY_PI_PICO, ADAFRUIT_FEATHER_RP2040 and GENERIC_RP2040 using Earle Philhower's arduino-pico core
- LittleFS for RP2040-based boards, such as Nano RP2040 Connect, RASPBERRY_PI_PICO, ADAFRUIT_FEATHER_RP2040 and GENERIC_RP2040 using Arduino mbed OS for RP2040/Nano boards.
FlashStorage_RTL8720 library
for Realtek RTL8720DN, RTL8722DM, RTL8722CSM, etc.- LittleFS for MBED nRF52840-based boards, such as Nano_33_BLE, Nano_33_BLE_Sense using Arduino mbed OS for Nano boards.
- LittleFS for Portenta_H7 boards, using Arduino mbed_portenta core for Portenta boards.
This DoubleResetDetector_Generic library currently supports these following boards:
- nRF52 boards, such as
- AdaFruit Feather nRF52832, nRF52840 Express, BlueFruit Sense, Itsy-Bitsy nRF52840 Express, Metro nRF52840 Express, NINA_B302_ublox, NINA_B112_ublox, etc.
-
- Sparkfun Pro nRF52840 Mini
-
SAM DUE
-
SAMD21
- Arduino SAMD21: ZERO, MKRs, NANO_33_IOT, etc.
- Adafruit SAMD21 (M0): ItsyBitsy M0, Feather M0, Feather M0 Express, Metro M0 Express, Circuit Playground Express, Trinket M0, PIRkey, Hallowing M0, Crickit M0, etc.
- Seeeduino: LoRaWAN, Zero, Femto M0, XIAO M0, Wio GPS Board, etc.
- SAMD51
- Adafruit SAMD51 (M4): Metro M4, Grand Central M4, ItsyBitsy M4, Feather M4 Express, Trellis M4, Metro M4 AirLift Lite, MONSTER M4SK Express, Hallowing M4, etc.
- Seeeduino: Wio Terminal, Grove UI Wireless
-
Teensy (4.1, 4.0, 3.6, 3.5, 3,2, 3.1, 3.0, LC)
-
AVR Mega1280, 2560, ADK.
-
STM32F/L/H/G/WB/MP1 boards
- Nucleo-144
- Nucleo-64
- Discovery
- Generic STM32F0, STM32F1, STM32F2, STM32F3, STM32F4, STM32F7 (with 64+K Flash): x8 and up
- STM32L0, STM32L1, STM32L4, STM32L4
- STM32G0, STM32G4
- STM32H7
- STM32WB
- STM32MP1
- LoRa boards
- 3-D printer boards
- Generic Flight Controllers
- Midatronics boards
-
RP2040-based boards, such as RASPBERRY_PI_PICO, ADAFRUIT_FEATHER_RP2040 and GENERIC_RP2040, using Earle Philhower's arduino-pico core.
-
RP2040-based boards, such as Nano RP2040 Connect, using Arduino mbed OS for Nano boards.
-
RP2040-based boards, such as RASPBERRY_PI_PICO, ADAFRUIT_FEATHER_RP2040 and GENERIC_RP2040, using Arduino-mbed RP2040 core
-
Realtek RTL8720DN, RTL8722DM, RTL8722CSM, etc., using
Arduino AmebaD core
-
MBED nRF52840-based boards such as Nano_33_BLE, Nano_33_BLE_Sense, etc. using Arduino-mbed mbed_nano core
-
Portenta_H7 using Arduino-mbed mbed_nano core
-
Arduino Core for STM32 v2.3.0+
for STM32 boards. -
Teensy core 1.57+
for Teensy (4.1, 4.0, 3.6, 3.5, 3,2, 3.1, 3.0, LC) boards -
Arduino SAM DUE core 1.6.12+
for SAM DUE ARM Cortex-M3 boards -
Arduino SAMD core 1.8.13+
for SAMD ARM Cortex-M0+ boards. -
Adafruit SAMD core 1.7.11+
for SAMD ARM Cortex-M0+ and M4 boards (Nano 33 IoT, etc.). -
Seeeduino SAMD core 1.8.3+
for SAMD21/SAMD51 boards (XIAO M0, Wio Terminal, etc.). -
Adafruit nRF52 v1.3.0+
for nRF52 boards such as Adafruit NRF52840_FEATHER, NRF52832_FEATHER, NRF52840_FEATHER_SENSE, NRF52840_ITSYBITSY, NRF52840_CIRCUITPLAY, NRF52840_CLUE, NRF52840_METRO, NRF52840_PCA10056, PARTICLE_XENON, NINA_B302_ublox, etc. -
Earle Philhower's arduino-pico core v2.6.3+
for RP2040-based boards such as RASPBERRY_PI_PICO, ADAFRUIT_FEATHER_RP2040 and GENERIC_RP2040, etc. -
Arduino mbed_rp2040 core 3.4.1+
for Arduino (Use Arduino Board Manager) RP2040-based boards, such as Arduino Nano RP2040 Connect, RASPBERRY_PI_PICO, etc.. -
Arduino mbed_nano core 3.4.1+
for Arduino (Use Arduino Board Manager) MBED nRF52840-based boards such as Nano_33_BLE, Nano_33_BLE_Sense. -
ArduinoCore-mbed mbed_portenta core 3.4.1+
for Arduino Portenta_H7. -
Arduino AmebaD core 3.1.4+
for Realtek RTL8720DN, RTL8722DM and RTL8722CSM, etc. boards. -
FlashStorage_SAMD library v1.3.2+
for SAMD21 and SAMD51 boards (ZERO, MKR, NANO_33_IOT, M0, M0 Pro, AdaFruit Itsy-Bitsy M4, etc.). -
FlashStorage_STM32F1 library v1.1.0+
for STM32F1/F3 boards. To install. check -
FlashStorage_STM32 library v1.2.0+
for STM32F/L/H/G/WB/MP1 boards. To install. check -
DueFlashStorage library v1.0.0+
for SAM DUE. To install, check -
FlashStorage_RTL8720 library v1.1.0+
for Realtek RTL8720DN, RTL8722DM, RTL8722CSM, etc. boards.
The best and easiest way is to use Arduino Library Manager
. Search for DoubleResetDetector_Generic
, then select / install the latest version.
You can also use this link for more detailed instructions.
Another way to install is to:
- Navigate to DoubleResetDetector_Generic page.
- Download the latest release
DoubleResetDetector_Generic-master.zip
. - Extract the zip file to
DoubleResetDetector_Generic-master
directory - Copy whole
DoubleResetDetector_Generic-master
folder to Arduino libraries' directory such as~/Arduino/libraries/
.
- Install VS Code
- Install PlatformIO
- Install DoubleResetDetector_Generic library by using Library Manager. Search for DoubleResetDetector_Generic in Platform.io Author's Libraries
- Use included platformio.ini file from examples to ensure that all dependent libraries will installed automatically. Please visit documentation for the other options and examples at Project Configuration File
To be able to compile, run and automatically detect and display BOARD_NAME on nRF52840/nRF52832 boards, you have to copy the whole nRF52 Packages_Patches directory into Adafruit nRF52 directory (~/.arduino15/packages/adafruit/hardware/nrf52/1.3.0).
Supposing the Adafruit nRF52 version is 1.3.0. These files must be copied into the directory:
~/.arduino15/packages/adafruit/hardware/nrf52/1.3.0/platform.txt
~/.arduino15/packages/adafruit/hardware/nrf52/1.3.0/boards.txt
~/.arduino15/packages/adafruit/hardware/nrf52/1.3.0/cores/nRF5/Udp.h
~/.arduino15/packages/adafruit/hardware/nrf52/1.3.0/cores/nRF5/Print.h
~/.arduino15/packages/adafruit/hardware/nrf52/1.3.0/cores/nRF5/Print.cpp
~/.arduino15/packages/adafruit/hardware/nrf52/1.3.0/variants/NINA_B302_ublox/variant.h
~/.arduino15/packages/adafruit/hardware/nrf52/1.3.0/variants/NINA_B302_ublox/variant.cpp
~/.arduino15/packages/adafruit/hardware/nrf52/1.3.0/variants/NINA_B112_ublox/variant.h
~/.arduino15/packages/adafruit/hardware/nrf52/1.3.0/variants/NINA_B112_ublox/variant.cpp
~/.arduino15/packages/adafruit/hardware/nrf52/1.3.0/cores/nRF5/Udp.h
Whenever a new version is installed, remember to copy these files into the new version directory. For example, new version is x.yy.z These files must be copied into the directory:
~/.arduino15/packages/adafruit/hardware/nrf52/x.yy.z/platform.txt
~/.arduino15/packages/adafruit/hardware/nrf52/x.yy.z/boards.txt
~/.arduino15/packages/adafruit/hardware/nrf52/x.yy.z/cores/nRF5/Udp.h
~/.arduino15/packages/adafruit/hardware/nrf52/x.yy.z/cores/nRF5/Print.h
~/.arduino15/packages/adafruit/hardware/nrf52/x.yy.z/cores/nRF5/Print.cpp
~/.arduino15/packages/adafruit/hardware/nrf52/x.yy.z/variants/NINA_B302_ublox/variant.h
~/.arduino15/packages/adafruit/hardware/nrf52/x.yy.z/variants/NINA_B302_ublox/variant.cpp
~/.arduino15/packages/adafruit/hardware/nrf52/x.yy.z/variants/NINA_B112_ublox/variant.h
~/.arduino15/packages/adafruit/hardware/nrf52/x.yy.z/variants/NINA_B112_ublox/variant.cpp
~/.arduino15/packages/adafruit/hardware/nrf52/x.yy.z/cores/nRF5/Udp.h
To be able to compile and run on Teensy boards, you have to copy the files in Packages_Patches for Teensy directory into Teensy hardware directory (./arduino-1.8.19/hardware/teensy/avr/boards.txt).
Supposing the Arduino version is 1.8.19. These files must be copied into the directory:
./arduino-1.8.19/hardware/teensy/avr/boards.txt
./arduino-1.8.19/hardware/teensy/avr/cores/teensy/Stream.h
./arduino-1.8.19/hardware/teensy/avr/cores/teensy3/Stream.h
./arduino-1.8.19/hardware/teensy/avr/cores/teensy4/Stream.h
Whenever a new version is installed, remember to copy this file into the new version directory. For example, new version is x.yy.zz These files must be copied into the directory:
./arduino-x.yy.zz/hardware/teensy/avr/boards.txt
./arduino-x.yy.zz/hardware/teensy/avr/cores/teensy/Stream.h
./arduino-x.yy.zz/hardware/teensy/avr/cores/teensy3/Stream.h
./arduino-x.yy.zz/hardware/teensy/avr/cores/teensy4/Stream.h
To be able to compile and run on SAM DUE boards, you have to copy the whole SAM DUE directory into Arduino sam directory (~/.arduino15/packages/arduino/hardware/sam/1.6.12).
Supposing the Arduino SAM core version is 1.6.12. This file must be copied into the directory:
~/.arduino15/packages/arduino/hardware/sam/1.6.12/platform.txt
Whenever a new version is installed, remember to copy this file into the new version directory. For example, new version is x.yy.zz This file must be copied into the directory:
~/.arduino15/packages/arduino/hardware/sam/x.yy.zz/platform.txt
To be able to compile, run and automatically detect and display BOARD_NAME on Arduino SAMD (Nano-33-IoT, etc) boards, you have to copy the whole Arduino SAMD Packages_Patches directory into Arduino SAMD directory (~/.arduino15/packages/arduino/hardware/samd/1.8.13).
Supposing the Arduino SAMD version is 1.8.13. Now only one file must be copied into the directory:
~/.arduino15/packages/arduino/hardware/samd/1.8.13/platform.txt
Whenever a new version is installed, remember to copy this files into the new version directory. For example, new version is x.yy.zz
This file must be copied into the directory:
~/.arduino15/packages/arduino/hardware/samd/x.yy.zz/platform.txt
Supposing the Arduino SAMD version is 1.8.9. These files must be copied into the directory:
~/.arduino15/packages/arduino/hardware/samd/1.8.9/platform.txt
~/.arduino15/packages/arduino/hardware/samd/1.8.9/cores/arduino/Arduino.h
Whenever a new version is installed, remember to copy these files into the new version directory. For example, new version is x.yy.z
These files must be copied into the directory:
~/.arduino15/packages/arduino/hardware/samd/x.yy.z/platform.txt
~/.arduino15/packages/arduino/hardware/samd/x.yy.z/cores/arduino/Arduino.h
This is mandatory to fix the notorious Arduino SAMD compiler error. See Improve Arduino compatibility with the STL (min and max macro)
...\arm-none-eabi\include\c++\7.2.1\bits\stl_algobase.h:243:56: error: macro "min" passed 3 arguments, but takes just 2
min(const _Tp& __a, const _Tp& __b, _Compare __comp)
Whenever the above-mentioned compiler error issue is fixed with the new Arduino SAMD release, you don't need to copy the Arduino.h
file anymore.
To be able to compile, run and automatically detect and display BOARD_NAME on Adafruit SAMD (Itsy-Bitsy M4, etc) boards, you have to copy the whole Adafruit SAMD Packages_Patches directory into Adafruit samd directory (~/.arduino15/packages/adafruit/hardware/samd/1.7.11).
Supposing the Adafruit SAMD core version is 1.7.11. These files must be copied into the directory:
~/.arduino15/packages/adafruit/hardware/samd/1.7.11/platform.txt
~/.arduino15/packages/adafruit/hardware/samd/1.7.11/cores/arduino/Print.h
~/.arduino15/packages/adafruit/hardware/samd/1.7.11/cores/arduino/Print.cpp
Whenever a new version is installed, remember to copy this file into the new version directory. For example, new version is x.yy.zz These files must be copied into the directory:
~/.arduino15/packages/adafruit/hardware/samd/x.yy.zz/platform.txt
~/.arduino15/packages/adafruit/hardware/samd/x.yy.zz/cores/arduino/Print.h
~/.arduino15/packages/adafruit/hardware/samd/x.yy.zz/cores/arduino/Print.cpp
To be able to compile, run and automatically detect and display BOARD_NAME on Seeeduino SAMD (XIAO M0, Wio Terminal, etc) boards, you have to copy the whole Seeeduino SAMD Packages_Patches directory into Seeeduino samd directory (~/.arduino15/packages/Seeeduino/hardware/samd/1.8.3).
Supposing the Seeeduino SAMD core version is 1.8.3. These files must be copied into the directory:
~/.arduino15/packages/Seeeduino/hardware/samd/1.8.3/platform.txt
~/.arduino15/packages/Seeeduino/hardware/samd/1.8.3/cores/arduino/Arduino.h
~/.arduino15/packages/Seeeduino/hardware/samd/1.8.3/cores/arduino/Print.h
~/.arduino15/packages/Seeeduino/hardware/samd/1.8.3/cores/arduino/Print.cpp
Whenever a new version is installed, remember to copy this file into the new version directory. For example, new version is x.yy.zz These files must be copied into the directory:
~/.arduino15/packages/Seeeduino/hardware/samd/x.yy.zz/platform.txt
~/.arduino15/packages/Seeeduino/hardware/samd/x.yy.zz/cores/arduino/Arduino.h
~/.arduino15/packages/Seeeduino/hardware/samd/x.yy.zz/cores/arduino/Print.h
~/.arduino15/packages/Seeeduino/hardware/samd/x.yy.zz/cores/arduino/Print.cpp
For Generic STM32F4 series
boards, such as STM32F407VE
, using LAN8720
, please use STM32 core v2.2.0
as breaking core v2.3.0
creates the compile error.
To use LAN8720 on some STM32 boards
- Nucleo-144 (F429ZI, NUCLEO_F746NG, NUCLEO_F746ZG, NUCLEO_F756ZG)
- Discovery (DISCO_F746NG)
- STM32F4 boards (BLACK_F407VE, BLACK_F407VG, BLACK_F407ZE, BLACK_F407ZG, BLACK_F407VE_Mini, DIYMORE_F407VGT, FK407M1)
you have to copy the files stm32f4xx_hal_conf_default.h and stm32f7xx_hal_conf_default.h into STM32 stm32 directory (~/.arduino15/packages/STM32/hardware/stm32/2.3.0/system) to overwrite the old files.
Supposing the STM32 stm32 core version is 2.3.0. These files must be copied into the directory:
~/.arduino15/packages/STM32/hardware/stm32/2.3.0/system/STM32F4xx/stm32f4xx_hal_conf_default.h
for STM32F4.~/.arduino15/packages/STM32/hardware/stm32/2.3.0/system/STM32F7xx/stm32f7xx_hal_conf_default.h
for Nucleo-144 STM32F7.
Whenever a new version is installed, remember to copy this file into the new version directory. For example, new version is x.yy.zz, these files must be copied into the corresponding directory:
~/.arduino15/packages/STM32/hardware/stm32/x.yy.zz/system/STM32F4xx/stm32f4xx_hal_conf_default.h
- `~/.arduino15/packages/STM32/hardware/stm32/x.yy.zz/system/STM32F7xx/stm32f7xx_hal_conf_default.h
To use Serial1 on some STM32 boards without Serial1 definition (Nucleo-144 NUCLEO_F767ZI, Nucleo-64 NUCLEO_L053R8, etc.) boards, you have to copy the files STM32 variant.h into STM32 stm32 directory (~/.arduino15/packages/STM32/hardware/stm32/2.3.0). You have to modify the files corresponding to your boards, this is just an illustration how to do.
Supposing the STM32 stm32 core version is 2.3.0. These files must be copied into the directory:
~/.arduino15/packages/STM32/hardware/stm32/2.3.0/variants/STM32F7xx/F765Z(G-I)T_F767Z(G-I)T_F777ZIT/NUCLEO_F767ZI/variant.h
for Nucleo-144 NUCLEO_F767ZI.~/.arduino15/packages/STM32/hardware/stm32/2.3.0/variants/STM32L0xx/L052R(6-8)T_L053R(6-8)T_L063R8T/NUCLEO_L053R8/variant.h
for Nucleo-64 NUCLEO_L053R8.
Whenever a new version is installed, remember to copy this file into the new version directory. For example, new version is x.yy.zz, these files must be copied into the corresponding directory:
~/.arduino15/packages/STM32/hardware/stm32/x.yy.zz/variants/STM32F7xx/F765Z(G-I)T_F767Z(G-I)T_F777ZIT/NUCLEO_F767ZI/variant.h
~/.arduino15/packages/STM32/hardware/stm32/x.yy.zz/variants/STM32L0xx/L052R(6-8)T_L053R(6-8)T_L063R8T/NUCLEO_L053R8/variant.h
8. For RP2040-based boards using Earle Philhower arduino-pico core
To be able to automatically detect and display BOARD_NAME on RP2040-based boards (RASPBERRY_PI_PICO, ADAFRUIT_FEATHER_RP2040, GENERIC_RP2040, etc) boards, you have to copy the file RP2040 platform.txt into rp2040 directory (~/.arduino15/packages/rp2040/hardware/rp2040/1.4.0).
Supposing the rp2040 core version is 1.4.0. This file must be copied into the directory:
~/.arduino15/packages/rp2040/hardware/rp2040/1.4.0/platform.txt
Whenever a new version is installed, remember to copy this file into the new version directory. For example, new version is x.yy.zz This file must be copied into the directory:
~/.arduino15/packages/rp2040/hardware/rp2040/x.yy.zz/platform.txt
With core after v1.5.0, this step is not necessary anymore thanks to the PR Add -DBOARD_NAME="{build.board}" #136.
Some libraries, such as Adafruit DHT-sensor-library, require the definition of microsecondsToClockCycles(). To be able to compile and run on RP2040-based boards, you have to copy the files in RP2040 Arduino.h into rp2040 directory (~/.arduino15/packages/rp2040/hardware/rp2040/1.4.0).
Supposing the rp2040 core version is 1.4.0. This file must be copied to replace:
~/.arduino15/packages/rp2040/hardware/rp2040/1.4.0/cores/rp2040/Arduino.h
Whenever a new version is installed, remember to copy this file into the new version directory. For example, new version is x.yy.zz This file must be copied to replace:
~/.arduino15/packages/rp2040/hardware/rp2040/x.yy.zz/cores/rp2040/Arduino.h
With core after v1.5.0, this step is not necessary anymore thanks to the PR Add defs for compatibility #142.
To be able to upload firmware to Portenta_H7 using Arduino IDE in Linux (Ubuntu, etc.), you have to copy the file portenta_post_install.sh into mbed_portenta directory (~/.arduino15/packages/arduino/hardware/mbed_portenta/3.4.1/portenta_post_install.sh).
Then run the following command using sudo
$ cd ~/.arduino15/packages/arduino/hardware/mbed_portenta/3.4.1
$ chmod 755 portenta_post_install.sh
$ sudo ./portenta_post_install.sh
This will create the file /etc/udev/rules.d/49-portenta_h7.rules
as follows:
# Portenta H7 bootloader mode UDEV rules
SUBSYSTEMS=="usb", ATTRS{idVendor}=="2341", ATTRS{idProduct}=="035b", GROUP="plugdev", MODE="0666"
Supposing the ArduinoCore-mbed core version is 3.4.1. Now only one file must be copied into the directory:
~/.arduino15/packages/arduino/hardware/mbed_portenta/3.4.1/portenta_post_install.sh
Whenever a new version is installed, remember to copy this files into the new version directory. For example, new version is x.yy.zz
This file must be copied into the directory:
~/.arduino15/packages/arduino/hardware/mbed_portenta/x.yy.zz/portenta_post_install.sh
To avoid compile error relating to PROGMEM, you have to copy the file Realtek AmebaD core pgmspace.h into Realtek AmebaD directory (~/.arduino15/packages/realtek/hardware/AmebaD/3.1.4/cores/ambd/avr/pgmspace.h).
Supposing the Realtek AmebaD core version is 3.1.4. This file must be copied into the directory:
~/.arduino15/packages/realtek/hardware/AmebaD/3.1.4/cores/ambd/avr/pgmspace.h
Whenever a new version is installed, remember to copy this file into the new version directory. For example, new version is x.yy.zz This file must be copied into the directory:
~/.arduino15/packages/realtek/hardware/AmebaD/x.yy.zz/cores/ambd/avr/pgmspace.h
To avoid compile error relating to SAMD21/SAMD51, you have to copy the file ArduinoCore-fab-sam core pgmspace.h into ArduinoCore-fab-sam
samd directory (~/.arduino15/packages/Fab_SAM_Arduino/hardware/samd/1.9.0/boards.txt).
Supposing the ArduinoCore-fab-sam
samd core version is 1.9.0. This file must be copied into the directory:
~/.arduino15/packages/Fab_SAM_Arduino/hardware/samd/1.9.0/boards.txt
Whenever a new version is installed, remember to copy this file into the new version directory. For example, new version is x.yy.zz This file must be copied into the directory:
~/.arduino15/packages/Fab_SAM_Arduino/hardware/samd/x.yy.zz/boards.txt
To be able to compile, run and automatically detect and display BOARD_NAME on Seeeduino RP2040 (XIAO RP2040, Wio RP2040 Mini) boards, you have to copy the whole Seeeduino RP2040 Packages_Patches directory into Seeeduino samd directory (~/.arduino15/packages/Seeeduino/hardware/rp2040/2.7.2).
Supposing the Seeeduino RP2040 core version is 2.7.2. These files must be copied into the directory:
~/.arduino15/packages/Seeeduino/hardware/rp2040/2.7.2/boards.txt
~/.arduino15/packages/Seeeduino/hardware/rp2040/2.7.2/variants/Seeed_XIAO_RP2040/pins_arduino.h
Whenever a new version is installed, remember to copy this file into the new version directory. For example, new version is x.yy.zz These files must be copied into the directory:
~/.arduino15/packages/Seeeduino/hardware/samd/x.yy.zz/boards.txt
~/.arduino15/packages/Seeeduino/hardware/samd/x.yy.zz/variants/Seeed_XIAO_RP2040/pins_arduino.h
To be able to compile and run on Xiao nRF52840 boards, you have to copy the whole nRF52 1.0.0 directory into Seeeduino nRF52 directory (~/.arduino15/packages/Seeeduino/hardware/nrf52/1.0.0).
Supposing the Seeeduino nRF52 version is 1.0.0. These files must be copied into the directory:
~/.arduino15/packages/Seeeduino/hardware/nrf52/1.0.0/platform.txt
~/.arduino15/packages/Seeeduino/hardware/nrf52/1.0.0/cores/nRF5/Print.h
~/.arduino15/packages/Seeeduino/hardware/nrf52/1.0.0/cores/nRF5/Print.cpp
~/.arduino15/packages/Seeeduino/hardware/nrf52/1.0.0/cores/nRF5/Udp.h
Whenever a new version is installed, remember to copy these files into the new version directory. For example, new version is x.yy.z These files must be copied into the directory:
~/.arduino15/packages/Seeeduino/hardware/nrf52/x.yy.z/platform.txt
~/.arduino15/packages/Seeeduino/hardware/nrf52/x.yy.z/cores/nRF5/Print.h
~/.arduino15/packages/Seeeduino/hardware/nrf52/x.yy.z/cores/nRF5/Print.cpp
~/.arduino15/packages/Seeeduino/hardware/nrf52/x.yy.z/cores/nRF5/Udp.h
Detects a double reset so that an alternative start-up mode can be used. One example use is to allow re-configuration of a device's WiFi or Blynk Credentials.
When the device starts up it checks the EEPROM, (Due)FlashStorage or LittleFS file /drd.dat
for a flag to see if it has been recently reset within the configurable timeout seconds
All examples of these following libraries are using DRD feature of this DoubleResetDetector_Generic Library
- 1. BlynkEthernet_WM
- 2. Blynk_Esp8266AT_WM
- 3. Blynk_WiFiNINA_WM
- 4. WiFiManager_NINA_Lite
- 5. BlynkEthernet_STM32_WM
- 6. ESP_AT_WM_Lite
- 7. WIOTerminal_WiFiManager
- 8. Ethernet_Manager
- 9. Ethernet_Manager_STM32
- 10. WiFiManager_Generic_Lite
Example checkWaitingDRD
DoubleResetDetector_Generic/examples/checkWaitingDRD/checkWaitingDRD.ino
Lines 51 to 166 in 3c90445
This is the terminal output for a Nano 33 IoT using WiFiManager_NINA_Lite
when DRD is detected and not detected
Start SAMD_WiFiNINA on SAMD NANO_33_IOT
*NN: Hostname=SAMD-Master-Controller
Flag read = 0xd0d04321
No doubleResetDetected <====== No DRD
SetFlag write = 0xd0d01234
*NN: bg: noConfigPortal = true
*NN: Connecting MultiWifi...
*NN: con2WF:spentMsec=0
WiFi-begin: return1 = 3
WiFi-begin: return2 = 3
*NN: con2WF:OK
*NN: SSID=HueNet1,RSSI=-34
*NN: IP=192.168.2.93
*NN: b:WOK
Stop doubleResetDetecting
ClearFlag write = 0xd0d04321
Your stored Credentials :
Blynk Server1 = new-account.duckdns.org
Token1 = new-token1
Blynk Server2 = new-account.ddns.net
Token2 = new-token2
Port = 8080
MQTT Server = new-mqtt.duckdns.org
Start SAMD_WiFiNINA on SAMD NANO_33_IOT
*NN: Hostname=SAMD-Master-Controller
Flag read = 0xd0d01234
doubleResetDetected
ClearFlag write = 0xd0d04321
*NN: Double Reset Detected <====== DRD detected
*NN: bg: noConfigPortal = false
*NN: b:OpenPortal <====== Config Portal opened
*NN: SSID=WIFININA_51F485,PW=MyWIFININA_51F485
*NN: IP=192.168.4.1,CH=10
This is the terminal output when running minimal example on RASPBERRY_PI_PICO using LittleFS
DoubleResetDetector minimal Example Program on RASPBERRY_PI_PICO
DoubleResetDetector_Generic v1.8.1
-----------------------------------
LittleFS Flag read = 0xd0d04321
Flag read = 0xd0d04321
No doubleResetDetected
Saving DOUBLERESETDETECTOR_FLAG to DRD file : 0xd0d01234
Saving DRD file OK
SetFlag write = 0xd0d01234
No Double Reset Detected
Stop doubleResetDetecting
Saving to DRD file : 0xd0d04321
Saving DRD file OK
LittleFS Flag read = 0xd0d04321
ClearFlag write = 0xd0d04321
DoubleResetDetector minimal Example Program on RASPBERRY_PI_PICO
DoubleResetDetector_Generic v1.8.1
-----------------------------------
LittleFS Flag read = 0xd0d01234
Flag read = 0xd0d01234
doubleResetDetected
Saving to DRD file : 0xd0d04321
Saving DRD file OK
LittleFS Flag read = 0xd0d04321
ClearFlag write = 0xd0d04321
Double Reset Detected
This is the terminal output when running minimal example on MBED RASPBERRY_PI_PICO using LittleFS
DoubleResetDetector minimal Example Program on RaspberryPi Pico
DoubleResetDetector_Generic v1.8.1
-----------------------------------
LittleFS size (KB) = 64
LittleFS Mount OK
LittleFS Flag read = 0xd0d04321
Flag read = 0xd0d04321
No doubleResetDetected
Saving DOUBLERESETDETECTOR_FLAG to DRD file : 0xd0d01234
Saving DRD file OK
SetFlag write = 0xd0d01234
No Double Reset Detected
Stop doubleResetDetecting
Saving to DRD file : 0xd0d04321
Saving DRD file OK
LittleFS Flag read = 0xd0d04321
ClearFlag write = 0xd0d04321
DoubleResetDetector minimal Example Program on RaspberryPi Pico
DoubleResetDetector_Generic v1.8.1
-----------------------------------
LittleFS size (KB) = 64
LittleFS Mount OK
LittleFS Flag read = 0xd0d01234
Flag read = 0xd0d01234
doubleResetDetected
Saving to DRD file : 0xd0d04321
Saving DRD file OK
LittleFS Flag read = 0xd0d04321
ClearFlag write = 0xd0d04321
Double Reset Detected
This is the terminal output when running minimal example on Nano RP2040 Connect using LittleFS
DoubleResetDetector minimal Example Program on Nano RP2040 Connect
DoubleResetDetector_Generic v1.8.1
-----------------------------------
LittleFS size (KB) = 64
LittleFS Mount OK
LittleFS Flag read = 0xd0d04321
Flag read = 0xd0d04321
No doubleResetDetected
Saving DOUBLERESETDETECTOR_FLAG to DRD file : 0xd0d01234
Saving DRD file OK
SetFlag write = 0xd0d01234
No Double Reset Detected
Stop doubleResetDetecting
Saving to DRD file : 0xd0d04321
Saving DRD file OK
LittleFS Flag read = 0xd0d04321
ClearFlag write = 0xd0d04321
DoubleResetDetector minimal Example Program on Nano RP2040 Connect
DoubleResetDetector_Generic v1.8.1
-----------------------------------
LittleFS size (KB) = 64
LittleFS Mount OK
LittleFS Flag read = 0xd0d01234
Flag read = 0xd0d01234
doubleResetDetected
Saving to DRD file : 0xd0d04321
Saving DRD file OK
LittleFS Flag read = 0xd0d04321
ClearFlag write = 0xd0d04321
Double Reset Detected
This is the terminal output when running minimal example on Rtlduino RTL8720DN using FlashStorage
DoubleResetDetector minimal Example Program on Rtlduino RTL8720DN
DoubleResetDetector_Generic v1.8.1
-----------------------------------
Flag read = 0xbeefdeed
No doubleResetDetected
SetFlag write = 0xd0d01234
No Double Reset Detected
DoubleResetDetector minimal Example Program on Rtlduino RTL8720DN
DoubleResetDetector_Generic v1.8.1
-----------------------------------
Flag read = 0xd0d01234
doubleResetDetected
ClearFlag write = 0xd0d04321
Double Reset Detected
This is the terminal output when running minimal example on Rtlduino RTL8720DN using FlashStorage
DoubleResetDetector minimal Example Program on Nano 33 BLE
DoubleResetDetector_Generic v1.8.1
-----------------------------------
LittleFS size (KB) = 64
LittleFS Mount OK
LittleFS Flag read = 0xd0d04321
Flag read = 0xd0d04321
No doubleResetDetected
Saving DOUBLERESETDETECTOR_FLAG to DRD file : 0xd0d01234
Saving DRD file OK
SetFlag write = 0xd0d01234
No Double Reset Detected
Stop doubleResetDetecting
Saving to DRD file : 0xd0d04321
Saving DRD file OK
LittleFS Flag read = 0xd0d04321
ClearFlag write = 0xd0d04321
DoubleResetDetector minimal Example Program on Nano 33 BLE
DoubleResetDetector_Generic v1.8.1
-----------------------------------
LittleFS size (KB) = 64
LittleFS Mount OK
LittleFS Flag read = 0xd0d01234
Flag read = 0xd0d01234
doubleResetDetected
Saving to DRD file : 0xd0d04321
Saving DRD file OK
LittleFS Flag read = 0xd0d04321
ClearFlag write = 0xd0d04321
Double Reset Detected
This is the terminal output when running minimal example on Rtlduino RTL8720DN using FlashStorage
DoubleResetDetector minimal Example Program on PORTENTA_H7_M7
DoubleResetDetector_Generic v1.8.1
-----------------------------------
Flash Size: (KB) = 2048.00
FlashIAP Start Address: = 0x8080000
LittleFS size (KB) = 1536.00
LittleFS Mount OK
Loading DRD file failed
Flag read = 0x0
No doubleResetDetected
Saving DOUBLERESETDETECTOR_FLAG to DRD file : 0xd0d01234
Saving DRD file OK
SetFlag write = 0xd0d01234
No Double Reset Detected
DoubleResetDetector minimal Example Program on PORTENTA_H7_M7
DoubleResetDetector_Generic v1.8.1
-----------------------------------
Flash Size: (KB) = 2048.00
FlashIAP Start Address: = 0x8080000
LittleFS size (KB) = 1536.00
LittleFS Mount OK
LittleFS Flag read = 0xd0d01234
Flag read = 0xd0d01234
doubleResetDetected
Saving to DRD file : 0xd0d04321
Saving DRD file OK
LittleFS Flag read = 0xd0d04321
ClearFlag write = 0xd0d04321
Double Reset Detected
You can also see how ESP_DoubleResetDetector
and DoubleResetDetector_Generic
are applied in many other libraries, such as:
- Blynk_WM
- BlynkEthernet_WM
- WiFiManager_NINA_Lite
- BlynkESP32_BT_WF,
- Blynk_GSM_Manager,
- Blynk_Esp8266AT_WM,
- Blynk_WiFiNINA_WM,
- Blynk_Async_WM,
- Blynk_Async_ESP32_BT_WF,
- Blynk_Async_GSM_Manager,
- ESP_WiFiManager
- ESPAsync_WiFiManager
- WiFiManager_Generic_Lite
- BlynkEthernet_STM32_WM,
- ESP_AT_WM_Lite
- WIOTerminal_WiFiManager
- Ethernet_Manager
- Ethernet_Manager_STM32
- ESP_WiFiManager_Lite
- WiFiManager_Portenta_H7_Lite
and the list is growing fast.
Debug is disabled by default. To enable debug:
// Use this to output debug msgs to Serial
#define DRD_GENERIC_DEBUG true
If you get compilation errors, more often than not, you may need to install a newer version of the board's core, applying Packages' Patches or this library latest version.
Submit issues to: DoubleResetDetector_Generic issues
- Search for bug and improvement.
- More examples and more supported boards.
- Add support to Arduino SAMD21 (ZERO, MKR, NANO_33_IOT, etc.) using FlashStorage_SAMD.
- Add support to Adafruit SAMD21 (Itsy-Bitsy M0, Metro M0, Feather M0 Express, etc.) using FlashStorage_SAMD.
- Add support to Adafruit SAMD51 (Itsy-Bitsy M4, Metro M4, Grand Central M4, Feather M4 Express, etc.) using FlashStorage_SAMD.
- Add support to Adafruit nRF52 ( Feather nRF52832, nRF52840 Express, BlueFruit Sense, Itsy-Bitsy nRF52840 Express, Metro nRF52840 Express, NINA_B302_ublox, NINA_B112_ublox, etc. using LittleFS.
- Add support to SAM DUE using DueFlashStorage.
- Add support to Seeeduino SAMD21/SAMD51: LoRaWAN, Zero, Femto M0, XIAO M0, Wio GPS Board, Wio Terminal, Grove UI Wireless using FlashStorage_SAMD.
- Add support to STM32F/L/H/G/WB/MP1 boards using EEPROM.
- Add support to Teensy boards using EEPROM.
- Add support to AVR Mega, Nano, UNO, etc boards using EEPROM.
- Add support to STM32F/L/H/G/WB/MP1 boards using FlashStorage_STM32.
- Add support to STM32F/L/H/G/WB/MP1 boards using STM32 core v2.0.0
- Add support to RP2040-based boards such as RASPBERRY_PI_PICO, ADAFRUIT_FEATHER_RP2040 and GENERIC_RP2040, using Earle Philhower's arduino-pico core and LittleFS.
- Add support to RP2040-based boards, such as Nano RP2040 Connect, using Arduino mbed OS for Nano boards and LittleFS.
- Add support to RP2040-based boards, such as RASPBERRY_PI_PICO, ADAFRUIT_FEATHER_RP2040 and GENERIC_RP2040, using Arduino-mbed RP2040 core and LittleFS.
- Add support to Realtek RTL8720DN, RTL8722DM, RTL8722CSM, etc., using Arduino AmebaD core
- Add support to MBED nRF52840-based boards such as Nano_33_BLE, Nano_33_BLE_Sense, etc. using Arduino-mbed mbed_nano core
- Add support to Portenta_H7 using Arduino-mbed mbed_nano core and LittleFS.
- Reduce Portenta_H7
LittleFS
size to 1024KB - Update to be compatible with new
FlashStorage_SAMD
,FlashStorage_STM32
andFlashStorage_STM32F1
libraries. - Use more efficient
FlashStorage_STM32
andFlashStorage_STM32F1
libraries for STM32 - Add support to more
SAMD
andSTM32
boards - Add support to
Sparkfun Pro nRF52840 Mini
- Add waitingForDRD() function to signal in DRD waiting period
- Add astyle using
allman
style. Restyle the library
- Thanks to Stephen Denne for the
DoubleResetDetector library
this library is based upon. - Thanks to Miguel Alexandre Wisintainer for help in debugging and testing. Without that, support to nRF52, especially NINA_B302_ublox running as nRF52840, has never been started and finished. See u-blox nina b
⭐️ Stephen Denne |
Miguel Wisintainer |
If you want to contribute to this project:
- Report bugs and errors
- Ask for enhancements
- Create issues and pull requests
- Tell other people about this library
- The library is licensed under MIT
Copyright (c) 2020- Khoi Hoang