DS3231 - RTC Time Keeper
Moderator: Benj
-
- Posts: 528
- Joined: Sat Dec 01, 2012 1:23 pm
- Location: Sweden
- Has thanked: 49 times
- Been thanked: 101 times
- Contact:
Re: DS3231 - RTC Time Keeper
With 1.6 the dashboard "icon" showed the original I2C icon with the DS3231 name, but had the LCD icon "stuck" under the I2C icon
I'm going to use the alarm function to wake the PIC up from sleep mode at precise intervals, when the alarm function is working that is
John, if you want I can make the PCB available for ordering from OSH Park and post the very simple schematic and short BOM.
I'm going to use the alarm function to wake the PIC up from sleep mode at precise intervals, when the alarm function is working that is
John, if you want I can make the PCB available for ordering from OSH Park and post the very simple schematic and short BOM.
- Crenwick
- Posts: 127
- Joined: Sun Aug 07, 2011 1:40 pm
- Location: Belgium
- Has thanked: 7 times
- Been thanked: 21 times
- Contact:
Re: DS3231 - RTC Time Keeper
Hi Jordy,
I'm using your component in my project and I'm facing a problem, when I power off the board the clock stay at the same time. It's like bit EOSC is set.
I supposed you cleared this bit with initializing macro ? Right ?
Regards,
I'm using your component in my project and I'm facing a problem, when I power off the board the clock stay at the same time. It's like bit EOSC is set.
I supposed you cleared this bit with initializing macro ? Right ?
Regards,
Bernard
Flowcode 6 / EB006-V9
Flowcode 6 / EB006-V9
- Jordy101091
- Posts: 519
- Joined: Sat Jan 08, 2011 4:02 pm
- Location: The Netherlands
- Has thanked: 25 times
- Been thanked: 188 times
- Contact:
Re: DS3231 - RTC Time Keeper
I will look into this, I apologise to all of you for not being so active lately.
I was looking for a new and first car for my self and that took a lot of my free time.
I hope you all can understand this
But I promise that I will become more active in the future.
Regards Jordy
I was looking for a new and first car for my self and that took a lot of my free time.
I hope you all can understand this
But I promise that I will become more active in the future.
Regards Jordy
the will to learn, should not be stopped by any price
- Crenwick
- Posts: 127
- Joined: Sun Aug 07, 2011 1:40 pm
- Location: Belgium
- Has thanked: 7 times
- Been thanked: 21 times
- Contact:
Re: DS3231 - RTC Time Keeper
Hi Jordy,
I find the problem
Each time you configure the SQW rate you set also bit 7 (adding 0x80) who is disabling oscillator when on Vbat.
Actual Macro,
case 2:
{
//Comment:
//Enable Square Wave Output
//Frequency = 1Hz
FCD_005f1_I2C_Master1__TransmitByte(0x80);
break;
}
case 3:
{
//Comment:
//Enable Square Wave Output
//Frequency = 1.024kHz
FCD_005f1_I2C_Master1__TransmitByte(0x88);
break;
}
case 4:
{
//Comment:
//Enable Square Wave Output
//Frequency = 4.096kHz
FCD_005f1_I2C_Master1__TransmitByte(0x90);
break;
}
case 5:
{
//Comment:
//Enable Square Wave Output
//Frequency = 8.192kHz
FCD_005f1_I2C_Master1__TransmitByte(0x98);
break;
}
// default:
Can you mod the component ?
Regards,
I find the problem
Each time you configure the SQW rate you set also bit 7 (adding 0x80) who is disabling oscillator when on Vbat.
Actual Macro,
case 2:
{
//Comment:
//Enable Square Wave Output
//Frequency = 1Hz
FCD_005f1_I2C_Master1__TransmitByte(0x80);
break;
}
case 3:
{
//Comment:
//Enable Square Wave Output
//Frequency = 1.024kHz
FCD_005f1_I2C_Master1__TransmitByte(0x88);
break;
}
case 4:
{
//Comment:
//Enable Square Wave Output
//Frequency = 4.096kHz
FCD_005f1_I2C_Master1__TransmitByte(0x90);
break;
}
case 5:
{
//Comment:
//Enable Square Wave Output
//Frequency = 8.192kHz
FCD_005f1_I2C_Master1__TransmitByte(0x98);
break;
}
// default:
Can you mod the component ?
Regards,
Bernard
Flowcode 6 / EB006-V9
Flowcode 6 / EB006-V9
-
- Posts: 528
- Joined: Sat Dec 01, 2012 1:23 pm
- Location: Sweden
- Has thanked: 49 times
- Been thanked: 101 times
- Contact:
Re: DS3231 - RTC Time Keeper
Crenwick, could you please try the alarm functions as well? I cannot seem to get them working. I have tried both alarms, and many different settings but still nothing.
- Crenwick
- Posts: 127
- Joined: Sun Aug 07, 2011 1:40 pm
- Location: Belgium
- Has thanked: 7 times
- Been thanked: 21 times
- Contact:
Re: DS3231 - RTC Time Keeper
Ok, I will test ithyperion007 wrote:Crenwick, could you please try the alarm functions as well? I cannot seem to get them working. I have tried both alarms, and many different settings but still nothing.
Bernard
Flowcode 6 / EB006-V9
Flowcode 6 / EB006-V9
- Crenwick
- Posts: 127
- Joined: Sun Aug 07, 2011 1:40 pm
- Location: Belgium
- Has thanked: 7 times
- Been thanked: 21 times
- Contact:
Re: DS3231 - RTC Time Keeper
Sorry for late reply, I tested and have no trigger from INT/SQW.
Just received my buspirate this week and will test the I2C analysys tool
Just received my buspirate this week and will test the I2C analysys tool
Bernard
Flowcode 6 / EB006-V9
Flowcode 6 / EB006-V9
-
- Posts: 528
- Joined: Sat Dec 01, 2012 1:23 pm
- Location: Sweden
- Has thanked: 49 times
- Been thanked: 101 times
- Contact:
-
- Posts: 528
- Joined: Sat Dec 01, 2012 1:23 pm
- Location: Sweden
- Has thanked: 49 times
- Been thanked: 101 times
- Contact:
Re: DS3231 - RTC Time Keeper
Hi Jordy,
Any updates to the component? Kinda need the alarm functions etc
Any updates to the component? Kinda need the alarm functions etc
-
- Posts: 528
- Joined: Sat Dec 01, 2012 1:23 pm
- Location: Sweden
- Has thanked: 49 times
- Been thanked: 101 times
- Contact:
Re: DS3231 - RTC Time Keeper
I have fixed the EOSC problem but cannot for the life of me figure out why the alarm rates aren't working.
-
- Posts: 528
- Joined: Sat Dec 01, 2012 1:23 pm
- Location: Sweden
- Has thanked: 49 times
- Been thanked: 101 times
- Contact:
Re: DS3231 - RTC Time Keeper
If anyone want's to try it as is I have uploaded my revised version of the component.
Things to note are that I think only Alarm 2 once per minute rate works. Alarm 1 will probably not work at all.
But I do believe I have fixed the problem with the OSC shutting down when in Vbat state.
I just really needed to get the INT every minute to work and couldn't wait any longer.
Things to note are that I think only Alarm 2 once per minute rate works. Alarm 1 will probably not work at all.
But I do believe I have fixed the problem with the OSC shutting down when in Vbat state.
I just really needed to get the INT every minute to work and couldn't wait any longer.
-
- Posts: 528
- Joined: Sat Dec 01, 2012 1:23 pm
- Location: Sweden
- Has thanked: 49 times
- Been thanked: 101 times
- Contact:
Re: DS3231 - RTC Time Keeper
If anyone that has a DS3231 could connect it up and also connect a display, then run a simple program (first you need to write time and date if that hasn't been done yet) that in the main loop reads the time and return it as a string, then display it on the display.
Keep this running for several days and just check it from time to time to see that it is not drifting in any way, time wise.
Mine has been running for a couple of days now and was doing just fine when I went to bed last night at 00:30 (so this morning really) but when I checked it at 07:31 this morning, it was showing something like 06:45
We did have some severe thunder and lightning last night but it shouldn't affect this... It would be nice to see if anyone else are having some "long term" issues.
I did in fact have it return a time saying such things as 29 hours and also 25 hours. This was a month ago I think, after having the DS3231 unplugged for a month maybe. It might have had something to do with the component setting the EOSC bit incorrectly before, I don't know. But it's good to have more people testing it.
Keep this running for several days and just check it from time to time to see that it is not drifting in any way, time wise.
Mine has been running for a couple of days now and was doing just fine when I went to bed last night at 00:30 (so this morning really) but when I checked it at 07:31 this morning, it was showing something like 06:45
We did have some severe thunder and lightning last night but it shouldn't affect this... It would be nice to see if anyone else are having some "long term" issues.
I did in fact have it return a time saying such things as 29 hours and also 25 hours. This was a month ago I think, after having the DS3231 unplugged for a month maybe. It might have had something to do with the component setting the EOSC bit incorrectly before, I don't know. But it's good to have more people testing it.
-
- Posts: 528
- Joined: Sat Dec 01, 2012 1:23 pm
- Location: Sweden
- Has thanked: 49 times
- Been thanked: 101 times
- Contact:
Re: DS3231 - RTC Time Keeper
I have now made some more tests with a second chip from this batch and it is also acting up, so if you see this Jordy, please check your's if you can but if not, just replace the chip with a DS3231SN directly Maxim Integrated or Mouser/Digikey etc.
"Good deals" from Ebay proving not to be that great :
"Good deals" from Ebay proving not to be that great :
-
- Posts: 528
- Joined: Sat Dec 01, 2012 1:23 pm
- Location: Sweden
- Has thanked: 49 times
- Been thanked: 101 times
- Contact:
Re: DS3231 - RTC Time Keeper
I got the new IC's from Maxim Integrated on Monday and so far it is working just fine, not like the other IC's.
So I'll leave it running for a couple of days more but I think it's proof enough that the ebay IC's I got was faulty.
So I'll leave it running for a couple of days more but I think it's proof enough that the ebay IC's I got was faulty.
- Jordy101091
- Posts: 519
- Joined: Sat Jan 08, 2011 4:02 pm
- Location: The Netherlands
- Has thanked: 25 times
- Been thanked: 188 times
- Contact:
Re: DS3231 - RTC Time Keeper
Hi all,
First I want to apologize to you all, for not being a very active member lately.
But im trying to changes this, and want to start with fixing the problems you all have with this component.
The main issue as from what I understand, is that the alarm functions did not operated properly.
I have made some little changes in the code as well as the component properties window. Now you are able to disable timer 1 and 2, which seem to cause some
issues with initialization routine, If both alarms are disabled the program automatically disables the Alarm Interrupt Enable settings, so that there is a minimal change of conflict situations.
Also I have changed the clear alarm routine, so that takes fewer lines of code and therefore makes it more clearer, and a bit faster as well.
To use the alarms correctly you need to first set the function of the alarm (Alarm "nr"" Rate) in the properties window. If this is done you need to set the alarm information with the macro "SetAlarm1/2".
You need to periodically check the status flag of alarm to know if it has triggered, or you could use an interrupt for that as well. Ones an alarm event is happend you need to clear the alarm with the "ClearAlarms" Macro before another alarm event can happen.
I hope This clarifies a bit.
You can download version 1.66 from the mean post.
Regards Jordy
First I want to apologize to you all, for not being a very active member lately.
But im trying to changes this, and want to start with fixing the problems you all have with this component.
The main issue as from what I understand, is that the alarm functions did not operated properly.
I have made some little changes in the code as well as the component properties window. Now you are able to disable timer 1 and 2, which seem to cause some
issues with initialization routine, If both alarms are disabled the program automatically disables the Alarm Interrupt Enable settings, so that there is a minimal change of conflict situations.
Also I have changed the clear alarm routine, so that takes fewer lines of code and therefore makes it more clearer, and a bit faster as well.
To use the alarms correctly you need to first set the function of the alarm (Alarm "nr"" Rate) in the properties window. If this is done you need to set the alarm information with the macro "SetAlarm1/2".
You need to periodically check the status flag of alarm to know if it has triggered, or you could use an interrupt for that as well. Ones an alarm event is happend you need to clear the alarm with the "ClearAlarms" Macro before another alarm event can happen.
I hope This clarifies a bit.
You can download version 1.66 from the mean post.
Regards Jordy
the will to learn, should not be stopped by any price
-
- Posts: 528
- Joined: Sat Dec 01, 2012 1:23 pm
- Location: Sweden
- Has thanked: 49 times
- Been thanked: 101 times
- Contact:
Re: DS3231 - RTC Time Keeper
Thanks Jordy.
I can report that the problems I had with the RTC being reprogrammed seems to have been caused by me putting a delay in the INT routine for the alarm and also putting the clear alarm macro in the same INT routine. I do not know how this could cause the RTC time registers to get corrupted but they did.
I can report that the problems I had with the RTC being reprogrammed seems to have been caused by me putting a delay in the INT routine for the alarm and also putting the clear alarm macro in the same INT routine. I do not know how this could cause the RTC time registers to get corrupted but they did.
- Jordy101091
- Posts: 519
- Joined: Sat Jan 08, 2011 4:02 pm
- Location: The Netherlands
- Has thanked: 25 times
- Been thanked: 188 times
- Contact:
Re: DS3231 - RTC Time Keeper
Oke,
Another thing I have noticed here on this topic is that the RTC won't tick when VDD is removed from the chip.
mmm... where did I see that message.
O wait here it is:
Maybe Crenwick had bad battery perhaps.
Regards Jordy
Another thing I have noticed here on this topic is that the RTC won't tick when VDD is removed from the chip.
mmm... where did I see that message.
O wait here it is:
Im a bit confused because when I power down the RTC by removing the VDD wire and re-connect that same wire 30 seconds later, the time on the RTC is correctly incremented 30 seconds.Hi Jordy,
I'm using your component in my project and I'm facing a problem, when I power off the board the clock stay at the same time. It's like bit EOSC is set.
I supposed you cleared this bit with initializing macro ? Right ?
Regards,
Maybe Crenwick had bad battery perhaps.
Regards Jordy
the will to learn, should not be stopped by any price
-
- Posts: 528
- Joined: Sat Dec 01, 2012 1:23 pm
- Location: Sweden
- Has thanked: 49 times
- Been thanked: 101 times
- Contact:
Re: DS3231 - RTC Time Keeper
There was a problem with the EOSC bit being cleared when clearing the alarms/checking the status. I think I corrected it in my not so pretty version
There wouldn't be any problem if you didn't clear any alarms and such, then it would still run on Vbat.
There wouldn't be any problem if you didn't clear any alarms and such, then it would still run on Vbat.
- Jordy101091
- Posts: 519
- Joined: Sat Jan 08, 2011 4:02 pm
- Location: The Netherlands
- Has thanked: 25 times
- Been thanked: 188 times
- Contact:
Re: DS3231 - RTC Time Keeper
Well that problem is now resolved,
Because I now use the XOR function the clear the alarm flags so the EOSC bit stays unchanged.
So this problem belongs to the past.
Regards Jordy
Because I now use the XOR function the clear the alarm flags so the EOSC bit stays unchanged.
So this problem belongs to the past.
Regards Jordy
the will to learn, should not be stopped by any price
- Jordy101091
- Posts: 519
- Joined: Sat Jan 08, 2011 4:02 pm
- Location: The Netherlands
- Has thanked: 25 times
- Been thanked: 188 times
- Contact:
Re: DS3231 - RTC Time Keeper
Just for kicks,
I have added a option to choose between 24 Hr and 12 Hr (AM/PM) notation.
I thought this would be helpful since its also available in the DS1307 Component.
So Component is updated to version 1.67, download can be done from the main post.
Regards Jordy
I have added a option to choose between 24 Hr and 12 Hr (AM/PM) notation.
I thought this would be helpful since its also available in the DS1307 Component.
So Component is updated to version 1.67, download can be done from the main post.
Regards Jordy
the will to learn, should not be stopped by any price
-
- Posts: 528
- Joined: Sat Dec 01, 2012 1:23 pm
- Location: Sweden
- Has thanked: 49 times
- Been thanked: 101 times
- Contact:
Re: DS3231 - RTC Time Keeper
Good, now while you're at it, could you make a macro for changing the alarm rate? It can be set to once per second, once per minute, once per hour, once per day etc. using the mask bits. It would be very good to be able to change rate from within the program.
Thanks.
Thanks.
- Jordy101091
- Posts: 519
- Joined: Sat Jan 08, 2011 4:02 pm
- Location: The Netherlands
- Has thanked: 25 times
- Been thanked: 188 times
- Contact:
Re: DS3231 - RTC Time Keeper
Consider it handled,hyperion007 wrote:Good, now while you're at it, could you make a macro for changing the alarm rate? It can be set to once per second, once per minute, once per hour, once per day etc. using the mask bits. It would be very good to be able to change rate from within the program.
Thanks.
But would you prefer to have a separate macro for changing the alarm rate or does it need to added with the SerAlarm macro. Also do I need to remove that option from the properties window or leave that as it is.
Regards jordy
the will to learn, should not be stopped by any price
-
- Posts: 528
- Joined: Sat Dec 01, 2012 1:23 pm
- Location: Sweden
- Has thanked: 49 times
- Been thanked: 101 times
- Contact:
Re: DS3231 - RTC Time Keeper
I think it would be less confusing if it was a separate macro from the set alarm macro.
Because when an alarm has been set once, changing the masking bits would change the rate without the need to change the alarm time (setAlarm)
I think you can leave it in the properties window, it's fine. But maybe add the different rates here as well because now it's only every second and every minute then other specific alarms like when minutes match etc. Missing are the once per hour, once per day etc.
Thanks.
Because when an alarm has been set once, changing the masking bits would change the rate without the need to change the alarm time (setAlarm)
I think you can leave it in the properties window, it's fine. But maybe add the different rates here as well because now it's only every second and every minute then other specific alarms like when minutes match etc. Missing are the once per hour, once per day etc.
Thanks.
- Jordy101091
- Posts: 519
- Joined: Sat Jan 08, 2011 4:02 pm
- Location: The Netherlands
- Has thanked: 25 times
- Been thanked: 188 times
- Contact:
Re: DS3231 - RTC Time Keeper
I have updated the component to version 1.68.
In this version it is now possible to change the alarm match condition on the fly.
The uC doesn't need reprogramming to change alarm match conditions.
Download can be done from the start post.
Regards Jordy
In this version it is now possible to change the alarm match condition on the fly.
The uC doesn't need reprogramming to change alarm match conditions.
Download can be done from the start post.
Regards Jordy
the will to learn, should not be stopped by any price