Skip to content
Permalink
Browse files

drivers: adc_stm32: Get clock frequency from DTS

The adc_stm32 driver used system timer frequency as a base for
busy-wait delay calculation. This commit corrects that by obtaining
the needed value from SystemCoreClock variable.

Signed-off-by: Piotr Zięcik <piotr.ziecik@nordicsemi.no>
  • Loading branch information...
pizi-nordic authored and carlescufi committed May 30, 2019
1 parent a901e32 commit 70d61cdd55592ff6aa3fbe07d3611798a1e332b4
Showing with 1 addition and 1 deletion.
  1. +1 −1 drivers/adc/adc_stm32.c
@@ -557,7 +557,7 @@ static int adc_stm32_init(struct device *dev)
LOG_ERR("ADC clock rate get error.");
}

wait_cycles = CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC / adc_rate *
wait_cycles = SystemCoreClock / adc_rate *
LL_ADC_DELAY_CALIB_ENABLE_ADC_CYCLES;

for (int i = wait_cycles; i >= 0; i--) {

0 comments on commit 70d61cd

Please sign in to comment.
You can’t perform that action at this time.