ninja2
Well-known member
In this 2017 post Paul details the auto-setting of teensy time at upload, including this:
As I understand an equivalent mechanism has been implemented on T4.x as well, and it works fine on my T4.1
Questions:
(1) Presumably there is some equivalent to the 32 byte memory on the T4.1 for those special 4 bytes of unique code. Where are they located, and how to access them ?
(2) is there a way to override, or prevent the auto time setting process at upload?
My second question is because I am using a DS3231 RTC as the sync provider (for more stable/precise time over the longer term). I don't want to risk the PC time at upload interfering with or confusing the RTC time.
Fortunately the RTC on Teensy 3.x has a 32 byte memory which is also supported by the battery. I solved this problem by dedicating the last 4 bytes to the RTC startup. When the RTC is found to be uninitialized (presumably between power was off without the coin cell battery keeping the RTC alive), those 4 bytes have random bits which are very unlikely to be the special code. So the startup code initializes the RTC with the stale timestamp, and writes the code to those 4 bytes.
Later when you upload code, and Teensy reboots, the startup code looks at those 4 bytes if the RTC is already running. If they have the special code, then the startup code assumes the RTC must have the wrong time. It reinitializes the RTC with the linker's timestamp of the most recent compile.
As I understand an equivalent mechanism has been implemented on T4.x as well, and it works fine on my T4.1
Questions:
(1) Presumably there is some equivalent to the 32 byte memory on the T4.1 for those special 4 bytes of unique code. Where are they located, and how to access them ?
(2) is there a way to override, or prevent the auto time setting process at upload?
My second question is because I am using a DS3231 RTC as the sync provider (for more stable/precise time over the longer term). I don't want to risk the PC time at upload interfering with or confusing the RTC time.