Background. About 6 years ago I bought a DS3231 RTC module and wrote some code to read and write the registers. This worked. A few days ago I got the module out again as I am planning to us it in an event monitor. I looked at the code I had written to see how it worked. I ran the program an was quite surprised that the time it displyed was only about 12 seconds out. The program originaly set the time and date in december 2017. The program now jumped past the code to set the time and date so the DS3231 had kept time very well for over 6 years. As I plan to use the the 1 hz square wave output to interupt the event monitoring code every second to keep the microcontroller updated with the time and date I looked at the datasheet to see how to enable this output. It looked like all I needed to do was to change bit 2 of the control register (0x0E) from 1 to 0. The default value was shown eith just bits 2,3,4 set to 1. (0x1C). The datasheet said that bits 3 &4 had no function so I wrote 0x18 to the control register.
This gave a square wave output but it was 8.192 Khz. I read though the data sheet again to see how to change this with no success. While trying to solve the problem online I was looking at a datasheet online and did a search for 8.192. This resulted in finding that THIS datasheet said that bits 3 & 4 of the control register controlled the square wave output frequency. The needed to be set to zero for 1 hz. I changed the code to set them to zero and now have the 1 hz output. The original datasheet was from Maxim. The one I looked at online was marked Dallas Maxim.
I hope this will help others.
Les.
This gave a square wave output but it was 8.192 Khz. I read though the data sheet again to see how to change this with no success. While trying to solve the problem online I was looking at a datasheet online and did a search for 8.192. This resulted in finding that THIS datasheet said that bits 3 & 4 of the control register controlled the square wave output frequency. The needed to be set to zero for 1 hz. I changed the code to set them to zero and now have the 1 hz output. The original datasheet was from Maxim. The one I looked at online was marked Dallas Maxim.
I hope this will help others.
Les.