Adalogger Featherwing not running

Please tell us which board you are using.
For CircuitPython issues, ask in the Adafruit CircuitPython forum.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
torpedo51
 
Posts: 53
Joined: Fri Dec 27, 2013 4:42 am

Adalogger Featherwing not running

Post by torpedo51 »

Hi,
I can initialize the time on the device with the kernel's compile timestamp, and I can successfully force it to initialize again with the kernel's timestamp.
However, when I interrogate the device at a later time, it always returns the same timestamp that was used for initialization.

I started with the pfc8523 example, and added a few lines below.

Code: Select all

  RTC_PCF8523 rtc;
  void setup() {
    if (! rtc.begin()) {
      display.println(" Couldn't find RTC");
      while (1);
    }
    if (! rtc.initialized()) {
      display.println(" setting RTC (NOT running)");
      rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
    } else {
      display.println(" battery - OK");        
    }
    display.println(" complete");

    DateTime rtcSnapshot = rtc.now();
    display.print("RTC: "); display.println(String(rtcSnapshot.timestamp(DateTime::TIMESTAMP_TIME)));
    delay(3000);
    DateTime rtcSnapshot2 = rtc.now();
    display.print("RTC: "); display.println(String(rtcSnapshot2.timestamp(DateTime::TIMESTAMP_TIME)));
... this will print the same exact value twice, even though 3 seconds elapsed.

My Adalogger is stacked on a Feather Huzzah ESP8266 WiFi.

User avatar
jdelcamp11
 
Posts: 283
Joined: Mon Nov 17, 2014 12:30 am

Re: Adalogger Featherwing not running

Post by jdelcamp11 »

You don't specify what display you are using.
But I think you are missing a line.

Code: Select all

  display.display(); 
In your code you are sending the data to the display, but not telling it to display the new data.

On a separate note, You should only run this line once. Then comment it out and reload the sketch.

Code: Select all

rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
This line sets the time in the PCF to the current compile time. But that will remain the set time each reset of the microprocessor. The PCF has a battery backup that should keep the time for several years without resetting it.

User avatar
adafruit_support_carter
 
Posts: 29157
Joined: Tue Nov 29, 2016 2:45 pm

Re: Adalogger Featherwing not running

Post by adafruit_support_carter »


User avatar
torpedo51
 
Posts: 53
Joined: Fri Dec 27, 2013 4:42 am

Re: Adalogger Featherwing not running

Post by torpedo51 »

Nope.

As noted, I can successfully initialize the RTC, and re-initialize it, but it never advances.

I execute display.display() after the two print statements [not shown in the snippet], and it does generate two values on my OLED, and the values are identical. They should not be identical. They should be three seconds apart.

Both values are always identical to the timestamp that was used to initialize the RTC... no matter how much time elapses. For example, I could initialize the RTC at 17:09:11, unplug the widget from my USB power supply, come back 20 minutes later, connect it to the power supply, and the display will show 17:09:11 again. It always shows the initialization timestamp.

Recall: all I did was take the existing pfc8236 example and add some print statements.

User avatar
adafruit_support_carter
 
Posts: 29157
Joined: Tue Nov 29, 2016 2:45 pm

Re: Adalogger Featherwing not running

Post by adafruit_support_carter »

For the sake of troubleshooting, don't use the OLED for output. Run the example as is and verify that you are also seeing the same behavior in the Serial Monitor. It's not clear if you've done that or are basing things on what you are seeing on the OLED.

User avatar
torpedo51
 
Posts: 53
Joined: Fri Dec 27, 2013 4:42 am

Re: Adalogger Featherwing not running

Post by torpedo51 »

Ok.
Steps to reproduce:
1. Open Arduino IDE 1.8.10
2. Open example, "pcf8523"
3. Comment out lines 10-12, because these three lines cause my serial monitor to output garbled characters at every baud rate
4. Remove code that generates a future timestamp (lines 53+) because its not necessary for this example and distracting.
5. Upload successfully
6. Observe serial monitor debugging info that shows the time is not elapsing, as recorded in the 3000ms intervals.
??

Code: Select all

// Date and time functions using a PCF8523 RTC connected via I2C and Wire lib
#include "RTClib.h"

RTC_PCF8523 rtc;

char daysOfTheWeek[7][12] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};

void setup () {

//  while (!Serial) {
//    delay(1);  // for Leonardo/Micro/Zero
//  }

  Serial.begin(57600);
  if (! rtc.begin()) {
    Serial.println("Couldn't find RTC");
    while (1);
  }
  
  if (! rtc.initialized()) {
    Serial.println("RTC is NOT running!");
    // following line sets the RTC to the date & time this sketch was compiled
    // rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
    // This line sets the RTC with an explicit date & time, for example to set
    // January 21, 2014 at 3am you would call:
    // rtc.adjust(DateTime(2014, 1, 21, 3, 0, 0));
  }
}

