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

RTC PCF2129AT support for Raspberry PI 3/4 #1190

Open
sparvu opened this issue Jul 15, 2019 · 9 comments
Open

RTC PCF2129AT support for Raspberry PI 3/4 #1190

sparvu opened this issue Jul 15, 2019 · 9 comments

Comments

@sparvu
Copy link

sparvu commented Jul 15, 2019

Do we support this RTC chip: PCF2129AT ? I have tried to use i2c-rtc.dtbo but no luck. Not sure if I have enabled it correctly under FreeBSD 12.0 RBPI3B+ board.

@pelwell
Copy link
Contributor

pelwell commented Jul 15, 2019

Almost - it shares a driver with the PCF2127, which we do support, but it needs a different "compatible string" so the driver can tell the difference. I've added the necessary options to the i2c-rtc and i2c-rtc-gpio overlays to the kernel source tree - the update will eventually reach the rpi-update and Raspbian firmware packages, but until then you can download a trial version here: https://drive.google.com/open?id=0B_P-i4u-SLBXN240NEVJUmZXak0

@sparvu
Copy link
Author

sparvu commented Jul 15, 2019

Cool. Thanks a lot. Let me try latest version on FreeBSD 12. Will report back the findings.

@sparvu
Copy link
Author

sparvu commented Jul 15, 2019

Nice. I have the clock running now on FreeBSD 12. Here the details:

  • I copied latest i2c-rtc.dtbo /boot/msdos/overlays/

  • I enabled the driver under config.txt (dtoverlay=i2c-rtc,pcf2129)

  • of course nxprtc driver must be loaded via loader.conf (nxprtc_load="YES")

After reboot I see these:

root@k1:~ # dmesg | grep nxp
nxprtc0: <NXP PCF2129 RTC> at addr 0xa2 on iicbus0
nxprtc0: WARNING: RTC battery is low
nxprtc0: registered as a time-of-day clock, resolution 0.500000s
root@k1:~ # dmesg | grep clock
ofw_clkbus0: <OFW clocks bus> on ofwbus0
clk_fixed0: <Fixed clock> on ofw_clkbus0
clk_fixed1: <Fixed clock> on ofw_clkbus0
bcm2835_cpufreq0: can't get clock rate (id=8)
nxprtc0: registered as a time-of-day clock, resolution 0.500000s
Warning: bad time from time-of-day clock, system time will not be set accurately

and I can read and write from the nxprtc0 using sysctl

nxprtc0: read  at 2019-07-15 12:00:40.696296146: 0080-19-01 15:12:00.500000000
nxprtc0: write at 2019-07-15 12:01:12.496294621: 2019-07-15 12:01:12.000000000

So now I need to change my battery. A bit strange these are brand new Varta CR1220 batteries, just bought them - but the driver reports them old :) might be.

@sparvu
Copy link
Author

sparvu commented Jul 15, 2019

but it does not work. if I shutdown my Raspberry PI 3B+ for 30minutes, after boot the time is not accurately kept and NTP is down due the large time difference for sycronization.

Something does not work. For example this message shows some problems. Not sure why:

nxprtc0: registered as a time-of-day clock, resolution 0.500000s
Warning: bad time from time-of-day clock, system time will not be set accurately

@pelwell
Copy link
Contributor

pelwell commented Jul 15, 2019

Have you taken the additional steps listed in this tutorial?: https://learn.adafruit.com/adding-a-real-time-clock-to-raspberry-pi/set-rtc-time

@sparvu
Copy link
Author

sparvu commented Jul 15, 2019

Sure. I have enabled the driver in config.txt but rest is applicable to Linux only. Im testing this on FreeBSD 12 (aarch64) where things are more straight forward. No need to do all those.

One thing I must still check is the battery on the clock: I always see this message from driver:

nxprtc0: WARNING: RTC battery is low

I wonder if this might be the problem such my RTC cannot save and keep the clock running. The battery !?

@pelwell
Copy link
Contributor

pelwell commented Jul 15, 2019

If you have a spare SD card and a spare half hour you could try downloading a Raspbian image, patching the overlay and following the guide, just to be sure that it is a hardware issue rather than some subtle software configuration problem.

@sparvu
Copy link
Author

sparvu commented Jul 15, 2019

aha. good point. I could try that. thanks for tip.

popcornmix added a commit that referenced this issue Jul 23, 2019
kernel: overlays: Add PCF2129 RTC
See: #1190

kernel: overlays: dpi18 and dpi24 vc4 compatibility
kernel: overlays: Add i2c0 and i2c1 for regularity

kernel: Pisound: Remove spinlock usage around spi_sync
See: raspberrypi/linux#3069

kernel: configs: Enable iio driver for TI ADS1015
See: raspberrypi/linux#3083

kernel: bcm2711_defconfig: enable PCI portbus support (and implicitly, PCIe AER)
See: raspberrypi/linux#3086

kernel: FKMS hdmi_timings settings
See: raspberrypi/linux#3082

kernel: overlays: audremap: Support GPIOs 18 & 19
See: #1178

kernel: FKMS overscan support
See: raspberrypi/linux#3090

firmware: Change order of display remapping for default display number

firmware: AWB: Set default number of stats regions for RPi AWB
See: #1198

firmware: Fix composite interrupt HVS channel

firmware: scalarlib: Fix width setting for SCALERLIB_PIXEL_FORMAT_YUV10COL

firmware: vcmailbox: Add a new SET_AUDIO_LDO_STATE mailbox command

firmware: Add mailbox call to report the HDMI timings

firmware: H264: Set the decoder cache AXI burst length to the same as the encoder

firmware: gencmd: Fix gencmd max result length
firmware: bootloader_config: New gencmd to read the EEPROM config

firmware: pwm_audio: Use PWM1 on BCM2838 unless remapped
See: #1178
popcornmix added a commit to Hexxeh/rpi-firmware that referenced this issue Jul 23, 2019
kernel: overlays: Add PCF2129 RTC
See: raspberrypi/firmware#1190

kernel: overlays: dpi18 and dpi24 vc4 compatibility
kernel: overlays: Add i2c0 and i2c1 for regularity

kernel: Pisound: Remove spinlock usage around spi_sync
See: raspberrypi/linux#3069

kernel: configs: Enable iio driver for TI ADS1015
See: raspberrypi/linux#3083

kernel: bcm2711_defconfig: enable PCI portbus support (and implicitly, PCIe AER)
See: raspberrypi/linux#3086

kernel: FKMS hdmi_timings settings
See: raspberrypi/linux#3082

kernel: overlays: audremap: Support GPIOs 18 & 19
See: raspberrypi/firmware#1178

kernel: FKMS overscan support
See: raspberrypi/linux#3090

firmware: Change order of display remapping for default display number

firmware: AWB: Set default number of stats regions for RPi AWB
See: raspberrypi/firmware#1198

firmware: Fix composite interrupt HVS channel

firmware: scalarlib: Fix width setting for SCALERLIB_PIXEL_FORMAT_YUV10COL

firmware: vcmailbox: Add a new SET_AUDIO_LDO_STATE mailbox command

firmware: Add mailbox call to report the HDMI timings

firmware: H264: Set the decoder cache AXI burst length to the same as the encoder

firmware: gencmd: Fix gencmd max result length
firmware: bootloader_config: New gencmd to read the EEPROM config

firmware: pwm_audio: Use PWM1 on BCM2838 unless remapped
See: raspberrypi/firmware#1178
@popcornmix
Copy link
Contributor

Latest rpi-update kernel includes this.

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

No branches or pull requests

3 participants