GrumpyOldPizza / arduino-STM32L4

69 stars 60 forks source link

Problem with external RTC on STM32L476RG board #29

Open mayukhIITD opened 6 years ago

mayukhIITD commented 6 years ago

Dear Thomas/Kris,

@GrumpyOldPizza @kriswiner As you know STM32L476RG board has RTC but it is not connected to a Battery. Hence I would like to use an external RTC like ds1307. But when I use DS1307 (I2C address= 0x68) , the usual Arduino libraries like RTCLib are giving output as:

2165/165/165 (Tuesday) 165:165:85 since midnight 1/1/1970 = 2275406289s = 26335d now + 7d + 30s: 2042/2/15 5:48:15

The same code is running properly when I connect the DS1307 to Arduino board. Any solution for this will be of much help...

Thanks, Mayukh

GrumpyOldPizza commented 6 years ago

RTC on STM32L476RG is connected to a supercap, which keeps RTC running for about 8 hours. That may or may not be good enough.

With RTCLib, have you checked whether the DS1307 was detected properly and initialized properly ? With 2275406289s since 1/1/1970, the years 2042 seems to be correct.

On Wed, Jan 3, 2018 at 8:05 AM, mayukhIITD notifications@github.com wrote:

Dear Thomas/Kris,

@GrumpyOldPizza https://github.com/grumpyoldpizza @kriswiner https://github.com/kriswiner As you know STM32L476RG board has RTC but it is not connected to a Battery. Hence I would like to use an external RTC like ds1307. But when I use DS1307 (I2C address= 0x68) , the usual Arduino libraries like RTCLib are giving output as:

2165/165/165 (Tuesday) 165:165:85 since midnight 1/1/1970 = 2275406289s = 26335d now + 7d + 30s: 2042/2/15 5:48:15

The same code is running properly when I connect the DS1307 to Arduino board. Any solution for this will be of much help...

Thanks, Mayukh

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/GrumpyOldPizza/arduino-STM32L4/issues/29, or mute the thread https://github.com/notifications/unsubscribe-auth/AG4QfFJtZWwnFsuGBoTOcq7nsmoituwRks5tG5c9gaJpZM4RR1y- .

mayukhIITD commented 6 years ago

Thanks for your reply Thomas. If the supercap gives 8 hours backup then why is my RTC time resetting everytime the power goes off even for 1 second?

I have checked using I2CScanner that the I2C Adresss of DS1307 i.e. 0x68 is NOT detected..

What is the possible issue then?

Thanks, Mayukh

GrumpyOldPizza commented 6 years ago

Thanks for your reply Thomas. If the supercap gives 8 hours backup then why is my RTC time resetting everytime the power goes off even for 1 second?

Do you have the variant with L476 or L496 ?

I have checked using I2CScanner that the I2C Adresss of DS1307 i.e. 0x68 is NOT detected..

Connected to the wrong pins ... no pullups ... wired the wrong way in general ... wrong I2C speed ...

On Wed, Jan 3, 2018 at 11:13 AM, mayukhIITD notifications@github.com wrote:

Thanks for your reply Thomas. If the supercap gives 8 hours backup then why is my RTC time resetting everytime the power goes off even for 1 second?

I have checked using I2CScanner that the I2C Adresss of DS1307 i.e. 0x68 is NOT detected..

What is the possible issue then?

Thanks, Mayukh

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/GrumpyOldPizza/arduino-STM32L4/issues/29#issuecomment-355084409, or mute the thread https://github.com/notifications/unsubscribe-auth/AG4QfAzLwrp2kfqG1mupCpEDcjkWnr2tks5tG8MzgaJpZM4RR1y- .

mayukhIITD commented 6 years ago

I have L476RG.. Does it have supercap?

Thanks, Mayukh

GrumpyOldPizza commented 6 years ago

Yes it does.

On Wed, Jan 3, 2018 at 12:23 PM, mayukhIITD notifications@github.com wrote:

I have L476RG.. Does it have supercap?

Thanks, Mayukh

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/GrumpyOldPizza/arduino-STM32L4/issues/29#issuecomment-355102318, or mute the thread https://github.com/notifications/unsubscribe-auth/AG4QfLiWHLf_2NPn-LCE40I5FFGJAVGhks5tG9O4gaJpZM4RR1y- .

kriswiner commented 6 years ago

There is L476RE or L496RG, the latter has no supercap but a PTH for RTC_BAT at the top of the board.

On Wed, Jan 3, 2018 at 11:23 AM, mayukhIITD notifications@github.com wrote:

I have L476RG.. Does it have supercap?

Thanks, Mayukh

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/GrumpyOldPizza/arduino-STM32L4/issues/29#issuecomment-355102318, or mute the thread https://github.com/notifications/unsubscribe-auth/AGY1qhT0sn_7-xx3bI-WdSjaYfJgdzgMks5tG9O4gaJpZM4RR1y- .