silicon errata issue 3 & 4 workaround #68
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Microchip has a document with MCP7940N Family Silicon Errata. It describes 4 hardware issues that the chip has and provides workarounds. This commit aims to implement the workaround for issue 3 and 4.
From the document:
3. Issue: Date Value Changing on Month Write
When writing a different value to the month
register, RTCMTH (0x05), the value of the date
register, RTCDATE (0x04), may change.
Work around:
After writing to the RTCMTH register, verify the
RTCDATE value is correct or write the correct
RTCDATE value again.
4. Issue: Day of Week Value Changing
After Write
If the RTCWKDAY register is written while the
oscillator is stopped, it is possible that the value
will read back as a different value after the
oscillator is started.
Work around:
After writing to the RTCWKDAY register, read
the value back after the oscillator is started to
confirm it is correct and, if necessary, rewrite it.
I encountered issue 4 and issue 3 is also relevant for my use case.
The document suggests for issue 4 to first read back the weekday value and if necessary write it again. I have opted to just write it every time.
For issue 3 I just switched around the order of writes and then it should be fine.
Fixes # (issue)
I will write issues for issue 3 & 4 mentioned in the documentation. Issue 1 & 2 should also be checked
#69
Type of change
How Has This Been Tested?
The problem only occurs in some chips. It seems some batches are more affected then others. This makes reproduction somewhat tricky. For issue 4 what I had to do to reproduce was:
I have tested the fix for issue 4 on a MCP7940N connected to an ESP32 by writing the weekday with different days and with different dates/times in the registry and then reading it back. I have not tested the fix for issue 3 since I was not able to reproduce the error.
Test Configuration:
Checklist: