Would you like to react to this message? Create an account in a few clicks or log in to continue.

You are not connected. Please login or register

it seems, that RTC DS1307 don't work normal anymore!?

2 posters

Go down  Message [Page 1 of 1]

KarstenLehmann



it seems, that RTC DS1307 don't work normal anymore!?

RTC DS1307: SimulIDE 1.0.0 SR0-Stable - Linux64

the same sim1-file works very well under…
1.0.0 R1314! (2023-03-08)  
and
1.0.0 RC3 (2022-10)
(tested with uno & nano)

in setup:
Code:
  if (! rtc.isrunning()) {
    Serial.println("RTC is NOT running!");
    rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
    Serial.println("RTC adjusted!");
  }
  else {
    Serial.println("RTC is running");
  }

results…
R1314 & RC3: "RTC is running"

SR0-Stable: "RTC is NOT running!"


RTClib is: github.com/adafruit/RTClib


hope that helps…

Code:
#include <Wire.h>
#include "RTClib.h"


//  RTC_Millis rtc;
RTC_DS1307 rtc; // i2c 0x68


void setup() {
 while (!Serial);

  Serial.begin(57600);
  Serial.println();
  Serial.println("timestamp: "__DATE__" "__TIME__);

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

  if (! rtc.isrunning()) {
    Serial.println("RTC is NOT running!");
    rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
    Serial.println("RTC adjusted!");
  }
  else {
    Serial.println("RTC is running");
  }
}

void loop() {

}

arcachofo

arcachofo

it seems, that RTC DS1307 don't work normal anymore!?
Yes this changed recently to solve an error.
Indeed DS1307 is disabled the first time it's powered on.

Right now it works this way:
When you open the circuit it works as it is powered for the first time.
Then it will "remember" it's state until you close the circuit.

This probably needs an option to save state to the circuit file, but it is not implemented yet.

KarstenLehmann likes this post

KarstenLehmann



UUPS…?!?

there is another problem…
DS1307 is not in the component-list anymore – see screenshot parts of R1314 (left) an SR0 (right)

it seems, that RTC DS1307 don't work normal anymore!? Simuli11

arcachofo

arcachofo

there is another problem…
DS1307 is not in the component-list anymore – see screenshot parts of R1314 (left) an SR0 (right)
Ouch... you are right pale

Solved at Rev 1321.

KarstenLehmann likes this post

arcachofo

arcachofo

KerimF and KarstenLehmann like this post

KarstenLehmann



arcachofo wrote:New files uploade at Rev 1322:
https://simulide.forumotion.com/t390-simulide-1-0-0-tester-builds

THANK YOU!

I create a new project under R1322 (Linux64):
arduino-uno and rtc-ds1307

but sorry… the same result as yesterday under sr0.
is it me…?

this new sim1-file works perfect under  R1314!

…hope that helps…
Attachments
it seems, that RTC DS1307 don't work normal anymore!? AttachmentRTC_test_SR0_R1322_01.zip
You don't have permission to download attachments.
(8 Kb) Downloaded 5 times

arcachofo

arcachofo

but sorry… the same result as yesterday under sr0.
is it me…?

this new sim1-file works perfect under  R1314!
Those are the correct results: the first time DS1307 is powered On it is disabled and you have to enable it.

That's the reason for this code:
If DS1307 is not running, then enable it by setting the time/date.
Code:
  if (! rtc.isrunning()) {
    Serial.println("RTC is NOT running!");
    rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
    Serial.println("RTC adjusted!");
  }

It was wrong in R1314:
DS1307 was initialized as enabled, indeed it was always enabled and you could not disable it.

KarstenLehmann likes this post

KarstenLehmann



sorry… probable my error…?!?

I try the file in the examples-folder:
"Ds1307.sim1"
I can't get it to run correctly – program starts, but seconds do not change. :-/

may be, I need more sleep. ;-)

arcachofo

arcachofo

may be, I need more sleep. ;-)
Who knows, maybe is me who needs more sleep and I didn't understand you in the first place.
I will have a look.

KarstenLehmann



is the example "Ds1307.sim1" running correctly on your machine?




KarstenLehmann



please forgive me…

I would like to help…!

I LOVE SimulIDE!

arcachofo

arcachofo

is the example "Ds1307.sim1" running correctly on your machine?
I never tried, I just tried the code you posted.
In that case, the message "RTC is NOT running!" is correct.
After that the Ds1307 should be enabled when the time is adjusted and it shows the message: "RTC adjusted!"
Then it should run normally.

But you are right that the example in Simulide does not work, seems that there is some error and the clock is never enabled.

KarstenLehmann likes this post

arcachofo

arcachofo

It was a silly typo, solved at Rev 1324.

But note that the message "RTC is NOT running!" is correct.
In R1314, the clock would work even if you don't set the time/date the first time, and that was wrong.

KarstenLehmann likes this post

KarstenLehmann



Thank you!

In my opinion the default (check) is correct.
the rtc WITH BATTERY gives the actual date & time.

if the user wants a „clean“ rtc, he unchecked the preference.

it seems, that RTC DS1307 don't work normal anymore!? Ds130710

arcachofo likes this post

KarstenLehmann



I think, I have localized a little problem…

please load the example "Ds1307.sim1"…
If the clock-option is checked ("Set current time at start"), the sketch shows the actual time – BUT the seconds did not changed. The "start-time" comes again and again…?!?

tested on SR0 and R1334 using linux64

…hope that helps…

arcachofo

arcachofo

Some day we will get this to work  properly...  it seems, that RTC DS1307 don't work normal anymore!? 1f606
Solved at Rev 1338.

KerimF and KarstenLehmann like this post

KarstenLehmann



Thank you!

KarstenLehmann



oh oh :-/
I am afraid, there is another problem…

Please try the example "Ds1307.sim1" and uncheck "Set current time at start" in the settings – then start.
The display shows day and month as zero and year as 2048.

…or is it me…?

…hope that helps…

hilmiyafia likes this post

arcachofo

arcachofo

There is something very weird here...

Now I'm getting year 231(with current time), and this happens for all versions, even the older 1.0.0-RC3:

it seems, that RTC DS1307 don't work normal anymore!? Clk10

And I can't reproduce your issue, I get 00/00/00 for date, which is not really correct, it should be: 01/01/00.

KarstenLehmann



Sorry… :-/ I tested so much AND get not enough sleep (and could not find the right file for now).

So now I make a NEW reproducible(!) example for you:
it based on the unmodified adafruit-example. I tested this under (the for me available) R1334 and I generate it for UNO, NANO and MEGA and the DS1307 with UNCHECKED option "Set current time at start".

…hope that helps…

Excuse me!

it seems, that RTC DS1307 don't work normal anymore!? Ds130713
Attachments
it seems, that RTC DS1307 don't work normal anymore!? AttachmentDS1307_year_2048_NANO_2023_04_05.zip
You don't have permission to download attachments.
(10 Kb) Downloaded 3 times
it seems, that RTC DS1307 don't work normal anymore!? AttachmentDS1307_year_2048_MEGA_2023_04_05.zip
You don't have permission to download attachments.
(11 Kb) Downloaded 4 times
it seems, that RTC DS1307 don't work normal anymore!? AttachmentDS1307_year_2048_UNO_2023_04_05.zip
You don't have permission to download attachments.
(11 Kb) Downloaded 8 times

arcachofo

arcachofo

Thanks, now I get the same results.
And I get the correct 2023 when "current time" is checked.

There is something wrong that I can't find yet, I'm investigating it.

KarstenLehmann likes this post

Sponsored content



Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum