ViezeVingertjes opened a new pull request, #22397:
URL: https://github.com/apache/nuttx/pull/22397
## Summary
Add a driver for the NXP PCF85063A/PCF85063TP I2C real-time clock,
following the model of the existing PCF85263 and PCF8563 drivers: it
implements up_rtc_getdatetime() and up_rtc_settime() for
CONFIG_RTC_EXTERNAL and is bound to its bus from board logic with
pcf85063_rtc_initialize().
- Kconfig option RTC_PCF85063 next to the other external RTC drivers,
with configurable I2C address (default 0x51) and frequency
(default 400 kHz).
- The chip is put in 24-hour mode at initialization (converting the
hours register if it was in 12-hour mode) and restarted if stopped.
The CAP_SEL and CIE bits of Control_1 are preserved.
- Reading the time fails with -ENODATA while the oscillator stop flag
is set; setting the time clears it. The clock is stopped while the
time registers are written.
- The chip holds two year digits with leap years valid for 2000-2099
only, so that range is supported and other years are refused.
- Register writes are sent as one I2C message so controllers without
I2C_M_NOSTART support (e.g. ESP32) work.
- Alarm and timer functions are not implemented, as in the sibling
drivers.
- Document external RTC drivers and the PCF85063 in the RTC driver
documentation.
Tested on Waveshare ESP32-S3-Touch-AMOLED-2.16: date -s writes the chip
and the time is read back after a reset. Built with Make and CMake, no
warnings.
## Impact
* Is new feature added? Is existing feature changed? YES: new driver
(CONFIG_RTC_PCF85063), off by default.
* Impact on user (will user need to adapt to change)? NO
* Impact on build (will build process change)? NO
* Impact on hardware (will arch(s) / board(s) / driver(s) change)? NO
* Impact on documentation (is update required / provided)? YES: RTC driver
documentation.
* Impact on security (any sort of implications)? NO
* Impact on compatibility (backward/forward/interoperability)? NO
## Testing
I confirm that changes are verified on local setup and works as intended:
* Build Host(s): Linux x86_64, xtensa-esp-elf GCC 15.2.0
(esp-15.2.0_20251204), riscv32-esp-elf GCC 15.2.0 for the ESP32-C3 build.
* Target(s): Waveshare ESP32-S3-Touch-AMOLED-2.16 (ESP32-S3R8, 16 MB flash,
8 MB PSRAM).
* On the board (board support follows in a separate PR): `date -s` writes
the PCF85063, and after a reset the system time is loaded from it.
Builds (each on current master plus this PR only):
* PASS pr/pcf85063-rtc devkit esp32s3-devkit:nsh (pcf85063.c compiles,
warnings: 0; link needs the board's up_rtc_initialize(), as for
PCF85263/PCF8563)
Testing logs before change:
```
n/a (new driver)
```
Testing logs after change:
```
nsh> date -s "Nov 26 11:35:19 2026"
nsh> date
Thu, Nov 26 11:35:20 2026
nsh> ### reset, 5 s later:
host UTC: 11:35:34
nsh> date
Thu, Nov 26 11:35:33 2026
```
## PR verification Self-Check
* [x] This PR introduces only one functional change.
* [x] I have updated all required description fields above.
* [x] My PR adheres to Contributing Guidelines and Documentation (git commit
title and message, coding standard, etc).
* [ ] My PR is still work in progress (not ready for review).
* [x] My PR is ready for review and can be safely merged into a codebase.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]