I am using a M41T62 RTC (with appropriate voltage applied to SDA and SCL pins) with Arduino. Wiring: VCC: 3V3, GND: GND, SDA: A4, SCL: A5. Library: GitHub - mozzwald/RTC_M41T62: Modified Jeelabs/Adafruit RTC Arduino Lib for ST M41T62
The problem is the example code (RTC_M41T62/m41t62.ino at master · mozzwald/RTC_M41T62 · GitHub) sets the time, however, the time doesn't get updated and remains stuck at set time.
Any help on the issue?
When I have trouble with an I2C device the first thing that I do is run an I2C scanner to confirm communication with the bus and the I2C address.
The I2c is fine. It sends time and Arduino can find the device with the scanner program.
One weird thing I noticed. The RTC updates time only if I hold the oscillator input pins, I tried
- grounding them
- applying 3.3V to them
- connecting them to square wave output of the RTC
Only when i hold them does the RTC update the time (starts counting time). I understand that holding them provides the pins some sort of pseudo oscillator wave as the RTC only requires nanowatts to work.
This isn't supposed to happen as the RTC has a built-in oscillator as per the datasheet. https://www.st.com/resource/en/datasheet/m41t62.pdf
I also checked on a STM32L476RG Nucleo board running Mbed and the same issue persists there. The RTC gets detected, time is set but the RTC never updates the time unless I touch the oscillator input wires to apply some noise.
swapnilsayansaha:
One weird thing I noticed. The RTC updates time only if I hold the oscillator input pins, I tried
- grounding them
- applying 3.3V to them
- connecting them to square wave output of the RTC
Only when i hold them does the RTC update the time (starts counting time). I understand that holding them provides the pins some sort of pseudo oscillator wave as the RTC only requires nanowatts to work.
Your try looks horrible to me. Applying Vcc, GND or any other signal like that is a good way to damage or distroy stuff. Whar made You do that?
I connected the oscillator inputs to a 32.768 KHz crystal oscillator and it works fine now. I need to check the datasheet to see how to activate the internal oscillator.