cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L431RC MSI oscillator drift.

Alejandro Bizzotto
Associate III

I have an application who requires a stable clock source in the whole temperature range but the power budget is tight, so we chose to use the MSI in sync with an external low power 32khz clock.

To save extra power we send the core to sleep while it's not needed and wake on interrupt with the line (MSI is 2Mhz):

HAL_PWR_EnterSLEEPMode(PWR_LOWPOWERREGULATOR_ON,PWR_SLEEPENTRY_WFI);

then while testing the device we saw the output of one of the timers drifting too much.

I connected the MSI to the microcontroller clock output and measured with the oscilloscope, the result can be seen in the second video attached.

The clock is drifting with a sawtooth shape, the period of this sawtooth is about 220ms at room temperature and decreaeg with temperature, to about 1ms at 100°C.

The same period can be seen on the input current of the system.

This causes too much disturbances for my application.

Then I found that if I enable the 'main' power regulator with this line:

HAL_PWR_EnterSLEEPMode(PWR_MAINREGULATOR_ON,PWR_SLEEPENTRY_WFI);

then the clock drift less, but at random rate, it can be seen on the first video attached. The drifting with temperature now can be corrected with the use of the synchronization function against the 32khz reference. The current variations at the input also become random. Then the system becomes usable up to 140°C.

The only drawback 100uA more on the current consumption.

Is there any other way to get rid of this periodic drift? is the output of the low power LDO bounded to any pin where I can solder a capacitor? (I already increased the decoupling capacitors to 10uF each with no effect).

Any other ideas I can test?

1 ACCEPTED SOLUTION

Accepted Solutions

There's probably nothing much more you can do - RC oscillators are imprecise, drifting with temperature and supply voltage and influenced by surrounding circuitry. That's just their nature. There's a reason why people invented crystal and MEMS oscillators.

JW

View solution in original post

6 REPLIES 6

There's probably nothing much more you can do - RC oscillators are imprecise, drifting with temperature and supply voltage and influenced by surrounding circuitry. That's just their nature. There's a reason why people invented crystal and MEMS oscillators.

JW

Alejandro Bizzotto
Associate III

The odd thing I found about this is the periodicity on the drift, it seems to me like if the low power LDO is not stable at that current.

The power supply for the microcontroller is 1.8V, I tried rising it to 3V with a very stable lab power supply, but there are no changes.

Uwe Bonnes
Principal III

Probably the Low power regulator is hysteretic, charging supply voltage capacitor up to some value and then letting the voltage drop. Leckage current rises with temperature, and so does time constant drop.

Otherwise MSI has discrete correction steps, and so frequency will have steps.

Can ypu tell more about your measurement setup? On what did you trigger?

Alejandro Bizzotto
Associate III

Thanks Uwe!, I didn't knew about this kind of control loop. It makes sense now the variations on the current consumption in a ramp shape.

The setup is simple: I routed the MSI to the clock output and connected it to the oscilloscope, in the scope, the trigger is the signal itself, the persistence is increased to see the effect and the timebase is lowered to 2ns and shifted to the right, the vertical amplifier rate is also incremented. You can see by the end of the video the 'normal' timebase to see this clock is 100ns. To measure the current I used a DAQ970A, who can draw a graph of the current variations (aside of being very precise), also tried to measure the current with the oscilloscope (unfortunately we don't have a current probe for such small currents) adding a 100 ohm resistor in the return path. I don't have a picture of it, but the period and the shape of the current in the oscilloscope are coincident with the ones that can be seen on the clock.

In my application, a timer is used to generate a clock for a low power quasi resonant up converter, since it's quasi resonant the frequency needs to be very stable and this variations on the clock causes a amplitude modulation (ramp shaped) at the output of the converter, which is unacceptable.

We are using the automatic correction method to sync the clock now, it's easier to handle and based on what we saw, programming the other way of syncing it will not solve the issue with the low power LDO. The 4Mhz crystal is out of the power budget, but the 'normal' LDO is not, so we will keep it this way.

It would be good to know if there are other low power micros of this series where this architecture for the low power LDO is not used, is this stated in any place on the datasheet?

gregstm
Senior III

"In my application, a timer is used to generate a clock for a low power quasi resonant up converter" - what is the frequency? I don't think you have mentioned it. Just curious.

MSI is at 2MHz, the timer is 250kHz