Author Topic: Resetting DS3231 from software  (Read 1425 times)

0 Members and 1 Guest are viewing this topic.

Offline newtekuserTopic starter

  • Frequent Contributor
  • **
  • Posts: 453
  • Country: us
Resetting DS3231 from software
« on: October 16, 2023, 05:10:41 am »
How does one reset a DS3231 rtc from software? I'd like to reset it so that the date and time resets back to factory.
I already tried clearing the bits in the control register, but that didn't do anything:

Code: [Select]
I2C_Start();         
    I2C_Write(0xD0);     
    I2C_Write(0x0E);     
    I2C_Write(0x00);     
    I2C_Stop();         
 

Offline Shonky

  • Frequent Contributor
  • **
  • Posts: 298
  • Country: au
Re: Resetting DS3231 from software
« Reply #1 on: October 16, 2023, 08:06:13 am »
Why do you think clearing the control bits resets anything?

Just write the time back to whatever value you want it to be.
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 13410
Re: Resetting DS3231 from software
« Reply #2 on: October 16, 2023, 08:56:10 am »
You cant fully reset it without cycling power to it (both Vcc and Vbat).  e.g. its oscillator is initially shut off on powerup until the first I2C access to reduce the battery drain for extended in-store shelf life.
 
The following users thanked this post: newtekuser


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf