Contents
How is the sampling rate of STM32 ADC calculated?
The ADC Sampling Rate (Frequency) is calculated using this formula: For The Previous example where Tconv = 1µs, The samplingRate = 1000000 = 1Ms/sec The STM32 ADC has a resolution of 12-Bit which results in a total conversion time of SamplingTime+12.5 clock cycles.
How to use STM32 ADC in a dimmer?
STM32 ADC Read LAB (LED Dimmer With Analog Pot.) Set up An Analog Input Pin (Channel 7) In single Conversion Mode (The Pot. Pin) The Application will have 3 versions each does the same thing which is read the ADC result and move it to the timer CCR register which decides the PWM duty cycle percentage on the output LED pin.
Why does STM32 ADC use an interrupt method?
Upon conversion completion, the ADC fires an interrupt and the CPU is notified so that it can switch the context to the ISR handler and save the ADC conversion results. Despite being an efficient way, the interrupt method can add so much overhead to the CPU and cause very high CPU loading.
When does the ADC start in single conversion mode?
In Single Conversion mode, the ADC does one conversion. This mode is started either by setting the ADON bit in the ADC_CR2 register (for a regular channel only) or by an external trigger (for a regular or injected channel), while the CONT bit is 0. Once the conversion of the selected channel is complete: If a regular channel was converted:
Where can I find stm32l0 ADC interrupt examples?
I started from the example STM32L053C8-Discovery/Examples/ADC/ADC_RegularConversion_Interrupt/ from STM32CubeL0. In main, I have the following ADC initialisation:
How is the total ADC conversion time calculated?
The Total ADC Conversion Time is calculated as follows: Tconv = Sampling time + 12.5 cycles
Is the ADC input clock synchronous with pclk2?
The ADC input clock is generated from the PCLK2 clock divided by a Prescaler and it must not exceed 14 MHz. The ADCCLK clock provided by the Clock Controller is synchronous with the PCLK2 (APB2 clock). The RCC controller has a dedicated programmable Prescaler for the ADC clock, and it must not exceed 14 MHz.