According to pre-fixed parameters when setting up the RTC (PREDIV_A=127m PREDIV_S=255) and in accordance with AN4759, if I use a reccomended 32.768KHz (LSE) crystal, I should have a 512Hz signal at PC13 pin (STM32L475) when setting up RTC-Calendar and this pin is enabled as a calibration output.
I have tested this signal with two different PCB's (four layer boards) and with also two different recommended crystals, and I measure a signal (PC13) that is quite below 512Hz:
- In one of the boards, I had to fix PREDIV_A to 125 in order to get 512Hz (With default values, signal ouput is 504Hz).
- In the second board, PREDIV_A has to be set to 126 to get a 512Hz signal (508Hz with default values).
Furthermore, this error is noticed in the RTC calendar itself: delays of a few seconds in just two hours!!!!!
In both cases, RTC-Calendar and calibration output have been set up by means of Cube.
According to this behaviour, this would mean that the crystal is oscillating at about 300Hz difference, what is quite a huge difference!!!!
We have also tested different load capacitors with both tested crystals and the results are quite similar (by default, we had 5p6 capacitors, but last test was with 3p3 capacitors and result was the same).
Finally, and what is the most amazing thing: if the STM32L4 is replaced with a STM32F103, the RTC delay disappears!!!
Do you know which can be the reason of the problem related with this RTC unaccuracy??