PCF2131 - Second pulsed signal triggering wrongly

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

PCF2131 - Second pulsed signal triggering wrongly

ソリューションへジャンプ
1,522件の閲覧回数
JrGomez
Contributor I

Hello,

I'm Ramón and started working with the PCF2131, with a STM MCU. I'm facing an issue with the pulsed second signal, after setting a new time+date in the device. 

The scheme i'm following is the next:

1. I set the device with no interrupts, only the seconds pulsed signal. The control registers are set like this:

** Control 1: 0b0000 0001, Control 2, 3, 4, 5: 0b0. -> Only using second pulsed signal.

** INTA/B Mask1/2: 0b0 -> All interrupts disabled

** WD Control: 0x20 -> Pulsed second signal, with no WD.

2. Then i read from the RTC and checks integrity. Then set the time of my MCU.

3. Periodically, the device is sincronyzed via SNTP. And here comes the problem. 

When the new date is received, we stop the rtc, clear preescaler, set the new time (adding the delay of the operations) and start the RTC again. When this time is close to a seconds change (around 920-950ms), and set the time with the delay increased (this makes the new time set be around 50-80ms),  the seconds pulsed signal is triggered, making the MCU increments a second ahead of the real time. We don't know why is this happening. Tried disabling, clearing and reenabling interrupts, but still the same. Any ideas why this is happening?

I attached the signal we measured with the I2C data we sent. The second one is a zoom on the datetime that is being set in this specific frame, where you can see the 100th of seconds are set to 4.

JrGomez_0-1728630731946.pngJrGomez_1-1728630751501.png

 

0 件の賞賛
返信
1 解決策
1,428件の閲覧回数
JrGomez
Contributor I

Hello Tomas,

I've been out for a week and couldn't answer before. I think we solved it making sequential write of the control + software reset + date & time registers and adding a cleaning of the interrupts. It've been working OK for a full day. 

Thanks for the help!

Best regards, Jr.

元の投稿で解決策を見る

0 件の賞賛
返信
2 返答(返信)
1,429件の閲覧回数
JrGomez
Contributor I

Hello Tomas,

I've been out for a week and couldn't answer before. I think we solved it making sequential write of the control + software reset + date & time registers and adding a cleaning of the interrupts. It've been working OK for a full day. 

Thanks for the help!

Best regards, Jr.

0 件の賞賛
返信
1,496件の閲覧回数
TomasVaverka
NXP TechSupport
NXP TechSupport

Hello Juan,

The seconds pulsed signal being triggered prematurely could be due to the prescaler reset and time reconfiguration occurring too close to the next second increment, causing the pulse to misalign.

When you reset the prescaler and set the new time, if this happens close to a second transition, there might be some internal delay before the RTC recognizes the new time. If the RTC has already internally prepared for the next second increment, it could still trigger the second pulse based on the previous second's timing.

The slight delay in I2C communication when setting the time might affect the synchronization between the RTC and your MCU. Since you mentioned the time is being set with a delay of 50-80ms, it is possible that the pulse signal generation is still based on the original time, which causes the MCU to increment a second prematurely.

A few debugging suggestions:

After setting the new time, ensure that any flags related to the seconds pulse are cleared before restarting the RTC. This might prevent the RTC from immediately triggering the pulse based on old timing data.

After resetting the prescaler and setting the new time, check the prescaler status before re-enabling the pulsed second signal to ensure it is properly reset.

After setting the time, try adding a small delay buffer to ensure that the new timing fully settles before the RTC starts generating pulses again. You can re-enable the pulsed second signal slightly after the reset to avoid catching it mid-transition.

Hope it helps.

BRs, Tomas

