I have added the RTC to my project and it has worked perfectly for over a week until recently I noticed that it reset to 0 so I set it in the code to the current timestamp which worked but then I noticed that it is not incrementing when the board is off (when I turn off the board at a certain value of the timestamp then I turn it on it resumes with that last value stored).
I thought it was a battery problem so I changed the battery cell but the problem is still there.
Anyone know what might be the cause of this ?
No I set the time and date manually to the current timestamp once then I uploaded a totally different code so it is not resetting to that timestamp everytime. I'm only using the get() function in a loop while and printing the timestamp.
// Read the current timestamp from the RTC
utcTime = Breakout.RTClock.getTime();
// Print the data
Serialx.println(utcTime.getUnixTimestamp());
Serialx.print("year: ");
Serialx.println(utcTime.year() + 1900);
Serialx.print("month: ");
Serialx.println(utcTime.month() + 1);
Serialx.print("day: ");
Serialx.println(utcTime.day());
Serialx.print("hours: ");
Serialx.println(utcTime.hour());
Serialx.print("minutes: ");
Serialx.println(utcTime.minute());
Serialx.print("seconds: ");
Serialx.println(utcTime.second());
osDelay(1000);
Yes I am using the Portenta Breakout and I have no idea how it is working or wired. I found the example I used it and it worked perfectly until recently.
Yes it is at 3.3V and it is connected the right way. It is a new battery cell that I just bought, I think there is another problem and I can't seem to figure it out for now
No it works and it sets the time correctly however when I power off the board it stops incrementing so when I turn it back on I get the last value stored of the timestamp
if the CR2032 is fresh and inserted in the right way and you only use the provided examples then indeed the issue is somewhere else - may be hardware. I suppose you don't have another breakout / portenta to compare with ?
No it is the only board I have. I was thinking maybe there is a bit in the RTC registers that can disables it or something and maybe it got changed somehow
It is a simple write command but it depends how do you "play" with I2C protocol.
I wrote my own library, but it will be something like:
i2c_write_start(I2C_Adresse); // adress of your module
i2c_write_byte(register adress); // adress of the targeted register (0xOF, or just 0F)
i2c_write_byte(data); // the data to write so 0b00001000
I2C_stop;
thoses lines of code won't work in this state, please take time to see write examples for I2C protocol in an actual library!
hi!
Yet in trouble with your module?
I came back to my weather station project with a nano 33 IOT and a DS32223. For my needs, I use only <wire.h> library and wrote my personnal functions to communicate with the RTC so I have ready sketchs we can use to diag your config.
Yes I am still having the same problem. RTC works fine when the board is ON, I can set it to a different timestamp and I can read its current timestamp that increments every second. However, when I turn the board OFF and wait for let's say 30 seconds then I turn it back ON I find the last value I saw before going OFF and not that value + 30 seconds