STM32 RTC jumping when power applied

qwertyqwq

Member
Hi ,
Today im facing with a problem that it happened to me twice but couldnt understand the reason behind.

Last weekend i have soldered a pcb on prototype board. The circuit contains transformer and stm32 (which is bluepill) for counting time. Transformer is 230/9v 50hz and 1.2va rating. The STM32 works great when i energies with on top programming header with stlink device. It also works with 230v . But the problem is when i apply 230v to the circuit, stm32 rtc time is jumping randomly. For example , lets say i have setted the time to 10:45 and i denergizes the circuit. After a while , when i replug the circuit to the main voltage, it jumps like 15:10. It is totaly random and this problem doent happens when i energies with programming header pins with stlink device. So the problem must be somewhere on the transformer side. The code side has no problem , i have tested many times.

This is the power supply circuit;


As you can see seconder side of the trasnformer has been regulated by lm317 . The output of the regulator is around 4.1v . There is an onboard regulator at the bluepill which is RT9193 for 3.3v regulation. So it is enough generation 3.3v power for stm32f103. At the past , i have faced that problem again but it was working with 12vdc rather than 230v. After lots of try i have figured out that the problem was belong to aluminium bulk capacitor like 470uF . When i desolder that capacitor system started to work normally. But this time , i cannot remove capacitor which is for rectification to the seconder voltage.

Im looking for a solution and idea for this situation .


Thank you.
 
You do not have any decoupling at the adjust or output pins of the LM317?

How are you powering the RTC while AC is off?
There is no decoupling cap between adjust and ground , but there are some seramik cap at the bluepill itselfs. Like 100nf etc.

When power off , i m using cr2032 battery for LSE oscillator. Normally it is counting as expected when there is no power.
 
Hi,
I connected 4.7uf cap at the output of the regulator.
I connect a scope to the board and ac ripple voltage is less then a 0.5v . Also the lm317t output is flat dc around 4.1v.

Any idea ?
 
My first thought is that you might have a ground bounce issue due to poor routing of the ground connections.

Please post your entire schematic and photos of the layout.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…