khoih-prog / RP2040_RTC

This library enables you to use RTC from RP2040-based boards such as Nano_RP2040_Connect, RASPBERRY_PI_PICO. This RP2040-based RTC, using Interrupt, has no battery backup. Time will be lost when powered down. To need NTP-client to update RTC every start-up.
MIT License
22 stars 4 forks source link

Update needed to support PICO_W as separate from PICO with a shield #6

Closed revell1 closed 1 year ago

revell1 commented 1 year ago

Library currently supports PICO with range of shields, but not the new PICO-W.

Needs extra work/modifications to build using WiFi when target is a PICO-W.

Also as a result, the current use of "defined(ARDUINO_RASPBERRY_PI_PICO)" may possibly need a re-think.

Also will need an example set, though the "RP2040_RTC_Time_WiFiNINA" example could be adjusted to work with minimal changes.

khoih-prog commented 1 year ago

Hi @revell1

Thanks to your reminder, I just updated this long-forgotten library and released the RP2040_RTC v1.1.1 to add the following examples to support RP2040W

  1. RP2040_RTC_Alarm_RP2040W
  2. RP2040_RTC_Time_RP2040W

Releases v1.1.1

  1. Add support to RP2040W using CYW43439 WiFi with arduino-pico core
revell1 commented 1 year ago

Hi, nice work.

Installed and working, though have a few observations, probably you do not need to do anything unless other users have problems, but thought I would not the things here for possible future info. I am guessing I am the first person to try this library on PICO-W, but hopefully not the last.

My notes/observations:

On installing/updating, got popup window listing a load of dependancies, so clicked to button for install all.

That ran, but did get some error output during install, not sure it makes any difference, not sure what it related too, and I think the log below may be a double, as I think it did it twice:

=-==== Library is already installed: Time:1.6.1 no protocol: java.lang.RuntimeException: java.net.MalformedURLException: no protocol: at cc.arduino.contributions.libraries.ui.LibraryManagerUI.lambda$onInstallPressed$4(LibraryManagerUI.java:250) at java.lang.Thread.run(Thread.java:748) Caused by: java.net.MalformedURLException: no protocol: at java.net.URL.(URL.java:593) at java.net.URL.(URL.java:490) at java.net.URL.(URL.java:439) at cc.arduino.contributions.DownloadableContributionsDownloader.download(DownloadableContributionsDownloader.java:60) at cc.arduino.contributions.DownloadableContributionsDownloader.download(DownloadableContributionsDownloader.java:56) at cc.arduino.contributions.libraries.LibraryInstaller.performInstall(LibraryInstaller.java:148) at cc.arduino.contributions.libraries.LibraryInstaller.install(LibraryInstaller.java:118) at cc.arduino.contributions.libraries.ui.LibraryManagerUI.lambda$onInstallPressed$4(LibraryManagerUI.java:240) ... 1 more Library is already installed: WiFiNINA_Generic:1.8.14-6 Library is already installed: WiFiMulti_Generic:1.2.2 Library is already installed: Functional-Vlpp:1.0.2 Library is already installed: WiFiEspAT:1.4.1 Library is already installed: ArduinoSTL:1.3.3 Library is already installed: ESP_AT_Lib:1.4.1 Library is already installed: Ethernet_Generic:2.6.1 Library is already installed: Timezone_Generic:1.10.1 Library is already installed: Time:1.6.1 no protocol: java.lang.RuntimeException: java.net.MalformedURLException: no protocol: at cc.arduino.contributions.libraries.ui.LibraryManagerUI.lambda$onInstallPressed$4(LibraryManagerUI.java:250) at java.lang.Thread.run(Thread.java:748) Caused by: java.net.MalformedURLException: no protocol: at java.net.URL.(URL.java:593) at java.net.URL.(URL.java:490) at java.net.URL.(URL.java:439) at cc.arduino.contributions.DownloadableContributionsDownloader.download(DownloadableContributionsDownloader.java:60) at cc.arduino.contributions.DownloadableContributionsDownloader.download(DownloadableContributionsDownloader.java:56) at cc.arduino.contributions.libraries.LibraryInstaller.performInstall(LibraryInstaller.java:148) at cc.arduino.contributions.libraries.LibraryInstaller.install(LibraryInstaller.java:118) at cc.arduino.contributions.libraries.ui.LibraryManagerUI.lambda$onInstallPressed$4(LibraryManagerUI.java:240) ... 1 more =-====

I then selected new project and selected the/your "RP2040_RTC_Time_RP2040W.ino" example. My board is currently selected as "PI PICO 2MB (no FS)", modified code to add my SSID/PWD then built.

Result log is OK except a few warnings, though the code runs. The warnings in the log are: =-==== In file included from C:\Users.....\Documents\Arduino\libraries\Timezone_Generic\src/Timezone_Generic.h:44, from C:\Users.....\Documents\Coding\PiPico_CodeTests\PiPicoW\ino_examples\RP2040_RTC_Time_RP2040W\RP2040_RTC_Time_RP2040W.ino:17: C:\Users.....\Documents\Arduino\libraries\Timezone_Generic\src/Timezone_Generic_Impl.h:272:4: warning: #warning Use RP2040 (such as RASPBERRY_PI_PICO) and LittleFS [-Wcpp] 272 | #warning Use RP2040 (such as RASPBERRY_PI_PICO) and LittleFS | ^~~ In file included from C:\Users.....\Documents\Arduino\libraries\Timezone_Generic\src/Timezone_Generic.h:44, from C:\Users.....\Documents\Coding\PiPico_CodeTests\PiPicoW\ino_examples\RP2040_RTC_Time_RP2040W\RP2040_RTC_Time_RP2040W.ino:17: C:\Users.....\Documents\Arduino\libraries\Timezone_Generic\src/Timezone_Generic_Impl.h:1521:4: warning: #warning Using RP2040 LittleFS in Timezone_Generic [-Wcpp] 1521 | #warning Using RP2040 LittleFS in Timezone_Generic | ^~~ =-====

As I say, I think it is probably linked to me using PICO with no FS, so I don't think you need do anything.

Then when running, I get:

=-==== You're connected to the network, IP = 192.168.1.116 [TZ] LittleFS error Packet received Seconds since Jan 1 1900 = 3873167587 Unix time = 1664178787 The UTC time is 7:53:07 =-=========================== 07:53:08 Mon 26 Sep 2022 UTC 03:53:08 Mon 26 Sep 2022 EDT =-=========================== =-====

Note the "[TZ] LittleFS error", again that looks like simply due to my board having no FS set.

So again I don't think you need to do anything.