cancel
Showing results for 
Search instead for 
Did you mean: 

Unstable output signal on RTC out pin (512 Hz)

amion
Associate

I am using stm32g030 RTC. for calibration I send RTC out frequency (512hz) on RTC output pin. when I see the signal on the oscilloscope, the output frequency is unstable. its pulse width are changing constantly and it is not showing me a pure 512hz. I want to use this signal for calibrating the crystal but my calibration fails since I get different frequency in each test.
I checked the same signal on ds1340, the signal is clear, same test on stm32f103vet6 evaluation board and the signal is ok. the only problem is with stm32g030... I ordered an evaluation board to check if the problem arose from my pcb. but same problem still exists.

ezgif-3-4415373aa1.gif

 

Tests that I have done so far:

1-changig (from 5pf to 20pf) or removing capacitors of clock crystal. 

2- cleaning board from any dust or soldering oil

3- using different supply or even RTC backup battery

4- using evaluation board instead of my own PCB

11 REPLIES 11
Peter BENSCH
ST Employee

Welcome @amion, to the community!

can you please upload the IOC or the source code showing the RTC settings?

Regards
/Peter

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Thanks for your attention. I will send ioc file and some screenshots.


https://easyupload.io/flz6zt 

 

 

amion_0-1726481628366.pngamion_1-1726481652457.pngamion_2-1726481678689.png

 

You could also observe directly the 32kHz signal at MCO/LSCO if available.

The overall timing of RTC may be still good, even if the cycle-to-cycle pulse widths change, as those depend on the exact decision level of the oscillator's output discriminator, whereas the oscillator's exact DC level may fluctuate somewhat. Nonetheless it looks like something which may be concerning.

What board is this, a "know good" like Nucleo or your own design? How exactly is the LSE circuit laid out, especially how are grounds arranged?

This is @Peter BENSCH 's specialty, I wonder why he did not ask you for pictures of the layout... so I do now.

You could also play with the LSE oscillator strength in the RCC_BDCR register and observe what effect that has.

JW

SofLit
ST Employee

@amion wrote:

I ordered an evaluation board to check if the problem arose from my pcb. but same problem still exists.

4- using evaluation board instead of my own PCB


Which ST Eval board you used for this test?

And as stated by @Peter BENSCH , need to attach the ioc file just drug and drop it in the discussion window (we are not using other solutions to share files like dropbox or google drive etc ..)

SofLit_0-1726487012269.png

 

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

Thanks for your reply friends  @waclawek.jan and @SofLit 
I've just realized The evaluation board I used, is a third party and not an original ST board. However, I still don't think that the problem related to PCB layout. I've designed two PCBs that both faced same issue on frequency. I performed all rules related to oscillator such as good grounding and short tracks and close parts. I send the layout for you attention.

amion_0-1726548983442.png

amion_1-1726549199881.png

amion_3-1726549341563.png

 

 

 

I send you the file directly here @Peter BENSCH 

Waiting for your help.

I sent the file to @Peter BENSCH  as you mentioned bro.

Just a question.

According to the video you shared, I can see only the falling edge moving not the rising one. I can't see clearly in the oscilloscope the frequency measurement. But as I can conclude only the duty cycle is changing not the frequency. Do you confirm that? does this presents a problem to you?

In other hand, as it's not an ST board, and if my previous assumption is not correct, it could be something related to the Crystal, load capacitors characteristics and even PCB C stray.

Please review the AN2867 Guidelines for oscillator design on STM8AF/AL/S and STM32 MCUs/MPUs

You need to start by probing this on MCO by outputting an image of LSE signal on MCO (PA8).

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

Yes it seems to be a movement on falling edge, but I had a few samples that the problem comes for rising edge as well (but the majority of problems comes from falling edge). according to oscilloscope the frequency switches between 511.7 and 512.6 (I am not sure about the oscilloscope accuracy). the frequency has a little change, but the problem is that my system cannot correctly detect the exact frequency to calibrate the RTC clock.
I will check the document you mentioned to see if it helps.