void loop () {
    DateTime now = rtc.now();

    Serial.print(now.year(), DEC);
    Serial.print('/');
    Serial.print(now.month(), DEC);
    Serial.print('/');
    Serial.print(now.day(), DEC);
    Serial.print(" (");
    Serial.print(daysOfTheWeek[now.dayOfTheWeek()]);
    Serial.print(") ");
    Serial.print(now.hour(), DEC);
    Serial.print(':');
    Serial.print(now.minute(), DEC);
    Serial.print(':');
    Serial.print(now.second(), DEC);
    Serial.println();

    Serial.print(" since midnight 1/1/1970 = ");
    Serial.print(now.unixtime());
    Serial.print("s = ");
    Serial.print(now.unixtime() / 86400L);
    Serial.println("d");

    Serial.println();
    delay(3000);
}
Upload: console output
Executable segment sizes:
IROM : 235876 - code in flash (default or ICACHE_FLASH_ATTR)
IRAM : 27680 / 32768 - code in IRAM (ICACHE_RAM_ATTR, ISRs...)
DATA : 1344 ) - initialized variables (global, static) in RAM/HEAP
RODATA : 780 ) / 81920 - constants (global, static) in RAM/HEAP
BSS : 25392 ) - zeroed variables (global, static) in RAM/HEAP
Sketch uses 265680 bytes (25%) of program storage space. Maximum is 1044464 bytes.
Global variables use 27516 bytes (33%) of dynamic memory, leaving 54404 bytes for local variables. Maximum is 81920 bytes.
esptool.py v2.8
Serial port /dev/cu.SLAB_USBtoUART
Connecting........_
Chip is ESP8266EX
Features: WiFi
Crystal is 26MHz
MAC: ec:fa:bc:62:1c:cc
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 460800
Changed.
Configuring flash size...
Auto-detected Flash size: 4MB
Compressed 269840 bytes to 196528...

