RTC_RX8130CE writes and reads the one-hot WEEK register as a number
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 78/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- c
- Domain
- embedded-iot
Research direction
Read src/helpers/RTC_RX8130CE.cpp, especially setTime() and getTime(), alongside the RX8130CE manual's week counter section. Update the write and read handling to use the one-hot weekday encoding described in the issue, including the stated behavior for old multi-bit values. Done when all seven weekdays round-trip correctly and an old multi-bit value decodes to its lowest set bit.
Written by the indexing model from the issue text.
Description
RTC_RX8130CE writes and reads the RX8130CE's WEEK register as a number. The chip encodes the day of the week one-hot, so on some days it holds no day at all, and on others it holds two days at once.
References:
- The manual: RX8130CE Application Manual, Seiko Epson, ETM50E-10, from the product page: https://www5.epsondevice.com/en/products/rtc/rx8130ce.html. Section, table and page numbers below are that document's, with printed page numbers.
- The code: upstream
dev3e3150c8.
The defect
§14.1.2 "Week counter" (p. 27) says the day of the week "is indicated by 7 bits, bit 0 to bit 6", counted as 01h → 02h → 04h → 08h → 10h → 20h → 40h → 01h. Table 15 sets Sunday = 01h through Saturday = 40h, and the manual says: "Do not set '1' to more than one day at the same time."
-
setTime()L98 writesbin2bcd(t->tm_wday) & 0x07. That gives:- Sunday (0):
00h, no day set. - Wednesday (3):
03h, Sunday and Monday both set. - Friday (5):
05h, Sunday and Tuesday both set. - Saturday (6):
06h, Monday and Tuesday both set. - Monday (1), Tuesday (2) and Thursday (4):
01h,02hand04h. Each is a single bit, but for the wrong day: Sunday, Monday and Tuesday.
No day of the week is stored correctly.
- Sunday (0):
-
getTime()L144 decodes it the same way,bcd2bin(buff[3] & 0x07), so a correctly encoded register (Thursday = 10h) would read back as 0.
Impact
Low. now() and unixtime() go through mktime(), which ignores tm_wday, so the date and time MeshCore uses are unaffected. What is wrong is the chip's own week counter:
- It holds an invalid value, which the manual tells you not to write.
- On a Sunday it holds no day at all.
That matters for a weekday alarm, which MeshCore doesn't use, and for any other firmware that reads the chip.
Proposed fix
- Write:
1 << t->tm_wday. - Read: decode the position of the set bit, taking the lowest set bit when a chip still holds an old multi-bit value.
There are no other callers: tm_wday is written and read only in these two places.
The same defect was found independently in ZephCore: ptr727/liquidraver-ZephCore#39.
- Dominant language
- C
- Stars
- 3.9k
- Forks
- 1.5k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 26
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from meshcore-dev/MeshCore
-
Difficulty 2/5 1-3 hours Newbie friendliness 63/100
meshcore-dev/MeshCore#3622 ·
Maintainers usually reply within 1 day
-
[Feature Request] Set Australia (Mid) Preset to automatically enable 2 byte default path hash sizeOpen
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
meshcore-dev/MeshCore#3571 · 5 reactions ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
meshcore-dev/MeshCore#3567 · 1 comment ·
Maintainers usually reply within 1 day
-
Repeater: CLI reply to 'setperm <key> 0' is lost when the removed ACL entry sits before the requester (stale ClientInfo* after array shift)Possibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
meshcore-dev/MeshCore#3513 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
meshcore-dev/MeshCore#3409 · 2 comments ·
Maintainers usually reply within 1 day
All issues in meshcore-dev/MeshCore
Similar issues
-
v9.6.0: CMake incorrectly enforces presence of libevdevPossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
Maintainers usually reply within 1 day
-
[Bug] Unhandled ValueError terminates watchdog thread when GISRC value contains multiple colonsOpenbug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
bug Component component: net
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
RT-Thread/rt-thread#11913 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
contiki-ng/contiki-ng#3289 ·
Maintainers usually reply within 3 days
-
area:docs help wanted type:enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day