A single complete read can return a coherent calendar. Two separate commands can return separate snapshots. Check the transaction boundary and verify it at midnight before blaming the quartz timebase for a timestamp assembled from different reads.
Latching one set of values does not carry it over to the next command
Japan-based ABLIC's S-35390A is a two-wire real-time clock (RTC). Its datasheet defines two time-data accesses. Real-time data 1 starts with the year and returns seven bytes for the full set. Real-time data 2 starts with the hour and returns three bytes. When the chip recognizes a read instruction, it transfers a set of time data for that read. If the calendar rolls over during the transaction, the fields still come from that capture. This describes one read instruction's time snapshot, not a snapshot held indefinitely for later software requests.
A recorder may split date and time reads because of an older interface. The display might update the date first and the alarm task might fetch hours, minutes and seconds separately, with the application combining the two. If midnight falls between the bus operations, each value can be valid on its own while the resulting timestamp has the wrong date. Even if both calls occur in one function, separate read instructions are not one hardware transaction.
Check which fields are in one actual transaction
For a full calendar timestamp, use Real-time data 1 as specified and decode all fields, from year through seconds, from one buffer. The log should retain the raw bytes and the bus transaction they belong to. For a page that displays only the time of day, Real-time data 2 supplies hours, minutes and seconds without four additional bytes. Do not use that read to update half of a full calendar object while taking the rest from an older cache. Label a time-only interface as returning no date if needed.
Check that the driver really performs one complete read. A function described as “read seven bytes” can internally issue separate one-byte transfers. Another driver may retry after a timeout and assemble the first half of the old data with the second half of a new read. Check the actual bus record for the transferred length, which operation finished and whether partial data were discarded after an error. If a transfer fails, do not pass a partial buffer to the logger. Restart from a complete read. A plausible-looking date string is not sufficient evidence.
The device places the command selecting the data group between the device code and the read/write bit. Check whether the analyzer displays a seven-bit value without the read/write bit or the complete byte on the wire. Real-time data 1 has command field 010, and Real-time data 2 has field 011. Both commands can have the same read direction without referring to the same snapshot. Verify the command and response length rather than guessing from a hexadecimal number.
Worked example: two milliseconds apart, one date off by a day
Suppose a warehouse logger with an external quartz timebase reads the calendar as April 30 rolls into May 1. The RTC recognizes the first complete calendar read at 23:59:59.999 local time and a separate time-only read at 00:00:00.001. The commands are 2 ms apart. These illustrative times put the commands on either side of midnight. They do not specify S-35390A bus speed, capture precision or rollover latency.
| Operation | Date or time available from that read | Can it be used as a dated record? |
|---|---|---|
| First read instruction | April 30, 23:59:59 | Yes, date and time come from the same snapshot |
| Second, time-only read | 00:00:00 | No, it gives time of day without a date |
| Incorrect combination | April 30, 00:00:00 | No, it joins two snapshots |
If the application uses the second time value, the date should already be May 1 under these assumptions. Combining it with April 30 gives a label that is 24 h too early. It does not mean the reads took 24 h. If the application keeps the complete April 30, 23:59:59 snapshot, it is assigning the record to the first snapshot time, even if the final bytes arrive after midnight. If the record is meant for a later event, obtain another complete calendar read instead of replacing only the seconds from a second access.
Month ends and leap days can expose the same fault. Prepare a test at the end of February in a non-leap year and another in a leap year. Use the approved setup to set the initial calendar, then read before and after each boundary. This tests how the driver reads, decodes and saves a transaction, not long-term clock drift. If data encoding and 12-hour versus 24-hour display settings can affect the result, verify raw data in each fixed mode before investigating application rollover.
Keep the snapshot, read completion and actual event in separate fields
| Check | Evidence to retain | Why review it |
|---|---|---|
| Device and mode | Full order information, manual revision, calendar mode and timebase configuration | Another RTC may not guarantee the same atomic read |
| Bus command | Complete or time-only read, actual response length and raw bytes | Shows whether date and time came from one snapshot |
| Timing comparison | Command, observable recognition and completion timing, and independent reference | Locates the snapshot without using read completion as its time |
| Application log | Event, request, valid snapshot and retry status | Prevents combining a cached date with a newly read time |
| Fault tests | Second, day and month rollover, truncated reads and retries | Checks that the driver retrieves a fresh complete set at a boundary |
When reviewing substitute RTCs, include the snapshot timing and fields covered if the product depends on a coherent read. Support for a two-wire interface does not establish identical behavior. A different crystal might improve average clock rate, but it cannot repair a date assembled across two commands. Firmware must preserve one complete snapshot. Test long-term clock accuracy and boundary read coherence separately instead of using a pass on the first to approve the second.
Label which instant the independent reference represents. If the bus analyzer puts a system time only at the end of the transfer, do not use that label as the instant the command was recognized. Save an independent midnight marker alongside the raw bus edges so reviewers can see where the command fell. If two tasks need a consistent complete time, one read can provide a shared read-only result. When refreshing it, replace the whole snapshot instead of letting a task overwrite only hours, minutes and seconds. The same design makes ordinary logs easier to trace outside boundary tests.
Retests should preserve the raw data from failed transactions too.
Frequently asked questions
Can a delay between reads guarantee they will not straddle midnight?
No. A delay changes the time between commands and may make a rollover between them more likely. For a dated record, take all fields from one complete read instruction.
If the first complete read still gives yesterday's date after midnight, is the RTC slow?
Not necessarily. If that command was recognized before midnight, it returns the earlier snapshot rather than the date at transfer completion. Check long-term accuracy against an independent reference over an appropriate interval.