Writing at 0x00000000... (8 %)
Writing at 0x00004000... (16 %)
Writing at 0x00008000... (25 %)
Writing at 0x0000c000... (33 %)
Writing at 0x00010000... (41 %)
Writing at 0x00014000... (50 %)
Writing at 0x00018000... (58 %)
Writing at 0x0001c000... (66 %)
Writing at 0x00020000... (75 %)
Writing at 0x00024000... (83 %)
Writing at 0x00028000... (91 %)
Writing at 0x0002c000... (100 %)
Wrote 269840 bytes (196528 compressed) at 0x00000000 in 4.7 seconds (effective 455.3 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin..
.

Serial Monitor output
13:16:45.670 -> 2020/2/16 (Sunday) 12:49:41
13:16:45.670 -> since midnight 1/1/1970 = 1581857381s = 18308d
13:16:45.670 ->
13:16:48.636 -> 2020/2/16 (Sunday) 12:49:41
13:16:48.636 -> since midnight 1/1/1970 = 1581857381s = 18308d
13:16:48.636 ->
13:16:51.633 -> 2020/2/16 (Sunday) 12:49:41
13:16:51.633 -> since midnight 1/1/1970 = 1581857381s = 18308d
13:16:51.633 ->
13:16:54.630 -> 2020/2/16 (Sunday) 12:49:41
13:16:54.630 -> since midnight 1/1/1970 = 1581857381s = 18308d
13:16:54.630 ->
13:16:57.647 -> 2020/2/16 (Sunday) 12:49:41
13:16:57.647 -> since midnight 1/1/1970 = 1581857381s = 18308d
13:16:57.647 ->
13:17:00.640 -> 2020/2/16 (Sunday) 12:49:41
13:17:00.640 -> since midnight 1/1/1970 = 1581857381s = 18308d
13:17:00.640 ->
13:17:03.651 -> 2020/2/16 (Sunday) 12:49:41
13:17:03.651 -> since midnight 1/1/1970 = 1581857381s = 18308d
Attachments
IMG_4101.png
IMG_4101.png (1002.58 KiB) Viewed 270 times

User avatar
jdelcamp11
 
Posts: 283
Joined: Mon Nov 17, 2014 12:30 am

Re: Adalogger Featherwing not running

Post by jdelcamp11 »

As a sanity check pull the feather and adalogger, stacking the adalogger on top the feather. Just to make sure nothing else is interferring.
Sounds like the RTC clock pulse isn't running.

User avatar
torpedo51
 
Posts: 53
Joined: Fri Dec 27, 2013 4:42 am

Re: Adalogger Featherwing not running

Post by torpedo51 »

Did that. Same result.

User avatar
adafruit_support_carter
 
Posts: 29157
Joined: Tue Nov 29, 2016 2:45 pm

Re: Adalogger Featherwing not running

Post by adafruit_support_carter »

3. Comment out lines 10-12, because these three lines cause my serial monitor to output garbled characters at every baud rate
Try moving those lines to after the Serial.begin(). Sounds like the reset baud rate is different.

See what the behavior is if you explicitly set a datetime in setup(). Instead of uncommenting the section with the if clause, just add a single line like:

Code: Select all

rtc.adjust(DateTime(2014, 1, 21, 3, 0, 0));
in setup(). Use that syntax instead of the F() macros to force a known datetime.

User avatar
jdelcamp11
 
Posts: 283
Joined: Mon Nov 17, 2014 12:30 am

Re: Adalogger Featherwing not running

Post by jdelcamp11 »

Out of curiosity. Can you generate a square wave on the int pin of the adalogger.
There is an example in the RTClib for the ds1307 but it should be compatible.
Note the requirement for 10k pullup on this pin.

User avatar
zreed
 
Posts: 1
Joined: Sat Dec 23, 2017 5:48 pm

Re: Adalogger Featherwing not running

Post by zreed »

adafruit_support_carter wrote: Try moving those lines to after the Serial.begin(). Sounds like the reset baud rate is different.

See what the behavior is if you explicitly set a datetime in setup(). Instead of uncommenting the section with the if clause, just add a single line like:

Code: Select all

rtc.adjust(DateTime(2014, 1, 21, 3, 0, 0));
in setup(). Use that syntax instead of the F() macros to force a known datetime.
I'm having the same issue. Setting a value using adjust() in setup() doesn't change anything. I have noticed that the RTC works fine in CircuitPython. Using adjust() doesn't seem to do anything as the time was still correct when I connected it to a CircuitPython board to see if the time changed.

User avatar
torpedo51
 
Posts: 53
Joined: Fri Dec 27, 2013 4:42 am

Re: Adalogger Featherwing not running

Post by torpedo51 »

My issue isn't the same as the person above. adjust() works for me, but the clock doesn't advance after that. When he calls adjust(), the time isn't changed.

As you can see from the output I produced above, I was able to force the adjust() successfully just minutes prior to running the requested test. You can see that the RTC has been set and stuck about three minutes earlier:
13:16:45.670 -> 2020/2/16 (Sunday) 12:49:41

User avatar
adafruit_support_carter
 
Posts: 29157
Joined: Tue Nov 29, 2016 2:45 pm

Re: Adalogger Featherwing not running

Post by adafruit_support_carter »

@everyone - Please start new threads for your issue. This thread is for @torpedo51

@torpedo51 - Your code listing above has all the adjust() lines commented out. Can you post the code listing for what you ran to set the time. FWIW, I just tried the sketch with a Feather ESP8266 and a logger FeatherWing and it seemed to work as expected here. I used the macro lines to set:

Code: Select all

rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
and here's the serial monitor output:

Code: Select all

10:26:41.571 -> 2020/3/13 (Friday) 10:26:19
10:26:41.571 ->  since midnight 1/1/1970 = 1584095179s = 18334d
10:26:41.571 ->  now + 7d + 12h + 30m + 6s: 2020/3/20 22:56:25
10:26:41.571 -> 
10:26:44.584 -> 2020/3/13 (Friday) 10:26:22
10:26:44.584 ->  since midnight 1/1/1970 = 1584095182s = 18334d
10:26:44.584 ->  now + 7d + 12h + 30m + 6s: 2020/3/20 22:56:28
10:26:44.584 -> 
10:26:47.564 -> 2020/3/13 (Friday) 10:26:25
10:26:47.564 ->  since midnight 1/1/1970 = 1584095185s = 18334d
10:26:47.564 ->  now + 7d + 12h + 30m + 6s: 2020/3/20 22:56:31
10:26:47.564 -> 
10:26:50.577 -> 2020/3/13 (Friday) 10:26:28
10:26:50.577 ->  since midnight 1/1/1970 = 1584095188s = 18334d
10:26:50.577 ->  now + 7d + 12h + 30m + 6s: 2020/3/20 22:56:34

User avatar
torpedo51
 
Posts: 53
Joined: Fri Dec 27, 2013 4:42 am

Re: Adalogger Featherwing not running

Post by torpedo51 »

Hi,
Back from C-19 leave, and still haven't figured this out. As noted at the top, I'm using the example source code provided, with three modifications
1. Comment lines 10-13 because they garble the outbound on my serial monitor
2. Copy and paste the RTC adjustment line outside of any condition statements, so that it is FORCEFULLY set every time the sketch is run
3. Commented out all of the irrelevant lines that compute and print the seconds remaining until a future date.

Code

Code: Select all

// Date and time functions using a PCF8523 RTC connected via I2C and Wire lib
#include "RTClib.h"

RTC_PCF8523 rtc;

char daysOfTheWeek[7][12] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};

