4 years, 4 months ago.

reduce frequency depending on sampling rate of sensor

Hello, I am working on stm32l073 custom board with external oscillator of 8 Mhz. I had 3 –axis sensor interfaced in spi mode. I would like to develop a battery operated device which has to consume very low current. I got to see that more the frequency more is the power consumption. My data rate from ADXL sensor starts from 1 sample/sec till 3200. For 1 sample per second I don’t require 8 Mhz of frequency for higher data rates this is ok. For low date rate the power consumption is higher. Now I would like to implement in such a way that depend on the sampling rate initiated by user the application must switch to low freqencies when required. Is there any solution how do I switch at run time as per above mentioned. If there is any code snippets you give me few pointers so that I can implement.

1 Answer

4 years, 4 months ago.


This article is geared towards the EFM line of devices which is now Silabs but the concepts are still relevant to your STM32 CPU.



Are you using USB with your product ? If yes, then the external clock source is important to support USB unless the CPU can function with USB without an external clock - need to check the datasheet to confirm this feature.

For the slower sensor samples, consider to use the internal RC clock.