RTC issue - PCF2127

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

RTC issue - PCF2127

4,527件の閲覧回数
sharmila_devada
Contributor III

Hi,

I am using RTC PCF2127 in our custom board.  I am always getting the below error when date setting at the time of booting.

"oscillator stop detected, date/time is not reliable"

According to the data sheet this error will occur when OSF bit is set. How to clear this bit for first time reading the RTC time.

This error will not come when we write the date and try to read the same. The steps which I followed

1. Set current date using  "date -s" command

2. hwclock -w

3. hwclock

Issue observed : hwclock command is not giving me the date which I have set .  Any configuration is required for solving the issue ?

Please provide the input for the same 

Thank you,

Regards,

Sharmila

ラベル(1)
0 件の賞賛
6 返答(返信)

3,753件の閲覧回数
sandheepbalasub
Contributor I

Hi 

Thanks for your reply . In my case battery health is good Vbat 3.05V. 

when i set the date and try to write to hwclock i get the below message 

root@imx6q-dms-ba16:~# hwclock -w
rtc-pcf2127-spi spi4.1: low voltage detected, check/replace RTC battery.
rtc-pcf2127-spi spi4.1: oscillator stop detected, date/time is not reliable

root@imx6q-dms-ba16:~# hwclock -r
rtc-pcf2127-spi spi4.1: low voltage detected, check/replace RTC battery.
rtc-pcf2127-spi spi4.1: oscillator stop detected, date/time is not reliable
hwclock: RTC_RD_TIME: Invalid argument

I'm using SPI communication is there any issue in my dts file 

&ecspi5 {
fsl,spi-num-chipselects = <2>;
cs-gpios = <&gpio1 17 0>,
                  <&gpio2 0 0>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_ecspi5>;
status = "okay";

m25_eeprom: m25p80@0 {
compatible = "atmel,at25";
spi-max-frequency = <20000000>;
size = <0x8000>;
pagesize = <64>;
reg = <0>;
address-width = <16>;
};
rtc:pcf2127@0{
#address-cells = <1>;
#size-cells = <1>;
compatible = "nxp,pcf2127";
spi-max-frequency = <5000000>;
interrupt-parent = <&gpio2>;
interrupts = <7 IRQ_TYPE_LEVEL_LOW>;
reg = <1>;
};
};

do i go wrong in above?

Thanks

sandy

0 件の賞賛

3,753件の閲覧回数
sharmila_devada
Contributor III

Hi,

The "hwclock: RTC_RD_TIME: Invalid argument" is due to driver is returning -EINVAL when low voltage is detected.

You can try with below step:

Read the control register 1 in pcf2127_rtc_set_time () function and set the STOP bit and write back the new value.

static int pcf2127_rtc_set_time(struct device *dev, struct rtc_time *tm)

{

//Add the below lines in the beginning of the function

        regmap_read(pcf2127->regmap,PCF2127_REG_CTRL1,(unsigned int *)(&read));

        read = read | 0x20 ;

      regmap_write(pcf2127->regmap,PCF2127_REG_CTRL1,(unsigned int)(read));

.....

}

Thanks and regards,

Sharmila

0 件の賞賛

3,753件の閲覧回数
sharmila_devada
Contributor III

Hi,

Please provide the solution for the above query.

Regards,

Sharmila

0 件の賞賛

3,753件の閲覧回数
diegoadrian
NXP Employee
NXP Employee

Hello, 

I really apologize for the delay.

Do you have the connecting of your RTC?

Probably is an error with the value of the components. The parts need to be exact since any variance could harm the integrity of the signal, giving a bad read of the time.

Please see the below application note, there you could find the schematics of how you need to connect the RTC.

https://www.nxp.com/docs/en/application-note/AN11266.pdf 

Furthermore, Do you know if your RTC hardware is being seen by the kernel? Probably, the PCF2127 has not been set correctly.

Hope this can help you.

Best regards,

Diego.

0 件の賞賛

3,753件の閲覧回数
sandheepbalasub
Contributor I

Hi 

I face the same issue i'm using 4.1.29 kernel with spi communication 

I get the log as below 

rtc-pcf2127-spi spi4.1: low voltage detected, check/replace RTC battery.
rtc-pcf2127-spi spi4.1: oscillator stop detected, date/time is not reliable
rtc-pcf2127-spi spi4.1: rtc core: registered rtc-pcf2127-spi as rtc0

hwclock -r
rtc-pcf2127-spi spi4.1: low voltage detected, check/replace RTC battery.
rtc-pcf2127-spi spi4.1: oscillator stop detected, date/time is not reliable
hwclock: RTC_RD_TIME: Invalid argument

please provide me the input to solve this issue

Thanks

sandy

0 件の賞賛

3,753件の閲覧回数
sharmila_devada
Contributor III

Hi,

I have faced this issue because of low voltage in RTC battery. After mounting the new RTC battery issue got solved.

For checking the date use below commands

date -s "yyyy-mm-dd h:m:s"

hwclock -w

hwclock -r

Thanks

Regards,

Sharmila

0 件の賞賛