void setup () {


  Serial.begin(57600);

//  while (!Serial) {
//    delay(1);  // for Leonardo/Micro/Zero
//  }

  if (! rtc.begin()) {
    Serial.println("Couldn't find RTC");
    while (1);
  }

  if (! rtc.initialized()) {
    Serial.println("RTC is NOT running!");
    // following line sets the RTC to the date & time this sketch was compiled
    // rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
    // This line sets the RTC with an explicit date & time, for example to set
    // January 21, 2014 at 3am you would call:
    // rtc.adjust(DateTime(2014, 1, 21, 3, 0, 0));
  }

  //FORCE INIT
  rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
}

void loop () {
    DateTime now = rtc.now();

    Serial.print(now.year(), DEC);
    Serial.print('/');
    Serial.print(now.month(), DEC);
    Serial.print('/');
    Serial.print(now.day(), DEC);
    Serial.print(" (");
    Serial.print(daysOfTheWeek[now.dayOfTheWeek()]);
    Serial.print(") ");
    Serial.print(now.hour(), DEC);
    Serial.print(':');
    Serial.print(now.minute(), DEC);
    Serial.print(':');
    Serial.print(now.second(), DEC);
    Serial.println();

    Serial.print(" since midnight 1/1/1970 = ");
    Serial.print(now.unixtime());
    Serial.print("s = ");
    Serial.print(now.unixtime() / 86400L);
    Serial.println("d");
/*
    // calculate a date which is 7 days, 12 hours and 30 seconds into the future
    DateTime future (now + TimeSpan(7,12,30,6));

    Serial.print(" now + 7d + 12h + 30m + 6s: ");
    Serial.print(future.year(), DEC);
    Serial.print('/');
    Serial.print(future.month(), DEC);
    Serial.print('/');
    Serial.print(future.day(), DEC);
    Serial.print(' ');
    Serial.print(future.hour(), DEC);
    Serial.print(':');
    Serial.print(future.minute(), DEC);
    Serial.print(':');
    Serial.print(future.second(), DEC);
    Serial.println();
*/
    Serial.println();
    delay(3000);
}
Output:
10:06:54.487 -> ⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮
10:06:54.495 -> SDK:2.2.2-dev(38a443e)/Core:2.6.3=20603000/lwIP:STABLE-2_1_2_RELEASE/glue:1.2-16-ge23a07e/BearSSL:89454af
10:06:54.529 -> 2021/9/11 (Saturday) 10:6:46
10:06:54.529 -> since midnight 1/1/1970 = 1631354806s = 18881d
10:06:54.529 ->
10:06:54.596 -> scandone
10:06:54.596 -> state: 0 -> 2 (b0)
10:06:54.630 -> state: 2 -> 3 (0)
10:06:54.630 -> state: 3 -> 5 (10)
10:06:54.630 -> add 0
10:06:54.630 -> aid 2
10:06:54.630 -> cnt
10:06:54.664 ->
10:06:54.664 -> connected with spudnet, channel 8
10:06:54.702 -> dhcp client start...
10:06:55.080 -> ip:10.0.1.123,mask:255.255.255.0,gw:10.0.1.1
10:06:57.501 -> 2021/9/11 (Saturday) 10:6:46
10:06:57.501 -> since midnight 1/1/1970 = 1631354806s = 18881d
10:06:57.501 ->
10:07:00.512 -> 2021/9/11 (Saturday) 10:6:46
10:07:00.512 -> since midnight 1/1/1970 = 1631354806s = 18881d
10:07:00.512 ->
10:07:03.522 -> 2021/9/11 (Saturday) 10:6:46
10:07:03.522 -> since midnight 1/1/1970 = 1631354806s = 18881d
10:07:03.522 ->
10:07:06.512 -> 2021/9/11 (Saturday) 10:6:46
10:07:06.512 -> since midnight 1/1/1970 = 1631354806s = 18881d
10:07:06.512 ->
10:07:09.506 -> 2021/9/11 (Saturday) 10:6:46
10:07:09.506 -> since midnight 1/1/1970 = 1631354806s = 18881d
10:07:09.506 ->
10:07:12.527 -> 2021/9/11 (Saturday) 10:6:46
10:07:12.527 -> since midnight 1/1/1970 = 1631354806s = 18881d
10:07:12.527 ->
10:07:15.505 -> 2021/9/11 (Saturday) 10:6:46
10:07:15.505 -> since midnight 1/1/1970 = 1631354806s = 18881d
10:07:15.505 ->

User avatar
torpedo51
 
Posts: 53
Joined: Fri Dec 27, 2013 4:42 am

Re: Adalogger Featherwing not running

Post by torpedo51 »

UPDATE: figured it out.

I swapped my Adalogger Featherwing out with another. The other unit works. Seems that I have a bad device!

Locked
Please be positive and constructive with your questions and comments.

Return to “Feather - Adafruit's lightweight platform”