%3CLINGO-SUB%20id%3D%22lingo-sub-1971927%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EPCF2131%20-%202%20%E7%95%AA%E7%9B%AE%E3%81%AE%E3%83%91%E3%83%AB%E3%82%B9%E4%BF%A1%E5%8F%B7%E3%81%8C%E8%AA%A4%E3%81%A3%E3%81%A6%E3%83%88%E3%83%AA%E3%82%AC%E3%83%BC%E3%81%95%E3%82%8C%E3%82%8B%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1971927%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHello%2C%3C%2FP%3E%3CP%3E%E7%A7%81%E3%81%AFRam%C3%B3n%E3%81%A7%E3%80%81STM%E3%83%9E%E3%82%A4%E3%82%B3%E3%83%B3%E3%82%92%E4%BD%BF%E7%94%A8%E3%81%97%E3%81%A6PCF2131%E3%81%A7%E5%83%8D%E3%81%8D%E5%A7%8B%E3%82%81%E3%81%BE%E3%81%97%E3%81%9F%E3%80%82%E3%83%87%E3%83%90%E3%82%A4%E3%82%B9%E3%81%A7%E6%96%B0%E3%81%97%E3%81%84%E6%99%82%E9%96%93%2B%E6%97%A5%E4%BB%98%E3%82%92%E8%A8%AD%E5%AE%9A%E3%81%97%E3%81%9F%E5%BE%8C%E3%80%81%E3%83%91%E3%83%AB%E3%82%B9%E3%81%AE2%E7%95%AA%E7%9B%AE%E3%81%AE%E4%BF%A1%E5%8F%B7%E3%81%AB%E5%95%8F%E9%A1%8C%E3%81%8C%E3%81%82%E3%82%8A%E3%81%BE%E3%81%99%E3%80%82%3C%2FP%3E%3CP%3E%E7%A7%81%E3%81%8C%E3%83%95%E3%82%A9%E3%83%AD%E3%83%BC%E3%81%97%E3%81%A6%E3%81%84%E3%82%8B%E3%82%B9%E3%82%AD%E3%83%BC%E3%83%A0%E3%81%AF%E6%AC%A1%E3%81%AE%E3%81%A8%E3%81%8A%E3%82%8A%E3%81%A7%E3%81%99%E3%80%82%3C%2FP%3E%3CP%3E1.%E7%A7%81%E3%81%AF%E5%89%B2%E3%82%8A%E8%BE%BC%E3%81%BF%E3%81%AA%E3%81%97%E3%81%A7%E3%83%87%E3%83%90%E3%82%A4%E3%82%B9%E3%82%92%E8%A8%AD%E5%AE%9A%E3%81%97%E3%80%81%E7%A7%92%E3%83%91%E3%83%AB%E3%82%B9%E4%BF%A1%E5%8F%B7%E3%81%AE%E3%81%BF%E3%82%92%E8%A8%AD%E5%AE%9A%E3%81%97%E3%81%BE%E3%81%97%E3%81%9F%E3%80%82%E5%88%B6%E5%BE%A1%E3%83%AC%E3%82%B8%E3%82%B9%E3%82%BF%E3%81%AF%E6%AC%A1%E3%81%AE%E3%82%88%E3%81%86%E3%81%AB%E8%A8%AD%E5%AE%9A%E3%81%97%E3%81%BE%E3%81%99%E3%80%82%3C%2FP%3E%3CP%3E**%E3%82%B3%E3%83%B3%E3%83%88%E3%83%AD%E3%83%BC%E3%83%AB1%3A0b0000%200001%E3%80%81%E3%82%B3%E3%83%B3%E3%83%88%E3%83%AD%E3%83%BC%E3%83%AB2%E3%80%813%E3%80%814%E3%80%815%3A0b0%E3%80%82-%26gt%3B%202%E7%95%AA%E7%9B%AE%E3%81%AE%E3%83%91%E3%83%AB%E3%82%B9%E4%BF%A1%E5%8F%B7%E3%81%AE%E3%81%BF%E3%82%92%E4%BD%BF%E7%94%A8%E3%81%97%E3%81%BE%E3%81%99%E3%80%82%3C%2FP%3E%3CP%3E**%20INTA%2FB%20Mask1%2F2%3A%200b0%20-%26gt%3B%20%E3%81%99%E3%81%B9%E3%81%A6%E3%81%AE%E5%89%B2%E3%82%8A%E8%BE%BC%E3%81%BF%E3%81%8C%E7%84%A1%E5%8A%B9%3C%2FP%3E%3CP%3E**%20WD%E3%82%B3%E3%83%B3%E3%83%88%E3%83%AD%E3%83%BC%E3%83%AB%3A0x20%20-%26gt%3B%E3%83%91%E3%83%AB%E3%82%B9%E7%A7%92%E4%BF%A1%E5%8F%B7%E3%80%81WD%E3%81%AA%E3%81%97%E3%80%82%3C%2FP%3E%3CP%3E2.%E6%AC%A1%E3%81%AB%E3%80%81RTC%E3%81%8B%E3%82%89%E8%AA%AD%E3%81%BF%E5%8F%96%E3%82%8A%E3%80%81%E6%95%B4%E5%90%88%E6%80%A7%E3%82%92%E7%A2%BA%E8%AA%8D%E3%81%97%E3%81%BE%E3%81%99%E3%80%82%E6%AC%A1%E3%81%AB%E3%80%81%E3%83%9E%E3%82%A4%E3%82%B3%E3%83%B3%E3%81%AE%E6%99%82%E5%88%BB%E3%82%92%E8%A8%AD%E5%AE%9A%E3%81%97%E3%81%BE%E3%81%99%E3%80%82%3C%2FP%3E%3CP%3E3.%E5%AE%9A%E6%9C%9F%E7%9A%84%E3%81%AB%E3%80%81%E3%83%87%E3%83%90%E3%82%A4%E3%82%B9%E3%81%AFSNTP%E3%82%92%E4%BB%8B%E3%81%97%E3%81%A6sincronyz%E3%81%95%E3%82%8C%E3%81%BE%E3%81%99%E3%80%82%E3%81%9D%E3%81%97%E3%81%A6%E3%80%81%E3%81%93%E3%81%93%E3%81%8B%E3%82%89%E3%81%8C%E5%95%8F%E9%A1%8C%E3%81%A7%E3%81%99%E3%80%82%3C%2FP%3E%3CP%3E%E6%96%B0%E3%81%97%E3%81%84%E6%97%A5%E4%BB%98%E3%82%92%E5%8F%97%E4%BF%A1%E3%81%99%E3%82%8B%E3%81%A8%E3%80%81RTC%E3%82%92%E5%81%9C%E6%AD%A2%E3%81%97%E3%80%81%E3%83%97%E3%83%AA%E3%82%B9%E3%82%B1%E3%83%BC%E3%83%A9%E3%83%BC%E3%82%92%E3%82%AF%E3%83%AA%E3%82%A2%E3%81%97%E3%80%81%E6%96%B0%E3%81%97%E3%81%84%E6%99%82%E9%96%93%E3%82%92%E8%A8%AD%E5%AE%9A%E3%81%97%E3%81%A6(%E6%93%8D%E4%BD%9C%E3%81%AE%E9%81%85%E5%BB%B6%E3%82%92%E8%BF%BD%E5%8A%A0)%E3%80%81RTC%E3%82%92%E5%86%8D%E9%96%8B%E3%81%97%E3%81%BE%E3%81%99%E3%80%82%E3%81%93%E3%81%AE%E6%99%82%E9%96%93%E3%81%8C%E7%A7%92%E3%81%AE%E5%A4%89%E5%8C%96(%E7%B4%84920%E3%80%9C950ms)%E3%81%AB%E8%BF%91%E3%81%A5%E3%81%8D%E3%80%81%E9%81%85%E5%BB%B6%E3%82%92%E5%A2%97%E3%82%84%E3%81%97%E3%81%A6%E6%99%82%E9%96%93%E3%82%92%E8%A8%AD%E5%AE%9A%E3%81%99%E3%82%8B%E3%81%A8(%E3%81%93%E3%82%8C%E3%81%AB%E3%82%88%E3%82%8A%E3%80%81%E6%96%B0%E3%81%97%E3%81%84%E6%99%82%E9%96%93%E3%81%8C%E7%B4%8450%E3%80%9C80ms%E3%81%AB%E3%81%AA%E3%82%8A%E3%81%BE%E3%81%99)%E3%80%81%E7%A7%92%E3%83%91%E3%83%AB%E3%82%B9%E4%BF%A1%E5%8F%B7%E3%81%8C%E3%83%88%E3%83%AA%E3%82%AC%E3%83%BC%E3%81%95%E3%82%8C%E3%80%81MCU%E3%81%AF%E3%83%AA%E3%82%A2%E3%83%AB%E3%82%BF%E3%82%A4%E3%83%A0%E3%82%88%E3%82%8A%E3%82%821%E7%A7%92%E6%97%A9%E3%81%8F%E5%A2%97%E5%8A%A0%E3%81%97%E3%81%BE%E3%81%99%E3%80%82%E3%81%AA%E3%81%9C%E3%81%93%E3%81%AE%E3%82%88%E3%81%86%E3%81%AA%E3%81%93%E3%81%A8%E3%81%8C%E8%B5%B7%E3%81%93%E3%81%A3%E3%81%A6%E3%81%84%E3%82%8B%E3%81%AE%E3%81%8B%E3%81%AF%E3%82%8F%E3%81%8B%E3%82%8A%E3%81%BE%E3%81%9B%E3%82%93%E3%80%82%E5%89%B2%E3%82%8A%E8%BE%BC%E3%81%BF%E3%81%AE%E7%84%A1%E5%8A%B9%E5%8C%96%E3%80%81%E3%82%AF%E3%83%AA%E3%82%A2%E3%80%81%E3%81%8A%E3%82%88%E3%81%B3%E5%86%8D%E6%9C%89%E5%8A%B9%E5%8C%96%E3%82%92%E8%A9%A6%E3%81%97%E3%81%BE%E3%81%97%E3%81%9F%E3%81%8C%E3%80%81%E3%81%9D%E3%82%8C%E3%81%A7%E3%82%82%E5%90%8C%E3%81%98%E3%81%A7%E3%81%99%E3%80%82%E3%81%AA%E3%81%9C%E3%81%93%E3%82%8C%E3%81%8C%E8%B5%B7%E3%81%93%E3%81%A3%E3%81%A6%E3%81%84%E3%82%8B%E3%81%AE%E3%81%8B%E4%BD%95%E3%81%8B%E8%80%83%E3%81%88%E3%81%AF%E3%81%82%E3%82%8A%E3%81%BE%E3%81%99%E3%81%8B%3F%3C%2FP%3E%3CP%3E%E6%B8%AC%E5%AE%9A%E3%81%97%E3%81%9F%E4%BF%A1%E5%8F%B7%E3%82%92%E3%80%81%E9%80%81%E4%BF%A1%E3%81%97%E3%81%9FI2C%E3%83%87%E3%83%BC%E3%82%BF%E3%81%AB%E6%B7%BB%E4%BB%98%E3%81%97%E3%81%BE%E3%81%97%E3%81%9F%E3%80%822%E3%81%A4%E7%9B%AE%E3%81%AF%E3%80%81%E3%81%93%E3%81%AE%E7%89%B9%E5%AE%9A%E3%81%AE%E3%83%95%E3%83%AC%E3%83%BC%E3%83%A0%E3%81%AB%E8%A8%AD%E5%AE%9A%E3%81%95%E3%82%8C%E3%81%A6%E3%81%84%E3%82%8B%E6%97%A5%E6%99%82%E3%81%AE%E3%82%BA%E3%83%BC%E3%83%A0%E3%81%A7%E3%80%81100%E5%88%86%E3%81%AE1%E7%A7%92%E3%81%8C4%E3%81%AB%E8%A8%AD%E5%AE%9A%E3%81%95%E3%82%8C%E3%81%A6%E3%81%84%E3%82%8B%E3%81%93%E3%81%A8%E3%81%8C%E3%82%8F%E3%81%8B%E3%82%8A%E3%81%BE%E3%81%99%E3%80%82%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22JrGomez_0-1728630731946.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22JrGomez_0-1728630731946.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F304166i10888103D27B5325%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22JrGomez_0-1728630731946.png%22%20alt%3D%22JrGomez_0-1728630731946.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22JrGomez_1-1728630751501.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22JrGomez_1-1728630751501.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F304167i9D1992B6E6ED52A6%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22JrGomez_1-1728630751501.png%22%20alt%3D%22JrGomez_1-1728630751501.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E