- Why do we need this DS323x_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
- Libraries' Patches
- HOWTO Use analogRead() with ESP32 running WiFi and/or BlueTooth (BT/BLE)
- Usage
- Configurations
- APIs
- Examples
- Example RTC_Ethernet
- Debug Terminal Output Samples
- 1. Alarm_Ethernet on NRF52840_FEATHER with ENC28J60
- 2. Alarm_STM32_Ethernet on STM32F7 Nucleo-144 NUCLEO_F767ZI with LAN8742A
- 3. RTC_WiFiNINA on SAMD_NANO_33_IOT with WiFiNINA
- 4. RTC_Ethernet on NRF52840_FEATHER with W5500
- 5. RTC_STM32_Ethernet on STM32F7 Nucleo-144 NUCLEO_F767ZI with LAN8742A
- 6. RTC_STM32_Ethernet on STM32F7 Nucleo-144 NUCLEO_F767ZI with W5500
- 7. RTC_Ethernet on SAM-DUE with W5500
- 8. Alarm_WiFiNINA on MBED NANO_RP2040_CONNECT with WiFiNINA
- 9. Alarm_Ethernet on MBED RASPBERRY_PI_PICO with W5500
- 10. Alarm_Ethernet on RASPBERRY_PI_PICO with W5500
- 11. RTC_ESP_Complex on ESP32_DEV
- 12. RTC_ESP_Complex on ESP8266_NODEMCU_ESP12E
- 13. RTC_Ethernet on TEENSY 4.1 using QNEthernet
- 14. RTC_Ethernet on TEENSY 4.1 using NativeEthernet
- Issues
- TO DO
- DONE
- Contributions and Thanks
- Contributing
- License
- Copyright
Why do we need this DS323x_Generic library
This is an Arduino library for DS3231/DS3232 Extremely Accurate I2C-Integrated RTC/TCXO/Crystal
The DS323x is a low-cost, extremely accurate I2C real-time clock (RTC) with an integrated temperature-compensated crystal oscillator (TCXO) and crystal. The device incorporates a battery input, and maintains accurate timekeeping when main power to the device is interrupted.
The examples will demonstrate how to get the UTC time from NTP server, then update the RTC to make sure the time is perfectly correct.
This DS323x_Generic library is based on and modified from Hideaki Tai's DS323x Library to add functions and support to many boards and shields.
- ESP8266.
- ESP32.
- AdaFruit Feather nRF52832, nRF52840 Express, BlueFruit Sense, Itsy-Bitsy nRF52840 Express, Metro nRF52840 Express, NINA_B302_ublox, NINA_B112_ublox etc..
- Arduino SAMD21 (ZERO, MKR, NANO_33_IOT, etc.).
- Adafruit SAM21 (Itsy-Bitsy M0, Metro M0, Feather M0, Gemma M0, etc.).
- Adafruit SAM51 (Itsy-Bitsy M4, Metro M4, Grand Central M4, Feather M4 Express, etc.).
- Seeeduino SAMD21/SAMD51 boards (SEEED_WIO_TERMINAL, SEEED_FEMTO_M0, SEEED_XIAO_M0, Wio_Lite_MG126, WIO_GPS_BOARD, SEEEDUINO_ZERO, SEEEDUINO_LORAWAN, SEEED_GROVE_UI_WIRELESS, etc.)
- STM32 (Nucleo-144, Nucleo-64, Nucleo-32, Discovery, STM32F1, STM32F3, STM32F4, STM32H7, STM32L0, etc.).
- STM32F/L/H/G/WB/MP1 (Nucleo-64 L053R8,Nucleo-144, Nucleo-64, Nucleo-32, Discovery, STM32Fx, STM32H7, STM32Lx, STM32Gx, STM32WB, STM32MP1, etc.) having 64K+ Flash program memory.
- Arduino AVR boards (UNO, Nano, Mega, etc.)
- Arduino MegaAVR boards (UNO WiFi Rev 2, Nano Every, etc.)
- 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 or Earle Philhower's arduino-pico core.
- WT32_ETH01 boards using ESP32-based boards and LAN8720 Ethernet
- RTL8720DN, RTL8722DM, RTL8722CSM, etc. boards
- Portenta_H7
- Teensy (4.1, 4.0, 3.6, 3.5, 3,2, 3.1, 3.0)
- ESP8266 built-in WiFi.
- ESP32 built-in WiFi.
- WiFiNINA using WiFiNINA or WiFiNINA_Generic library.
- ESP8266-AT, ESP32-AT WiFi shields using WiFiEspAT or ESP8266_AT_WebServer library.
- RTL8720DN, RTL8722DM, RTL8722CSM
- Built-in WiFi of Portenta_H7
- W5x00's using Ethernet_Generic Library.
- ENC28J60 using EthernetENC or UIPEthernet library.
- LAN8742A using STM32Ethernet / STM32 LwIP libraries.
- LAN8720A in WT32-ETH01 using
WebServer_WT32_ETH01
. - Portenta_H7 Ethernet using
Portenta_Ethernet
library - Teensy 4.1 built-in Ethernet using
QNEthernet
library - Teensy 4.1 built-in Ethernet using
NativeEthernet
library
- ESP8266 LittleFS, SPIFFS.
- ESP32, ESP32-S2 SPIFFS and LittleFS. ESP32-C3 SPIFFS.
- SAM DUE DueFlashStorage.
- SAMD FlashStorage_SAMD.
- STM32 FlashStorage_STM32, FlashStorage_STM32F1.
- nRF52/RP2040 LittleFS.
- STM32, Teensy and AVR, MegaAVR EEPROM.
- RTL8720 FlashStorage_RTL8720.
- Portenta_H7 LittleFS.
Arduino IDE v1.8.19+
for ArduinoArduino AVR core 1.8.6+
for Arduino (Use Arduino Board Manager) for AVR boards.Arduino MegaAVR core v1.8.3+
for Arduino MegaAVR boards such as Arduino Uno WiFi Rev2. Use Arduino Board Manager to install.ESP32 Core 2.0.5+
for ESP32-based boards.ESP8266 Core 3.0.2+
for ESP8266-based boards. . To use ESP8266 core 2.7.1+ for LittleFS.Teensy core v1.57+
for Teensy (4.1, 4.0, 3.6, 3.5, 3,2, 3.1, 3.0) boards.Arduino SAM DUE core v1.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.Arduino Core for STM32 v2.3.0+
for STM32F/L/H/G/WB/MP1 boards.Arduino mbed_rp2040 core 3.4.1+
for Arduino RP2040-based boards, such as Arduino Nano RP2040 Connect, RASPBERRY_PI_PICO, 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.
Time v1.6.1+
.- Depending on which Ethernet card you're using:
Ethernet_Generic library v2.7.1+
for W5100, W5200 and W5500/WIZ550io/WIZ850io/USR-ES1 with Wiznet W5500 chip.NativeEthernet Library version stable111+
for Teensy 4.1 built-in Ethernet. NewQNEthernet Library version v0.16.0+
Teensy 4.1 built-in Ethernet. New
WiFiNINA_Generic library v1.8.15-1+
to use WiFiNINA modules/shields. To install. check if using WiFiNINA for boards such as Nano 33 IoT, nRF52, Teensy, etc.WiFiWebServer library v1.10.1+
to use WiFi/WiFiNINA modules/shields. To install, checkEthernetWebServer library v2.3.0+
to use Ethernet modules/shields on boards other than STM32F/L/H/G/WB/MP1. To install. check .EthernetWebServer_STM32 library v1.5.0+
to use Ethernet modules/shields on STM32F/L/H/G/WB/MP1 boards. To install, check .ESP8266_AT_WebServer library v1.6.0+
to use ESP8266-AT/ESP32-AT WiFi modules/shields. To install, checkTimezone_Generic library v1.10.1+
to use examples. To install, check .STM32RTC library v1.3.4+
to use STM32 examples using built-in STM32 RTC. .WebServer_WT32_ETH01 library v1.5.1+
to use WT32_ETH01 (ESP32 + LAN8720). To install, check .WiFiWebServer_RTL8720 library v1.1.2+
to use Realtek RTL8720DN, etc. To install, check .
- Depending on which board you're using:
DueFlashStorage library v1.0.0+
for SAM DUE. To install, checkFlashStorage_SAMD library v1.3.2+
for SAMD21 and SAMD51 boards (ZERO, MKR, NANO_33_IOT, M0, M0 Pro, AdaFruit Itsy-Bitsy M4, etc.). To install, checkFlashStorage_STM32F1 library v1.1.0+
for STM32F1/F3 boards. To install. checkFlashStorage_STM32 library v1.2.0+
for STM32F/L/H/G/WB/MP1 boards. To install, checkFlashStorage_RTL8720 library v1.1.0+
for RTL8720DN. etc. boards. To install, checkLittleFS_esp32 v1.0.6+
for ESP32-based boards using LittleFS. To install, check . Notice: ThisLittleFS_esp32 library
has been integrated to Arduino esp32 core v1.0.6.
The best and easiest way is to use Arduino Library Manager
. Search for DS323x_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 DS323x_Generic page.
- Download the latest release
DS323x_Generic-main.zip
. - Extract the zip file to
DS323x_Generic-main
directory - Copy whole
DS323x_Generic-main/src
folder to Arduino libraries' directory such as~/Arduino/libraries/
.
- Install VS Code
- Install PlatformIO
- Install DS323x_Generic library by using Library Manager. Search for DS323x_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
If your application requires 2K+ HTML page, the current Ethernet library
must be modified if you are using W5200/W5500 Ethernet shields. W5100 is not supported for 2K+ buffer. If you use boards requiring different CS/SS pin for W5x00 Ethernet shield, for example ESP32, ESP8266, nRF52, etc., you also have to modify the following libraries to be able to specify the CS/SS pin correctly.
To fix Ethernet library
, just copy these following files into the Ethernet library
directory to overwrite the old files:
To fix EthernetLarge library
, just copy these following files into the EthernetLarge library
directory to overwrite the old files:
To fix Ethernet2 library
, just copy these following files into the Ethernet2 library
directory to overwrite the old files:
To add UDP Multicast support, necessary for the UPnP_Generic library:
- To fix
Ethernet3 library
, just copy these following files into theEthernet3 library
directory to overwrite the old files:
To be able to compile and run on nRF52 boards with ENC28J60 using UIPEthernet library, you have to copy these following files into the UIPEthernet utility
directory to overwrite the old files:
To fix ESP32 compile error
, just copy the following file into the ESP32
cores/esp32 directory (e.g. ./arduino-1.8.12/hardware/espressif/cores/esp32) to overwrite the old file:
Check if you need to install the UIPEthernet patch new STM32 core F3/F4 compatibility to avoid errors #include HardwareSPI.h
on some STM32 boards (Nucleo-32 F303K8, etc.)
Please have a look at ESP_WiFiManager Issue 39: Not able to read analog port when using the autoconnect example to have more detailed description and solution of the issue.
- ADC1 controls ADC function for pins GPIO32-GPIO39
- ADC2 controls ADC function for pins GPIO0, 2, 4, 12-15, 25-27
Look in file adc_common.c
In ADC2, there're two locks used for different cases:
lock shared with app and Wi-Fi: ESP32: When Wi-Fi using the ADC2, we assume it will never stop, so app checks the lock and returns immediately if failed. ESP32S2: The controller's control over the ADC is determined by the arbiter. There is no need to control by lock.
lock shared between tasks: when several tasks sharing the ADC2, we want to guarantee all the requests will be handled. Since conversions are short (about 31us), app returns the lock very soon, we use a spinlock to stand there waiting to do conversions one by one.
adc2_spinlock should be acquired first, then adc2_wifi_lock or rtc_spinlock.
- In order to use ADC2 for other functions, we have to acquire complicated firmware locks and very difficult to do
- So, it's not advisable to use ADC2 with WiFi/BlueTooth (BT/BLE).
- Use ADC1, and pins GPIO32-GPIO39
- If somehow it's a must to use those pins serviced by ADC2 (GPIO0, 2, 4, 12, 13, 14, 15, 25, 26 and 27), use the fix mentioned at the end of ESP_WiFiManager Issue 39: Not able to read analog port when using the autoconnect example to work with ESP32 WiFi/BlueTooth (BT/BLE).
#include <DS323x_Generic.h>
DS323x rtc;
void setup()
{
Wire.begin();
rtc.attach(Wire);
rtc.now(DateTime(2020, 11, 23, 14, 23, 45));
}
void loop()
{
DateTime now = rtc.now();
Serial.println(now.timestamp());
delay(1000);
}
#include <DS323x_Generic.h>
DS323x rtc;
void setup()
{
Wire.begin();
rtc.attach(Wire);
rtc.squareWaveFrequency(DS323x::SquareWaveFreq::SQWF_1_HZ);
rtc.interruptControl(DS323x::InterruptCtrl::SQW); // default is ALRAM
rtc.trigger(); // first falling edge comes 1sec after this (same as second(0))
}
void loop()
{
}
#include <DS323x_Generic.h>
DS323x rtc;
void setup()
{
Wire.begin();
rtc.attach(Wire);
// set alarm
rtc.second(DS323x::AlarmSel::A1, 56);
rtc.rate(DS323x::A1Rate::MATCH_SECOND);
// alarm flags must be cleard to get next alarm
if (rtc.hasAlarmed(DS323x::AlarmSel::A1))
rtc.clearAlarm(DS323x::AlarmSel::A1);
// enable alarm
rtc.interruptControl(DS323x::InterruptCtrl::ALARM);
rtc.enableAlarm1(true);
}
void loop()
{
}
enum class Format : uint8_t { H24, H12 };
enum class AMPM : uint8_t { AM, PM };
enum class DYDT : uint8_t { DATE, DAY };
enum class A1Rate : uint8_t
{
EVERY_SECOND,
MATCH_SECOND,
MATCH_SECOND_MINUTE,
MATCH_SECOND_MINUTE_HOUR,
MATCH_SECOND_MINUTE_HOUR_DATE,
MATCH_SECOND_MINUTE_HOUR_DAY
};
enum class A2Rate : uint8_t
{
EVERY_MINUTE,
MATCH_MINUTE,
MATCH_MINUTE_HOUR,
MATCH_MINUTE_HOUR_DATE,
MATCH_MINUTE_HOUR_DAY
};
enum class SquareWaveFreq : uint8_t
{
SQWF_1_HZ,
SQWF_1024_HZ,
SQWF_4096_HZ,
SQWF_8192_HZ
};
enum class InterruptCtrl : uint8_t { SQW, ALARM };
enum class AlarmSel : uint8_t { A1, A2 };
void attach(WireType& w);
// rtc getters
DateTime now() const;
uint8_t second();
uint8_t minute();
uint8_t hour();
uint8_t weekday();
uint8_t day();
uint8_t month();
uint8_t year();
AMPM ampm();
Format format();
// rtc setters
void now(const DateTime& n);
bool second(const uint8_t s);
bool minute(const uint8_t m);
bool hour(const uint8_t h);
bool weekday(const uint8_t w);
bool day(const uint8_t d);
bool month(const uint8_t m);
bool year(const uint8_t y);
bool ampm(const AMPM m);
bool format(const Format f);
// alarm getters
const DateTime& alarm(const AlarmSel a);
uint8_t second(const AlarmSel a);
uint8_t minute(const AlarmSel a);
uint8_t hour(const AlarmSel a);
uint8_t weekday(const AlarmSel a);
uint8_t day(const AlarmSel a);
AMPM ampm(const AlarmSel a);
Format format(const AlarmSel a);
DYDT dydt(const AlarmSel a);
bool a1m1();
bool a1m2();
bool a1m3();
bool a1m4();
A1Rate rateA1();
bool a2m2();
bool a2m3();
bool a2m4();
A2Rate rateA2();
// alarm setters
void alarm(const AlarmSel a, const DateTime& n);
bool second(const AlarmSel a, const uint8_t s);
bool minute(const AlarmSel a, const uint8_t m);
bool hour(const AlarmSel a, const uint8_t h);
bool weekday(const AlarmSel a, const uint8_t w);
bool day(const AlarmSel a, const uint8_t d);
bool ampm(const AlarmSel a, const AMPM m);
bool format(const AlarmSel a, const Format f);
bool dydt(const AlarmSel a, const DYDT d);
bool a1m1(const bool b);
bool a1m2(const bool b);
bool a1m3(const bool b);
bool a1m4(const bool b);
bool rate(const A1Rate a);
bool a2m2(const bool b);
bool a2m3(const bool b);
bool a2m4(const bool b);
bool rate(const A2Rate a);
// Control Registers
// enable oscillator if RTC is powered only by battery power
bool enableOscillator();
bool enableOscillator(const bool b);
// enable square wave even if Vcc < Vpf
bool enableBatteryBackedSquareWave();
bool enableBatteryBackedSquareWave(const bool b);
// enable force temperature sensor to convert the temperature into digital code
bool convertTemperature();
bool convertTemperature(const bool b);
// square wave frequency
SquareWaveFreq squareWaveFrequency();
bool squareWaveFrequency(const SquareWaveFreq f);
// trigger timing of square wave
bool trigger();
// interrupt control
InterruptCtrl interruptControl();
bool interruptControl(const InterruptCtrl i);
// enable alarms
bool enableAlarm1();
bool enableAlarm2();
bool enableAlarm1(const bool b);
bool enableAlarm2(const bool b);
// Status Register
// getters
bool oscillatorStopFlag();
bool enable32kHz();
int8_t agingOffset();
bool busy();
bool hasAlarmed(const AlarmSel a);
float temperature();
// setters
bool oscillatorStopFlag(const bool b);
bool enable32kHz(const bool b);
bool agingOffset(const int8_t o);
bool clearAlarm(const AlarmSel a);
- tzTest New
- WriteRules New
Example RTC_Ethernet
1. File RTC_Ethernet.ino
DS323x_Generic/examples/Time/Ethernet/RTC_Ethernet/RTC_Ethernet.ino
Lines 16 to 511 in 0e5f1fa
2. File defines.h
DS323x_Generic/examples/Time/Ethernet/RTC_Ethernet/defines.h
Lines 10 to 477 in 0e5f1fa
The following is debug terminal output when running example Alarm_Ethernet on Adafruit NRF52840_FEATHER_EXPRESS with ENC28J60 using EthernetENC Library
Start Alarm_Ethernet on NRF52840_FEATHER with ENC28J60 using EthernetENC Library
Timezone_Generic v1.10.0
DS323x_Generic v1.3.0
[TZ] =========================
[TZ] Default SPI pinout:
[TZ] MOSI: 25
[TZ] MISO: 24
[TZ] SCK: 26
[TZ] SS: 5
[TZ] =========================
[TZ] Board : NRF52840_FEATHER , setCsPin: 10
=========================
Currently Used SPI pinout:
MOSI:25
MISO:24
SCK:26
SS:5
=========================
Using mac index = 6
You're connected to the network, IP = 192.168.2.107
Packet received
Seconds since Jan 1 1900 = 3858361124
Unix time = 1649372324
The UTC time is 22:58:44
Alarm 1 is set to : 02:59:14
Alarm 1 alarm rate : 1
Alarm 2 is set to : 22:59:00
Alarm 2 alarm rate : 2
============================
22:58:45 Thu 07 Apr 2022 UTC
18:58:45 Thu 07 Apr 2022 EDT
============================
...
============================
22:58:59 Thu 07 Apr 2022 UTC
18:58:59 Thu 07 Apr 2022 EDT
============================
22:59:00 Thu 07 Apr 2022 UTC
18:59:00 Thu 07 Apr 2022 EDT
Alarm 2 activated
============================
22:59:01 Thu 07 Apr 2022 UTC
18:59:01 Thu 07 Apr 2022 EDT
============================
...
============================
22:59:14 Thu 07 Apr 2022 UTC
18:59:14 Thu 07 Apr 2022 EDT
Alarm 1 activated
============================
22:59:15 Thu 07 Apr 2022 UTC
18:59:15 Thu 07 Apr 2022 EDT
The following is debug terminal output when running example Alarm_STM32_Ethernet on STM32F7 Nucleo-144 NUCLEO_F767ZI with LAN8742A using STM32Ethernet Library
Start Alarm_STM32_Ethernet on NUCLEO_F767ZI, using LAN8742A Ethernet & STM32Ethernet Library
Timezone_Generic v1.10.0
DS323x_Generic v1.3.0
[TZ] Board : NUCLEO_F767ZI , setCsPin: 10
[TZ] Default SPI pinout:
[TZ] MOSI: 11
[TZ] MISO: 12
[TZ] SCK: 13
[TZ] SS: 10
[TZ] =========================
You're connected to the network, IP = 192.168.2.159
Packet received
Seconds since Jan 1 1900 = 3858361211
Unix time = 1649372411
The UTC time is 23:00:11
Alarm 1 is set to : 23:00:41
Alarm 1 alarm rate : 1
Alarm 2 is set to : 23:01:00
Alarm 2 alarm rate : 2
============================
23:00:12 Thu 07 Apr 2022 UTC
19:00:12 Thu 07 Apr 2022 EDT
============================
...
============================
23:00:41 Thu 07 Apr 2022 UTC
19:00:41 Thu 07 Apr 2022 EDT
Alarm 1 activated
============================
23:00:42 Thu 07 Apr 2022 UTC
19:00:42 Thu 07 Apr 2022 EDT
============================
...
============================
23:01:00 Thu 07 Apr 2022 UTC
19:01:00 Thu 07 Apr 2022 EDT
Alarm 2 activated
============================
23:01:01 Thu 07 Apr 2022 UTC
19:01:01 Thu 07 Apr 2022 EDT
The following is debug terminal output when running example RTC_WiFiNINA on Arduino SAMD21 SAMD_NANO_33_IOT with WiFiNINA using WiFiNINA_Generic Library
Start RTC_WiFiNINA on SAMD_NANO_33_IOT with WiFiNINA using WiFiNINA_Generic Library
Timezone_Generic v1.10.0
DS323x_Generic v1.3.0
Connecting to WPA SSID: HueNet1
You're connected to the network, IP = 192.168.2.128
WriteRules done
Packet received
Seconds since Jan 1 1900 = 3858361434
Unix time = 1649372634
The UTC time is 23:03:54
============================
23:03:54 Thu 07 Apr 2022 UTC
19:03:54 Thu 07 Apr 2022 EDT
============================
23:04:03 Thu 07 Apr 2022 UTC
19:04:03 Thu 07 Apr 2022 EDT
The following is debug terminal output when running example RTC_Ethernet on Adafruit NRF52840_FEATHER with W5500 using Ethernet_Generic Library
Start RTC_Ethernet on NRF52840_FEATHER with W5x00 using Ethernet_Generic Library
Timezone_Generic v1.10.0
DS323x_Generic v1.3.0
[TZ] =========== USE_ETHERNET_GENERIC ===========
[TZ] Default SPI pinout:
[TZ] MOSI: 25
[TZ] MISO: 24
[TZ] SCK: 26
[TZ] SS: 5
[TZ] =========================
[TZ] Board : NRF52840_FEATHER , setCsPin: 10
=========================
Currently Used SPI pinout:
MOSI:25
MISO:24
SCK:26
SS:5
=========================
Using mac index = 3
You're connected to the network, IP = 192.168.2.99
You're connected to the network, IP = 192.168.2.107
WriteRules done
Packet received
Seconds since Jan 1 1900 = 3858361477
Unix time = 1649372677
The UTC time is 23:04:37
============================
23:04:37 Thu 07 Apr 2022 UTC
19:04:37 Thu 07 Apr 2022 EDT
============================
23:04:46 Thu 07 Apr 2022 UTC
19:04:46 Thu 07 Apr 2022 EDT
The following is debug terminal output when running example RTC_STM32_Ethernet on STM32F7 Nucleo-144 NUCLEO_F767ZI with LAN8742A using STM32Ethernet Library
Start RTC_STM32_Ethernet on NUCLEO_F767ZI, using LAN8742A Ethernet & STM32Ethernet Library
Timezone_Generic v1.10.0
DS323x_Generic v1.3.0
[TZ] Board : NUCLEO_F767ZI , setCsPin: 10
[TZ] Default SPI pinout:
[TZ] MOSI: 11
[TZ] MISO: 12
[TZ] SCK: 13
[TZ] SS: 10
[TZ] =========================
You're connected to the network, IP = 192.168.2.159
Packet received
Seconds since Jan 1 1900 = 3858354656
Unix time = 1649365856
The UTC time is 21:10:56
============================
21:10:56 Thu 07 Apr 2022 UTC
17:10:56 Thu 07 Apr 2022 EDT
============================
21:11:05 Thu 07 Apr 2022 UTC
17:11:05 Thu 07 Apr 2022 EDT
The following is debug terminal output when running example RTC_STM32_Ethernet on STM32F7 Nucleo-144 NUCLEO_F767ZI with W5500 using Ethernet2 Library
Start RTC_STM32_Ethernet on NUCLEO_F767ZI, using W5x00 & Ethernet2 Library
Timezone_Generic v1.10.0
DS323x_Generic v1.3.0
[TZ] Board : NUCLEO_F767ZI , setCsPin: 10
[TZ] Default SPI pinout:
[TZ] MOSI: 11
[TZ] MISO: 12
[TZ] SCK: 13
[TZ] SS: 10
[TZ] =========================
You're connected to the network, IP = 192.168.2.117
WriteRules done
Packet received
Seconds since Jan 1 1900 = 3858361530
Unix time = 1649372730
The UTC time is 23:05:30
============================
23:05:30 Thu 07 Apr 2022 UTC
19:05:30 Thu 07 Apr 2022 EDT
============================
23:05:39 Thu 07 Apr 2022 UTC
19:05:39 Thu 07 Apr 2022 EDT
The following is debug terminal output when running example RTC_Ethernet on Arduino SAM DUE with W5500 using Ethernet_Generic Library
Start RTC_Ethernet on SAM DUE with W5x00 using Ethernet_Generic Library
Timezone_Generic v1.10.0
DS323x_Generic v1.3.0
[TZ] =========== USE_ETHERNET_GENERIC ===========
[TZ] Default SPI pinout:
[TZ] MOSI: 75
[TZ] MISO: 74
[TZ] SCK: 76
[TZ] SS: 10
[TZ] =========================
[TZ] Board : SAM DUE , setCsPin: 10
=========================
Currently Used SPI pinout:
MOSI:75
MISO:74
SCK:76
SS:10
=========================
Using mac index = 5
You're connected to the network, IP = 192.168.2.108
WriteRules done
Packet received
Seconds since Jan 1 1900 = 3858361572
Unix time = 1649372772
The UTC time is 23:06:12
============================
23:06:12 Thu 07 Apr 2022 UTC
19:06:12 Thu 07 Apr 2022 EDT
============================
23:06:21 Thu 07 Apr 2022 UTC
19:06:21 Thu 07 Apr 2022 EDT
The following is debug terminal output when running example Alarm_WiFiNINA on MBED NANO_RP2040_CONNECT with WiFiNINA using WiFiNINA_Generic Library
Start Alarm_WiFiNINA on MBED NANO_RP2040_CONNECT with WiFiNINA using WiFiNINA_Generic Library
Timezone_Generic v1.10.0
DS323x_Generic v1.3.0
Connecting to WPA SSID: HueNet1
You're connected to the network, IP = 192.168.2.153
Packet received
Seconds since Jan 1 1900 = 3858360812
Unix time = 1649372012
The UTC time is 22:53:32
Alarm 1 is set to : 02:54:02
Alarm 1 alarm rate : 1
Alarm 2 is set to : 22:54:00
Alarm 2 alarm rate : 2
============================
22:53:33 Thu 07 Apr 2022 UTC
18:53:33 Thu 07 Apr 2022 EDT
============================
22:53:34 Thu 07 Apr 2022 UTC
18:53:34 Thu 07 Apr 2022 EDT
============================
...
============================
22:53:59 Thu 07 Apr 2022 UTC
18:53:59 Thu 07 Apr 2022 EDT
============================
22:54:00 Thu 07 Apr 2022 UTC
18:54:00 Thu 07 Apr 2022 EDT
Alarm 2 activated
============================
22:54:01 Thu 07 Apr 2022 UTC
18:54:01 Thu 07 Apr 2022 EDT
============================
22:54:02 Thu 07 Apr 2022 UTC
18:54:02 Thu 07 Apr 2022 EDT
Alarm 1 activated
============================
22:54:03 Thu 07 Apr 2022 UTC
18:54:03 Thu 07 Apr 2022 EDT
============================
The following is debug terminal output when running example Alarm_Ethernet on MBED RASPBERRY_PI_PICO with W5x00 using Ethernet_Generic Library
Start Alarm_Ethernet on MBED RASPBERRY_PI_PICO with W5x00 using Ethernet_Generic Library
Timezone_Generic v1.10.0
DS323x_Generic v1.3.0
[TZ] Default DS323X pinout:
[TZ] SDA: 4
[TZ] SCL: 5
[TZ] =========== USE_ETHERNET_GENERIC ===========
[TZ] Default SPI pinout:
[TZ] MOSI: 19
[TZ] MISO: 16
[TZ] SCK: 18
[TZ] SS: 17
[TZ] =========================
[TZ] RPIPICO setCsPin: 17
=========================
Currently Used SPI pinout:
MOSI:19
MISO:16
SCK:18
SS:17
=========================
Using mac index = 12
You're connected to the network, IP = 192.168.2.128
Packet received
Seconds since Jan 1 1900 = 3858360812
Unix time = 1649372012
The UTC time is 22:53:32
Alarm 1 is set to : 02:54:02
Alarm 1 alarm rate : 1
Alarm 2 is set to : 22:54:00
Alarm 2 alarm rate : 2
============================
22:53:33 Thu 07 Apr 2022 UTC
18:53:33 Thu 07 Apr 2022 EDT
============================
22:53:34 Thu 07 Apr 2022 UTC
18:53:34 Thu 07 Apr 2022 EDT
============================
...
============================
22:53:59 Thu 07 Apr 2022 UTC
18:53:59 Thu 07 Apr 2022 EDT
============================
22:54:00 Thu 07 Apr 2022 UTC
18:54:00 Thu 07 Apr 2022 EDT
Alarm 2 activated
============================
22:54:01 Thu 07 Apr 2022 UTC
18:54:01 Thu 07 Apr 2022 EDT
============================
22:54:02 Thu 07 Apr 2022 UTC
18:54:02 Thu 07 Apr 2022 EDT
Alarm 1 activated
============================
22:54:03 Thu 07 Apr 2022 UTC
18:54:03 Thu 07 Apr 2022 EDT
============================
The following is debug terminal output when running example Alarm_Ethernet on RASPBERRY_PI_PICO with W5x00 using Ethernet_Generic Library
Start Alarm_Ethernet on RASPBERRY_PI_PICO with W5x00 using Ethernet_Generic Library
Timezone_Generic v1.10.0
DS323x_Generic v1.3.0
[TZ] Default DS323X pinout:
[TZ] SDA: 4
[TZ] SCL: 5
[TZ] =========== USE_ETHERNET_GENERIC ===========
[TZ] Default SPI pinout:
[TZ] MOSI: 19
[TZ] MISO: 16
[TZ] SCK: 18
[TZ] SS: 17
[TZ] =========================
[TZ] RPIPICO setCsPin: 17
=========================
Currently Used SPI pinout:
MOSI:19
MISO:16
SCK:18
SS:17
=========================
Using mac index = 10
You're connected to the network, IP = 192.168.2.126
Packet received
Seconds since Jan 1 1900 = 3858360946
Unix time = 1649372146
The UTC time is 22:55:46
Alarm 1 is set to : 02:56:16
Alarm 1 alarm rate : 1
Alarm 2 is set to : 22:56:00
Alarm 2 alarm rate : 2
============================
22:55:47 Thu 07 Apr 2022 UTC
18:55:47 Thu 07 Apr 2022 EDT
============================
22:55:48 Thu 07 Apr 2022 UTC
18:55:48 Thu 07 Apr 2022 EDT
============================
...
============================
22:56:00 Thu 07 Apr 2022 UTC
18:56:00 Thu 07 Apr 2022 EDT
Alarm 2 activated
============================
22:56:01 Thu 07 Apr 2022 UTC
18:56:01 Thu 07 Apr 2022 EDT
============================
...
============================
22:56:16 Thu 07 Apr 2022 UTC
18:56:16 Thu 07 Apr 2022 EDT
Alarm 1 activated
============================
22:56:17 Thu 07 Apr 2022 UTC
18:56:17 Thu 07 Apr 2022 EDT
The following is debug terminal output when running example RTC_ESP_Complex on ESP32_DEV
to demonstrate how to update system time
from RTC time
Start RTC_ESP_Complex on ESP32_DEV
Timezone_Generic v1.10.0
DS323x_Generic v1.3.0
[TZ] Default DS323X pinout:
[TZ] SDA: 21
[TZ] SCL: 22
Connecting to HueNet1
..............
You're connected to the network, IP = 192.168.2.107
Packet received
Seconds since Jan 1 1900 = 3858360348
Unix time = 1649371548
The UTC time is 22:45:48
============================
22:45:48 Thu 07 Apr 2022 UTC
18:45:48 Thu 07 Apr 2022 EDT
System Time UTC: Thu Apr 7 22:45:48 2022
============================
22:45:57 Thu 07 Apr 2022 UTC
18:45:57 Thu 07 Apr 2022 EDT
System Time UTC: Thu Apr 7 22:45:58 2022
The following is debug terminal output when running example RTC_ESP_Complex on ESP8266_NODEMCU_ESP12E
to demonstrate how to update system time
from RTC time
Start RTC_ESP_Complex on ESP8266_NODEMCU_ESP12E
Timezone_Generic v1.10.0
DS323x_Generic v1.3.0
[TZ] Default DS323X pinout:
[TZ] SDA: 4
[TZ] SCL: 5
Connecting to HueNet1
............................
You're connected to the network, IP = 192.168.2.127
Packet received
Seconds since Jan 1 1900 = 3858360490
Unix time = 1649371690
The UTC time is 22:48:10
============================
10:00:00 Fri 17 Jan 2031 UTC
05:00:00 Fri 17 Jan 2031 EST
System Time UTC: Thu Apr 7 22:48:10 2022
============================
10:24:24 Wed 10 Feb 2055 UTC
05:24:24 Wed 10 Feb 2055 EST
System Time UTC: Thu Apr 7 22:48:20 2022
The following is debug terminal output when running example RTC_Ethernet on Teensy 4.1
using built-in Ethernet and QNEthernet
Library
Start RTC_Ethernet on TEENSY 4.1 with QNEthernet
Timezone_Generic v1.10.0
DS323x_Generic v1.3.1
[TZ] Default DS323X pinout:
[TZ] SDA: 18
[TZ] SCL: 19
[TZ] ======== USE_QN_ETHERNET ========
Initialize QNEthernet using static IP => You're connected to the network, IP = 192.168.2.222
[TZ] Read from EEPROM, size = 4284 , offset = 0
[TZ] Write to EEPROM, size = 4284 , offset = 0
WriteRules done
Packet received
Seconds since Jan 1 1900 = 3858370692
Unix time = 1649381892
The UTC time is 1:38:12
============================
01:38:12 Fri 08 Apr 2022 UTC
21:38:12 Thu 07 Apr 2022 EDT
============================
01:38:21 Fri 08 Apr 2022 UTC
21:38:21 Thu 07 Apr 2022 EDT
============================
01:38:31 Fri 08 Apr 2022 UTC
21:38:31 Thu 07 Apr 2022 EDT
============================
01:38:41 Fri 08 Apr 2022 UTC
21:38:41 Thu 07 Apr 2022 EDT
The following is debug terminal output when running example RTC_Ethernet on Teensy 4.1
using built-in Ethernet and NativeEthernet
Library
Start RTC_Ethernet on TEENSY 4.1 with NativeEthernet
Timezone_Generic v1.10.0
DS323x_Generic v1.3.1
[TZ] Default DS323X pinout:
[TZ] SDA: 18
[TZ] SCL: 19
[TZ] ======== USE_NATIVE_ETHERNET ========
Using mac index = 17
You're connected to the network, IP = 192.168.2.116
[TZ] Read from EEPROM, size = 4284 , offset = 0
[TZ] Write to EEPROM, size = 4284 , offset = 0
WriteRules done
Packet received
Seconds since Jan 1 1900 = 3858372181
Unix time = 1649383381
The UTC time is 2:03:01
============================
02:03:01 Fri 08 Apr 2022 UTC
22:03:01 Thu 07 Apr 2022 EDT
============================
02:03:10 Fri 08 Apr 2022 UTC
22:03:10 Thu 07 Apr 2022 EDT
============================
02:03:20 Fri 08 Apr 2022 UTC
22:03:20 Thu 07 Apr 2022 EDT
============================
02:03:30 Fri 08 Apr 2022 UTC
22:03:30 Thu 07 Apr 2022 EDT
============================
02:03:40 Fri 08 Apr 2022 UTC
22:03:40 Thu 07 Apr 2022 EDT
Submit issues to: DS323x_Generic issues
- Bug Searching and Killing
- Add more examples
- Add support to Arduino SAMD21 (ZERO, MKR, NANO_33_IOT, etc.)
- Add support to Adafruit SAMD21 (Itsy-Bitsy M0, Metro M0, Feather M0 Express, etc.).
- Add support to Adafruit SAMD51 (Itsy-Bitsy M4, Metro M4, Grand Central M4, Feather M4 Express, etc.).
- 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..
- Add support to SAM DUE.
- Add support to Ethernet W5x00, using either
Ethernet
,Ethernet2
,Ethernet3
orEthernetLarge
library - Add support to Ethernet ENC28J60, using
UIPEthernet
library - Add support to ESP32 and ESP8266 using LittleFS or SPIFFS
- Add support to Seeeduino SAMD21/SAMD51: LoRaWAN, Zero, Femto M0, XIAO M0, Wio GPS Board, Wio Terminal, Grove UI Wireless
- Add support to
EthernetENC
- Add support to Arduino AVR boards (UNO, Nano, Mega, etc.)
- Add support to Arduino MegaAVR boards (UNO WiFi Rev 2, Nano Every, etc.)
- Add support to RP2040-based boards, such as RASPBERRY_PI_PICO, ADAFRUIT_FEATHER_RP2040 and GENERIC_RP2040, using Earle Philhower's arduino-pico core.
- Add support to RP2040-based boards, such as NANO_RP2040_CONNECT, RASPBERRY_PI_PICO, ADAFRUIT_FEATHER_RP2040 and GENERIC_RP2040, using Arduino-mbed RP2040 core.
- Add support to
ESP32-S2/ESP32-C3
- Optimize code by using passing by
reference
instead of byvalue
- Add
ESP_Complex
examples to demonstrate how to updatesystem time
fromRTC
time. - Add support to
Portenta_H7 Ethernet and WiFi
- Use Ethernet_Generic library as default for W5x00 Ethernet
- Add support to Teensy 4.1
QNEthernet
orNativeEthernet
Many thanks for everyone for bug reporting, new feature suggesting, testing and contributing to the development of this library.
- Based on and modified from the Hideaki Tai's DS323x Library.
- Thanks to good work of Miguel Alexandre Wisintainer for initiating, inspriring, working with, developing, debugging and testing.
- Thanks to rnsi for the enhancement request setTime() does not set system time #1, leading to new version v1.2.3
⭐️ Hideaki Tai |
Miguel Wisintainer |
rnsi |
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- Hideaki Tai
-
Copyright (c) 2020- Khoi Hoang