Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Sep 29 21:20
    Makuna unlabeled #110
  • Sep 29 21:20
    Makuna closed #110
  • Sep 29 21:15

    Makuna on master

    enable travis build using platf… (compare)

  • Sep 29 21:15
    Makuna closed #116
  • Sep 23 20:22
    Makuna closed #120
  • Sep 23 20:22
    Makuna updated the wiki
  • Sep 23 20:13
    Makuna updated the wiki
  • Sep 23 08:34
    T0m92 opened #120
  • Aug 27 15:58
    Makuna closed #119
  • Aug 27 15:58
    Makuna labeled #119
  • Aug 27 15:55
    Makuna closed #118
  • Aug 27 08:15
    Bredahl opened #119
  • Aug 03 15:39
    Flavian opened #118
  • Aug 01 19:24
    Makuna closed #117
  • Aug 01 17:19
    lucagrosshennig opened #117
  • Jul 31 17:46
    thijstriemstra opened #116
  • Jul 25 23:30

    Makuna on 2.3.5

    (compare)

  • Jul 25 23:28

    Makuna on NextRelease

    (compare)

  • Jul 25 23:28

    Makuna on master

    increment version (#115) (compare)

  • Jul 25 23:28
    Makuna closed #115
koosiekloek
@koosiekloek
hi Everyone
koosiekloek
@koosiekloek
i am fairly new to Arduino so sorry if i ask stupid questions. i am using a Arduino pro mini with DS1302 RTC my code is the ds1302 simple example with only the connection pins and time delay changed. the problem is every second loop that displays time gives 00/00/2000 00:00:00 and the very next loop gives correct time. what is the problem here and how can i fix it please, thanks for any help!
Serial log
09:50:54.530 -> 04/18/2019 09:50:43
09:50:59.551 -> 00/00/2000 00:00:00
09:50:59.551 -> RTC lost confidence in the DateTime!
09:51:04.527 -> 04/18/2019 09:50:53
09:51:09.515 -> 00/00/2000 00:00:00
09:51:09.561 -> RTC lost confidence in the DateTime!
09:51:14.547 -> 04/18/2019 09:51:03
09:51:19.525 -> 00/00/2000 00:00:00
09:51:19.572 -> RTC lost confidence in the DateTime!
09:51:24.561 -> 04/18/2019 09:51:13
09:51:29.526 -> 00/00/2000 00:00:00
09:51:29.580 -> RTC lost confidence in the DateTime!
09:51:34.531 -> 04/18/2019 09:51:23
09:51:39.557 -> 00/00/2000 00:00:00
09:51:39.557 -> RTC lost confidence in the DateTime!
09:51:44.527 -> 04/18/2019 09:51:33
09:51:49.532 -> 00/00/2000 00:00:00
09:51:49.579 -> RTC lost confidence in the DateTime!
09:51:54.566 -> 04/18/2019 09:51:43
09:51:59.537 -> 00/00/2000 00:00:00
09:51:59.537 -> RTC lost confidence in the DateTime!
09:52:04.560 -> 04/18/2019 09:51:53
09:52:09.547 -> 00/00/2000 00:00:00
09:52:09.547 -> RTC lost confidence in the DateTime!
09:52:14.525 -> 04/18/2019 09:52:03
Michael Miller
@Makuna
@koosiekloek What did you change the delay to? The sample uses 10 seconds. Does it work correctly with 10 seconds? If it does, try slowly decreasing the delay until it doesn't work anymore. I suspect there is a required delay time between transactions that is not correctly accounted for in the ThreeWire.h.
Michael Miller
@Makuna
Also, make sure the pins you are using are not used for something else.
koosiekloek
@koosiekloek

i changed Delay now as below seems 10sec is working fine but i need a bit shorter time per loop as i will have button input for logging as well. always every second display is wrong down to 1sec delay at 0.5 sec delay two displays are right then two displays are wrong? seems like only uneven number of seconds can be displayed? see last log of 0.7sec Delay only uneven seconds are displayed?
10 Sec Delay
10:17:46.085 -> compiled: Apr 18 201910:17:35
10:17:46.138 -> 04/18/2019 10:17:35
10:17:46.138 -> RTC lost confidence in the DateTime!
10:17:46.185 -> RTC is the same as compile time! (not expected but all is fine)
10:17:46.285 -> 04/18/2019 10:17:35
10:17:56.197 -> 04/18/2019 10:17:45
10:18:06.201 -> 04/18/2019 10:17:55
10:18:16.201 -> 04/18/2019 10:18:05

7 Sec Delay
10:20:56.795 -> compiled: Apr 18 201910:20:45
10:20:56.795 -> 04/18/2019 10:20:45
10:20:56.842 -> RTC is the same as compile time! (not expected but all is fine)
10:20:56.896 -> 04/18/2019 10:20:45
10:21:03.833 -> 00/00/2000 00:00:00
10:21:03.880 -> RTC lost confidence in the DateTime!
10:21:10.845 -> 04/18/2019 10:20:59
10:21:17.843 -> 00/00/2000 00:00:00
10:21:17.881 -> RTC lost confidence in the DateTime!
10:21:24.833 -> 04/18/2019 10:21:13

5 Sec Delay
10:23:07.322 -> compiled: Apr 18 201910:22:55
10:23:07.375 -> 04/18/2019 10:22:55
10:23:07.375 -> RTC lost confidence in the DateTime!
10:23:07.422 -> RTC is the same as compile time! (not expected but all is fine)
10:23:07.475 -> 04/18/2019 10:22:55
10:23:12.444 -> 00/00/2000 00:00:00
10:23:12.444 -> RTC lost confidence in the DateTime!
10:23:17.464 -> 04/18/2019 10:23:05
10:23:22.438 -> 00/00/2000 00:00:00
10:23:22.438 -> RTC lost confidence in the DateTime!
10:23:27.415 -> 04/18/2019 10:23:15

3 Sec Delay
10:24:48.776 -> compiled: Apr 18 201910:24:37
10:24:48.776 -> 04/18/2019 10:24:37
10:24:48.814 -> RTC lost confidence in the DateTime!
10:24:48.861 -> RTC is the same as compile time! (not expected but all is fine)
10:24:48.908 -> 04/18/2019 10:24:37
10:24:51.894 -> 00/00/2000 00:00:00
10:24:51.894 -> RTC lost confidence in the DateTime!
10:24:54.864 -> 04/18/2019 10:24:43
10:24:57.879 -> 00/00/2000 00:00:00
10:24:57.879 -> RTC lost confidence in the DateTime!
10:25:00.892 -> 04/18/2019 10:24:49

1 Sec Delay
10:26:01.916 -> compiled: Apr 18 201910:25:50
10:26:01.963 -> 04/18/2019 10:25:50
10:26:01.963 -> RTC lost confidence in the DateTime!
10:26:02.017 -> RTC is newer than compile time. (this is expected)
10:26:02.064 -> 00/00/2000 00:00:00
10:26:02.064 -> RTC lost confidence in the DateTime!
10:26:03.069 -> 04/18/2019 10:25:51
10:26:04.071 -> 00/00/2000 00:00:00
10:26:04.071 -> RTC lost confidence in the DateTime!
10:26:05.065 -> 04/18/2019 10:25:53
10:26:06.052 -> 00/00/2000 00:00:00
10:26:06.099 -> RTC lost confidence in the DateTime!
10:26:07.041 -> 04/18/2019 10:25:55

0.5 Sec Delay
10:27:01.559 -> compiled: Apr 18 201910:26:50
10:27:01.612 -> 04/18/2019 10:26:50
10:27:01.612 -> RTC is older than compile time! (Updating DateTime)
10:27:01.659 -> 00/00/2000 00:00:00
10:27:01.659 -> RTC lost confidence in the DateTime!
10:27:02.180 -> 00/00/2000 00:00:00
10:27:02.180 -> RTC lost confidence in the DateTime!
10:27:02.668 -> 04/18/2019 10:26:51
10:27:03.139 -> 04/18/2019 10:26:51
10:27:03.663 -> 00/00/2000 00:00:00
10:27:03.663 -> RTC lost confidence in the DateTime!
10:27:04.182 -> 00/00/2000 00:00:00
10:27:04.182 -> RTC lost confidence in the DateTime!
10:27:04.683 -> 04/18/2019 10:26:53
10:27:05.185 -> 04/18/2019 10:26:53

0.7 Sec Delay

10:35:32.521 -> compiled: Apr 18 201910:35:21
10:35:32.574 -> 04/18/2019 10:35:21
10:35:32.574 -> RTC lost confidence in the DateTime!
10:35:32.621 -> RTC is the same as compile time! (not expected but all is fine)
10:35:32.674 -> 04/18/2019 10:35:21
10:35:33.378 -> 04/18/2019 10:35:21
10:35:34.083 -> 00/00/2000 00:00:00
10:35:34.083 -> RTC lost confidence in the DateTime!
10:35:34.734 -> 04/18/2019 10:35:23
10:35:35.489 -> 04/18/2019 10:35:23
10:35:36.138 -> 00/00/2000 00:00:00
10:35:36.192 -> RTC lost confidence in the DateTime!
10:35:36.842 -> 04/18/2019 10:35:25
10:35:37.544 -> 04/18/2019 10:35:25
10:35:38.249 -> 00/00/2000 00:00:00
10:35:38.302 -> RTC lost confidence in the DateTime!
10:35:38.951 -> 04/18/2019 10:35:27
10:35:39.655 -> 00/00/2000 00:00:00
10:35:39.709 -> RTC lost confidence in the DateTime!
10:35:40.361 -> 00/00/2000 00:00:00
10:35:40.415 -> RTC lost confidence in the DateTime!
10:35:41.064 -> 04/18/2019 10:35:29
10:35:41.767 -> 00/00/2000 00:00:00
10:35:41.820 -> RTC lost confidence in the DateTime!
10:35:42.472 -> 00/00/2000 00:00:00
10:35:42.525 -> RTC lost confidence in the DateTime!
10:35:43.176 -> 04/18/2019 10:35:31
10:35:43.879 -> 00/00/2000 00:00:00
10:35:43.879 -> RTC lost confidence in the DateTime!
10:35:44.583 -> 04/18/2019 10:35:33
10:35:45.288 -> 04/18/2019 10:35:33
10:35:45.991 -> 00/00/2000 00:00:00
10:35:45.991 -> RTC lost confidence in the DateTime!
10:35:46.693 -> 04/18/2019 10:35:35
10:35:47.397 -> 04/18/2019 10:35:35
10:35:48.055 -> 00/00/2000 00:00:00
10:35:48.102 -> RTC lost confidence in the DateTime!
10:35:48.760 -> 04/18/2019 10:35:37
10:35:49.507 -> 04/18/2019 10:35:37
10:35:50.209 -> 00/00/2000 00:00:00
10:35:50.209 -> RTC lost confidence in the DateTime!
10:35:50.868 -> 04/18/2019 10:35:39
10:35:51.572 -> 00/00/2000 00:00:00
10:35:51.619 -> RTC lost confidence in the DateTime!
10:35:52.320 -> 00/00/2000 00:00:00
10:35:52.320 -> RTC lost confidence in the DateTime!
10:35:53.022 -> 04/18/2019 10:35:41
10:35:53.680 -> 00/00/2000 00:00:00
10:35:53.726 -> RTC lost confidence in the DateTime!
10:35:54.384 -> 00/00/2000 00:00:00
10:35:54.431 -> RTC lost confidence in the DateTime!
10:35:55.088 -> 04/18/2019 10:35:43
10:35:55.795 -> 00/00/2000 00:00:00
10:35:55.795 -> RTC lost confidence in the DateTime!
10:35:56.498 -> 00/00/2000 00:00:00
10:35:56.498 -> RTC lost confidence in the DateTime!
10:35:57.202 -> 04/18/2019 10:35:45
10:35:57.905 -> 00/00/2000 00:00:00
10:35:57.905 -> RTC lost confidence in the DateTime!
10:35:58.609 -> 04/18/2019 10:35:47
i am using A1, A2, A3 that is not used to my knowledge
koosiekloek
@koosiekloek
Delay on 0.1 Sec is very interesting. might there be some problem in the library math that dislikes even seconds?
00:00:00
10:40:42.145 -> RTC lost confidence in the DateTime!
10:40:54.829 -> compiled: Apr 18 201910:40:43
10:40:54.876 -> 04/18/2019 10:40:43
10:40:54.876 -> RTC is the same as compile time! (not expected but all is fine)
10:40:54.976 -> 04/18/2019 10:40:43
10:40:55.030 -> 04/18/2019 10:40:43
10:40:55.131 -> 04/18/2019 10:40:43
10:40:55.231 -> 04/18/2019 10:40:43
10:40:55.332 -> 04/18/2019 10:40:43
10:40:55.394 -> 04/18/2019 10:40:43
10:40:55.534 -> 04/18/2019 10:40:43
10:40:55.633 -> 00/00/2000 00:00:00
10:40:55.633 -> RTC lost confidence in the DateTime!
10:40:55.734 -> 00/00/2000 00:00:00
10:40:55.734 -> RTC lost confidence in the DateTime!
10:40:55.834 -> 00/00/2000 00:00:00
10:40:55.834 -> RTC lost confidence in the DateTime!
10:40:55.935 -> 00/00/2000 00:00:00
10:40:55.935 -> RTC lost confidence in the DateTime!
10:40:56.035 -> 00/00/2000 00:00:00
10:40:56.035 -> RTC lost confidence in the DateTime!
10:40:56.136 -> 00/00/2000 00:00:00
10:40:56.136 -> RTC lost confidence in the DateTime!
10:40:56.236 -> 00/00/2000 00:00:00
10:40:56.283 -> RTC lost confidence in the DateTime!
10:40:56.337 -> 00/00/2000 00:00:00
10:40:56.384 -> RTC lost confidence in the DateTime!
10:40:56.437 -> 00/00/2000 00:00:00
10:40:56.437 -> RTC lost confidence in the DateTime!
10:40:56.537 -> 00/00/2000 00:00:00
10:40:56.584 -> RTC lost confidence in the DateTime!
10:40:56.639 -> 04/18/2019 10:40:45
10:40:56.723 -> 04/18/2019 10:40:45
10:40:56.854 -> 04/18/2019 10:40:45
10:40:56.939 -> 04/18/2019 10:40:45
10:40:57.040 -> 04/18/2019 10:40:45
10:40:57.140 -> 04/18/2019 10:40:45
10:40:57.241 -> 04/18/2019 10:40:45
10:40:57.340 -> 04/18/2019 10:40:45
10:40:57.441 -> 04/18/2019 10:40:45
10:40:57.541 -> 04/18/2019 10:40:45
10:40:57.641 -> 00/00/2000 00:00:00
10:40:57.688 -> RTC lost confidence in the DateTime!
10:40:57.788 -> 00/00/2000 00:00:00
10:40:57.788 -> RTC lost confidence in the DateTime!
10:40:57.842 -> 00/00/2000 00:00:00
10:40:57.888 -> RTC lost confidence in the DateTime!
10:40:57.942 -> 00/00/2000 00:00:00
10:40:57.989 -> RTC lost confidence in the DateTime!
10:40:58.089 -> 00/00/2000 00:00:00
10:40:58.089 -> RTC lost confidence in the DateTime!
10:40:58.190 -> 00/00/2000 00:00:00
10:40:58.190 -> RTC lost confidence in the DateTime!
10:40:58.243 -> 00/00/2000 00:00:00
10:40:58.290 -> RTC lost confidence in the DateTime!
10:40:58.375 -> 00/00/2000 00:00:00
10:40:58.375 -> RTC lost confidence in the DateTime!
10:40:58.476 -> 00/00/2000 00:00:00
10:40:58.523 -> RTC lost confidence in the DateTime!
10:40:58.565 -> 04/18/2019 10:40:47
10:40:58.697 -> 04/18/2019 10:40:47
10:40:58.797 -> 04/18/2019 10:40:47
10:40:58.897 -> 04/18/2019 10:40:47
10:40:58.998 -> 04/18/2019 10:40:47
10:40:59.098 -> 04/18/2019 10:40:47
10:40:59.199 -> 04/18/2019 10:40:47
10:40:59.299 -> 04/18/2019 10:40:47
10:40:59.400 -> 04/18/2019 10:40:47
10:40:59.500 -> 04/18/2019 10:40:47
koosiekloek
@koosiekloek
have a look here might help you Lib
msparks/arduino-ds1302@5650f7d
Michael Miller
@Makuna
More than likely there is a communications problem of some sort.
I looked at their code, I have the delays already. I am following the specification of the part. The only weird thing they do is that the transition from write to read, they set the pin to input BEFORE the clock drops.
I am away from my hardware so I can't test this.
Try the ThreeWireCommFix branch and see if this fixes it for you.
koosiekloek
@koosiekloek
Thanks a mill, i am also not with my hardware now but will test in the morning and report back
koosiekloek
@koosiekloek
The changes you made fixed my problem thanks a million for the help and time spent! So much appreciated!
0.3Sec Delay
09:15:47.540 -> compiled: Apr 19 201909:15:35
09:15:47.573 -> 04/19/2019 09:15:35
09:15:47.573 -> RTC is the same as compile time! (not expected but all is fine)
09:15:47.640 -> 04/19/2019 09:15:35
09:15:47.908 -> 04/19/2019 09:15:35
09:15:48.212 -> 04/19/2019 09:15:36
09:15:48.517 -> 04/19/2019 09:15:36
09:15:48.822 -> 04/19/2019 09:15:36
09:15:49.129 -> 04/19/2019 09:15:37
09:15:49.437 -> 04/19/2019 09:15:37
09:15:49.742 -> 04/19/2019 09:15:37
09:15:50.017 -> 04/19/2019 09:15:38
09:15:50.325 -> 04/19/2019 09:15:38
09:15:50.634 -> 04/19/2019 09:15:38
09:15:50.942 -> 04/19/2019 09:15:38
09:15:51.219 -> 04/19/2019 09:15:39
09:15:51.528 -> 04/19/2019 09:15:39
09:15:51.831 -> 04/19/2019 09:15:39
09:15:52.136 -> 04/19/2019 09:15:40
Michael Miller
@Makuna
Great, I will merge that in and put out a new release
koosiekloek
@koosiekloek
:D
Leandro Boari
@leandrorepos
Hi!
Does the DS3231 alarm work when the clock is in backup mode?
Leandro Boari
@leandrorepos
I can't make the RTC send a pulse through the SQW:-(
Michael Miller
@Makuna
Did you set it, call myRtc.SetSquareWavePin(DS3231SquareWavePin_ModeClock) and myRtc.SetSquareWavePinClockFrequency(DS3231SquareWaveClock_1Hz) for once a second.
What do you mean by "backup mode"?
Leandro Boari
@leandrorepos
I'm sorry! "Backup mode": When I do not supply 3.3V on the VCC of the RTC, but it is supplied by the RTC battery. Will send pulses too?
Leandro Boari
@leandrorepos
What I would like to do, is the DS3231 give an pulse to a Flipflop Latch SR to switch the CHPD from the ESP8266 high to low. But the DS3231 is a pulse in low, right?
Michael Miller
@Makuna
To trigger the int/sqw pin when vcc is below backup power, you call myRtc.SetSquareWavePin(DS3231SquareWavePin_ModeBatteryBackup).
And yes, the docs state active low for the int pin.
I have no idea if the alarms still work when vcc is below backup power, but I would suspect so.
Leandro Boari
@leandrorepos
DS3231SquareWavePin_ModeBatteryBackup - the pin will trigger when the external power is lower than the battery power
I believe it is not possible. :-(
I'm making tests...
Michael Miller
@Makuna
The docs don't mention if the alarms work or shouldn't work if on backup battery power.
The docs do state that the int pin should have an external pullup resistor on it, with most Arduinos, just set the pin mode to pullup should work fine.
Leandro Boari
@leandrorepos
OK! I'll try and return news here.
Thank you very much, @Makuna. You are too kind!
Leandro Boari
@leandrorepos
But so far the SQW pulses only work when VCC is powered.
Michael Miller
@Makuna
Even if you set it to DS3231SquareWavePin_ModeBatteryBackup? This would defy its usefulness completely.
Leandro Boari
@leandrorepos
The DS3231 VCC pin pull up SQW. I'll try to understand better the signal.
Michael Miller
@Makuna
Ah, the module you have already has a resistor between VCC and the SQW pin. That's handy.
Leandro Boari
@leandrorepos
@Makuna, DS3231SquareWavePin_ModeBatteryBackup makes the SQW pin send low pulses of 1Hz intermittents.
And when the RTC is not supplied by VCC, it doesn't send alarm with low pulses.
:-(
Leandro Boari
@leandrorepos
I found a possible solution @Makuna! I'll test now...
They said:
To others who see this thread, the JChristensen library did not have a function to set the BBSQW pin so I wrote this one:
/*
Sets/resets the BBSQW pin in the control register
*/
byte DS3232RTC::setBBSQW(bool state)
{
    //Get original contents
    byte t = readRTC(RTC_CONTROL);
    if (state)
        //Set bit 6 i.e. the BBSQW
        t |= (1 << BBSQW);
    else
        t &= ~(1 << BBSQW);

    return (writeRTC(RTC_CONTROL, t));
}
Leandro Boari
@leandrorepos
Was the INTCN, A1IE & A2IE bits also set in the control register (0x0E) to enable the Alarm match to also trigger the interrupt?
Leandro Boari
@leandrorepos
So I modified the file RtcDS3231.h of your library and it worked!!!
case DS3231SquareWavePin_ModeAlarmOne:
            creg |= _BV(DS3231_BBSQW);
            creg |= _BV(DS3231_A1IE);
            break;
Michael Miller
@Makuna
Do you want to make a pull request with the changes and I will review and merge it?
Michael Miller
@Makuna
So the BBSQW is NOT to test for vcc<vb, but to just enable the square wave output for alarms and others when in this state.
Michael Miller
@Makuna
I think I am going to change the method a little with this newly learned information. This is what I will be, what do you think?
void SetSquareWavePin(DS3231SquareWavePinMode pinMode, bool enableWhileInBatteryBackup)
    {
        uint8_t creg = getReg(DS3231_REG_CONTROL);

        // clear all relevant bits to a known "off" state
        creg &= ~(DS3231_AIEMASK | _BV(DS3231_BBSQW));
        creg |= _BV(DS3231_INTCN);  // set INTCN to disables clock SQW

        if (enableWhileInBatteryBackup && pinMode != DS3231SquareWavePin_ModeNone )
        {
            creg |= _BV(DS3231_BBSQW); // set enable int/sqw while in battery backup flag
        }

        switch (pinMode)
        {
        case DS3231SquareWavePin_ModeNone:
            break;

        case DS3231SquareWavePin_ModeClock:
            creg &= ~_BV(DS3231_INTCN); // clear INTCN to enable clock SQW 
            break;

        case DS3231SquareWavePin_ModeAlarmOne:
            creg |= _BV(DS3231_A1IE);
            break;

        case DS3231SquareWavePin_ModeAlarmTwo:
            creg |= _BV(DS3231_A2IE);
            break;

        case DS3231SquareWavePin_ModeAlarmBoth:
            creg |= _BV(DS3231_A1IE) | _BV(DS3231_A2IE);
            break;
        }

        setReg(DS3231_REG_CONTROL, creg);
    }
Leandro Boari
@leandrorepos
Sorry for the delay. Great, that's it! It worked very well.
Bastian Jäger
@bastianhjaeger
@m1ch3l4 Did you solve it? I think I am facibg the same problem and maybe I am just to stupid to find the right Pins to replace 19 and 4 for my ESP12f.
Right niw my DS3231 can not wake up the ESP12f and there is no clear example on solving this.
shyney7
@shyney7
Hi, Im trying to get the epoch time as a float from the DS3231 but I'm not able to. I'm able to get the day,month etc as an integer like in this Code: