Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

silicon errata issue 3 & 4 workaround #68

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

woutervdhof
Copy link

@woutervdhof woutervdhof commented May 17, 2024

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

  • Bug fix (non-breaking change which fixes an issue)

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:

  • Stop the oscillator
  • Set the day of the week to 4 or 5
  • Start the oscillator
  • Read the day of the week
  • The day of the week has changed

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:

  • Arduino version:
  • Arduino Hardware: Esp32-wroom
  • SDK: esp-idf
  • Development system: Linux

Checklist:

  • The changes made link back to an existing issue number
  • I have performed a self-review of my own code
  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • The code adheres to the Google Style Guide
  • The code follows the existing program documentation style using doxygen
  • I have made corresponding changes to the documentation / Wiki Page(s)
  • My changes generate no new warnings
  • The automated TRAVIS-CI run has a status of "passed"
  • I have checked potential areas where regression errors could occur and have found no issues
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Zanshin Logo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant