Page 1 of 1

ADCv1 and stm32L031 (hal_adc_lld.h)

Posted: Sun Nov 03, 2019 9:48 am
by RadaR
in platform.mk specified that Stm32L031 use a ADCv1 driver.

In ChibiOS/os/hal/ports/STM32/LLD/ADCv1/hal_adc_lld.h specified such defines

Code: Select all

#define ADC_SMPR_SMP_1P5        0U  /**< @brief 14 cycles conversion time   */
#define ADC_SMPR_SMP_7P5        1U  /**< @brief 21 cycles conversion time.  */
#define ADC_SMPR_SMP_13P5       2U  /**< @brief 28 cycles conversion time.  */
#define ADC_SMPR_SMP_28P5       3U  /**< @brief 41 cycles conversion time.  */
#define ADC_SMPR_SMP_41P5       4U  /**< @brief 54 cycles conversion time.  */
#define ADC_SMPR_SMP_55P5       5U  /**< @brief 68 cycles conversion time.  */
#define ADC_SMPR_SMP_71P5       6U  /**< @brief 84 cycles conversion time.  */
#define ADC_SMPR_SMP_239P5      7U  /**< @brief 252 cycles conversion time. */



But in stm32L031 LL (Law layer driver) specified such defines

Code: Select all

#define LL_ADC_SAMPLINGTIME_1CYCLE_5       ((uint32_t)0x00000000U)                               /*!< Sampling time 1.5 ADC clock cycle */
#define LL_ADC_SAMPLINGTIME_3CYCLES_5      (ADC_SMPR_SMP_0)                                      /*!< Sampling time 3.5 ADC clock cycles */
#define LL_ADC_SAMPLINGTIME_7CYCLES_5      (ADC_SMPR_SMP_1)                                      /*!< Sampling time 7.5 ADC clock cycles */
#define LL_ADC_SAMPLINGTIME_12CYCLES_5     (ADC_SMPR_SMP_1 | ADC_SMPR_SMP_0)                     /*!< Sampling time 12.5 ADC clock cycles */
#define LL_ADC_SAMPLINGTIME_19CYCLES_5     (ADC_SMPR_SMP_2)                                      /*!< Sampling time 19.5 ADC clock cycles */
#define LL_ADC_SAMPLINGTIME_39CYCLES_5     (ADC_SMPR_SMP_2 | ADC_SMPR_SMP_0)                     /*!< Sampling time 39.5 ADC clock cycles */
#define LL_ADC_SAMPLINGTIME_79CYCLES_5     (ADC_SMPR_SMP_2 | ADC_SMPR_SMP_1)                     /*!< Sampling time 79.5 ADC clock cycles */
#define LL_ADC_SAMPLINGTIME_160CYCLES_5    (ADC_SMPR_SMP_2 | ADC_SMPR_SMP_1 | ADC_SMPR_SMP_0)    /*!< Sampling time 160.5 ADC clock cycles */



What difines is correct?

Re: ADCv1 and stm32L031 (hal_adc_lld.h)

Posted: Sun Nov 03, 2019 10:07 am
by Giovanni
Hi,

In case of doubt look at the STM32 Reference Manual, anyway, probably this is a bug, those values were taken from the F0 manual. Moving in bug reports.

Giovanni

Re: ADCv1 and stm32L031 (hal_adc_lld.h)

Posted: Sun Nov 03, 2019 10:28 am
by RadaR
Seems bug

Снимок экрана 2019-11-03 в 11.27.48.png

Re: ADCv1 and stm32L031 (hal_adc_lld.h)

Posted: Wed Nov 06, 2019 11:34 pm
by RadaR
Maybe best solution will be perform a ADCv1L0XX ?

Re: ADCv1 and stm32L031 (hal_adc_lld.h)

Posted: Sun Nov 10, 2019 10:14 am
by Giovanni
Hi,

Fixed as bug #1059.

Giovanni