![]() |
Forum Index : Microcontroller and PC projects : How to lockup the DS3231 RTC on the MM+
Author | Message | ||||
MMAndy Regular Member ![]() Joined: 16/07/2015 Location: United StatesPosts: 91 |
How to lockup the DS3231 RTC on the MM+ Beta 4.7B30 Try this code snippet ... Do RTC Gettime ? Time ? Date Pause 1 '<----<<< Loop Obviously, you need to change the pause from 1 ms to 10 ms for reliable operation. This allows enough time for reading the I2C time/date bytes. In some cases, it jams the RTC/MM+ so bad that you need to cycle power on and off to clear it from this halting error? BTW ... There should be no reason why you should poll less than 1 second (1000ms) since the RTC only updates once a second but by a programming error it will cause your program to halt. ![]() |
||||
Grogster![]() Admin Group ![]() Joined: 31/12/2012 Location: New ZealandPosts: 9610 |
An interesting find. ![]() You are quite correct though, in that in normal code, you would never repeatedly poll the RTC like this in a loop. Therefore, assuming a programmer did do this, and cause this to happen, then it is clearly a case of 'Human error' over a firmware bug per-se' in my humble opinion. ![]() ![]() ![]() Smoke makes things work. When the smoke gets out, it stops! |
||||
MMAndy Regular Member ![]() Joined: 16/07/2015 Location: United StatesPosts: 91 |
FYIO ... for the speed freaks Further testing reveals that a RTC poll rate of 2 ms. could be acceptable. Using 10 ms. was way too much. @ 100Khz / 8 bits per byte = 12,500 bytes per second. For 1 ms. 12.5 bytes. Since the time/date uses ~ 12 bytes + I2C overhead then 2 ms. delay between polls might/could be acceptable. Anything less than 2 ms. (0 or 1 ms.) will lock it up. ![]() |
||||
atmega8![]() Guru ![]() Joined: 19/11/2013 Location: GermanyPosts: 724 |
I don't see any Situation/need of reading the RTC in intervalls of ms. This thread is for > /dev/null 😄 |
||||
MMAndy Regular Member ![]() Joined: 16/07/2015 Location: United StatesPosts: 91 |
We found this problem by accident. In our MicroMite controller, we had to make sure that at any given RTC time/date setpoint our control digital output would be always executed and not skipped due to delays in other subs/functions. A very fast RTC poll rate in ms. was required. Putting a 2 ms. pause after the RTC Gettime command provided for 100% reliability with no RTC halting. ![]() |
||||
Geoffg![]() Guru ![]() Joined: 06/06/2011 Location: AustraliaPosts: 3292 |
Over the medium term the internal Micromite clock would keep perfect time and not be upset by sub/fun or any other BASIC commands. You only need to poll the RTC every few hours For me this is a very law priority issue and the fault will probably turn out to be caused by the RTC, Geoff Geoff Graham - http://geoffg.net |
||||
Grogster![]() Admin Group ![]() Joined: 31/12/2012 Location: New ZealandPosts: 9610 |
On the MM+, I set the internal RTC with no external RTC module at all, and left it running and after three days(36 hrs), the internal RTC was off by about one second, with reference to an online clock, which I used to set the RTC in the MM+. This is really excellent, but I suppose that is to be expected with a crystal oscillator reference for the MM+ though. So, in a nutshell, in one of my boards using the MM+, I have allowed for an external RTC module, but don't plan to actually use it, as the system clock is so accurate on the MM+. Not the case with the RC-based RTC in the standard MM, which do drift a bit more. Smoke makes things work. When the smoke gets out, it stops! |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6283 |
I didn't realise that you had such short (12hr) days in NZ. Jim VK7JH MMedit |
||||
Grogster![]() Admin Group ![]() Joined: 31/12/2012 Location: New ZealandPosts: 9610 |
Whoops!!!!! ![]() ![]() ![]() ![]() ![]() Typo - sorry. ![]() Make that 72 hrs......... Smoke makes things work. When the smoke gets out, it stops! |
||||
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |