STM32L486xx HAL User Manual
Functions
Configuration of ADC hierarchical scope: channels
ADC Exported Functions

Functions

__STATIC_INLINE void LL_ADC_SetChannelSamplingTime (ADC_TypeDef *ADCx, uint32_t Channel, uint32_t SamplingTime)
 Set sampling time of the selected ADC channel Unit: ADC clock cycles.
__STATIC_INLINE uint32_t LL_ADC_GetChannelSamplingTime (ADC_TypeDef *ADCx, uint32_t Channel)
 Get sampling time of the selected ADC channel Unit: ADC clock cycles.
__STATIC_INLINE void LL_ADC_SetChannelSingleDiff (ADC_TypeDef *ADCx, uint32_t Channel, uint32_t SingleDiff)
 Set mode single-ended or differential input of the selected ADC channel.
__STATIC_INLINE uint32_t LL_ADC_GetChannelSingleDiff (ADC_TypeDef *ADCx, uint32_t Channel)
 Get mode single-ended or differential input of the selected ADC channel.

Function Documentation

__STATIC_INLINE uint32_t LL_ADC_GetChannelSamplingTime ( ADC_TypeDef *  ADCx,
uint32_t  Channel 
)

Get sampling time of the selected ADC channel Unit: ADC clock cycles.

Note:
On this device, sampling time is on channel scope: independently of channel mapped on ADC group regular or injected.
Conversion time is the addition of sampling time and processing time. On this STM32 serie, ADC processing time is:
  • 12.5 ADC clock cycles at ADC resolution 12 bits
  • 10.5 ADC clock cycles at ADC resolution 10 bits
  • 8.5 ADC clock cycles at ADC resolution 8 bits
  • 6.5 ADC clock cycles at ADC resolution 6 bits
Reference Manual to LL API cross reference:
SMPR1 SMP0 LL_ADC_GetChannelSamplingTime
SMPR1 SMP1 LL_ADC_GetChannelSamplingTime
SMPR1 SMP2 LL_ADC_GetChannelSamplingTime
SMPR1 SMP3 LL_ADC_GetChannelSamplingTime
SMPR1 SMP4 LL_ADC_GetChannelSamplingTime
SMPR1 SMP5 LL_ADC_GetChannelSamplingTime
SMPR1 SMP6 LL_ADC_GetChannelSamplingTime
SMPR1 SMP7 LL_ADC_GetChannelSamplingTime
SMPR1 SMP8 LL_ADC_GetChannelSamplingTime
SMPR1 SMP9 LL_ADC_GetChannelSamplingTime
SMPR2 SMP10 LL_ADC_GetChannelSamplingTime
SMPR2 SMP11 LL_ADC_GetChannelSamplingTime
SMPR2 SMP12 LL_ADC_GetChannelSamplingTime
SMPR2 SMP13 LL_ADC_GetChannelSamplingTime
SMPR2 SMP14 LL_ADC_GetChannelSamplingTime
SMPR2 SMP15 LL_ADC_GetChannelSamplingTime
SMPR2 SMP16 LL_ADC_GetChannelSamplingTime
SMPR2 SMP17 LL_ADC_GetChannelSamplingTime
SMPR2 SMP18 LL_ADC_GetChannelSamplingTime
Parameters:
ADCxADC instance
ChannelThis parameter can be one of the following values: (1) On STM32L4, parameter available only on ADC instance: ADC1.
(2) On STM32L4, parameter available only on ADC instance: ADC2.
(3) On STM32L4, parameter available only on ADC instance: ADC3.
(4) On STM32L4, parameter available only on ADC instances: ADC1, ADC3.
(5) On STM32L4, parameter available on devices with only 1 ADC instance.
(6) On STM32L4, parameter available on devices with several ADC instances.
(7) On STM32L4, fast channel (0.188 us for 12-bit resolution (ADC conversion rate up to 5.33 Ms/s)). Other channels are slow channels (0.238 us for 12-bit resolution (ADC conversion rate up to 4.21 Ms/s)).
Return values:
Returnedvalue can be one of the following values: (1) On some devices, ADC sampling time 2.5 ADC clock cycles can be replaced by 3.5 ADC clock cycles. Refer to function LL_ADC_SetSamplingTimeCommonConfig().

Definition at line 4786 of file stm32l4xx_ll_adc.h.

References __ADC_MASK_SHIFT, __ADC_PTR_REG_OFFSET, ADC_CHANNEL_SMPRX_REGOFFSET_MASK, ADC_CHANNEL_SMPx_BITOFFSET_MASK, and ADC_CHANNEL_SMPx_BITOFFSET_POS.

__STATIC_INLINE uint32_t LL_ADC_GetChannelSingleDiff ( ADC_TypeDef *  ADCx,
uint32_t  Channel 
)

Get mode single-ended or differential input of the selected ADC channel.

Note:
When configuring a channel 'i' in differential mode, the channel 'i+1' is not usable separately. Therefore, to ensure a channel is configured in single-ended mode, the configuration of channel itself and the channel 'i-1' must be read back (to ensure that the selected channel channel has not been configured in differential mode by the previous channel).
Refer to Reference Manual to ensure the selected channel is available in differential mode. For example, internal channels (VrefInt, TempSensor, ...) are not available in differential mode.
When configuring a channel 'i' in differential mode, the channel 'i+1' is not usable separately.
On STM32L4, channels 16, 17, 18 of ADC1, ADC2, ADC3 (if available) are internally fixed to single-ended inputs configuration.
One or several values can be selected. In this case, the value returned is null if all channels are in single ended-mode. Example: (LL_ADC_CHANNEL_4 | LL_ADC_CHANNEL_12 | ...)
Reference Manual to LL API cross reference:
DIFSEL DIFSEL LL_ADC_GetChannelSingleDiff
Parameters:
ADCxADC instance
ChannelThis parameter can be a combination of the following values:
Return values:
0,:channel in single-ended mode, else: channel in differential mode

Definition at line 4903 of file stm32l4xx_ll_adc.h.

References ADC_SINGLEDIFF_CHANNEL_MASK.

__STATIC_INLINE void LL_ADC_SetChannelSamplingTime ( ADC_TypeDef *  ADCx,
uint32_t  Channel,
uint32_t  SamplingTime 
)

Set sampling time of the selected ADC channel Unit: ADC clock cycles.

Note:
On this device, sampling time is on channel scope: independently of channel mapped on ADC group regular or injected.
In case of internal channel (VrefInt, TempSensor, ...) to be converted: sampling time constraints must be respected (sampling time can be adjusted in function of ADC clock frequency and sampling time setting). Refer to device datasheet for timings values (parameters TS_vrefint, TS_temp, ...).
Conversion time is the addition of sampling time and processing time. On this STM32 serie, ADC processing time is:
  • 12.5 ADC clock cycles at ADC resolution 12 bits
  • 10.5 ADC clock cycles at ADC resolution 10 bits
  • 8.5 ADC clock cycles at ADC resolution 8 bits
  • 6.5 ADC clock cycles at ADC resolution 6 bits
In case of ADC conversion of internal channel (VrefInt, temperature sensor, ...), a sampling time minimum value is required. Refer to device datasheet.
On this STM32 serie, setting of this feature is conditioned to ADC state: ADC must be disabled or enabled without conversion on going on either groups regular or injected.
Reference Manual to LL API cross reference:
SMPR1 SMP0 LL_ADC_SetChannelSamplingTime
SMPR1 SMP1 LL_ADC_SetChannelSamplingTime
SMPR1 SMP2 LL_ADC_SetChannelSamplingTime
SMPR1 SMP3 LL_ADC_SetChannelSamplingTime
SMPR1 SMP4 LL_ADC_SetChannelSamplingTime
SMPR1 SMP5 LL_ADC_SetChannelSamplingTime
SMPR1 SMP6 LL_ADC_SetChannelSamplingTime
SMPR1 SMP7 LL_ADC_SetChannelSamplingTime
SMPR1 SMP8 LL_ADC_SetChannelSamplingTime
SMPR1 SMP9 LL_ADC_SetChannelSamplingTime
SMPR2 SMP10 LL_ADC_SetChannelSamplingTime
SMPR2 SMP11 LL_ADC_SetChannelSamplingTime
SMPR2 SMP12 LL_ADC_SetChannelSamplingTime
SMPR2 SMP13 LL_ADC_SetChannelSamplingTime
SMPR2 SMP14 LL_ADC_SetChannelSamplingTime
SMPR2 SMP15 LL_ADC_SetChannelSamplingTime
SMPR2 SMP16 LL_ADC_SetChannelSamplingTime
SMPR2 SMP17 LL_ADC_SetChannelSamplingTime
SMPR2 SMP18 LL_ADC_SetChannelSamplingTime
Parameters:
ADCxADC instance
ChannelThis parameter can be one of the following values: (1) On STM32L4, parameter available only on ADC instance: ADC1.
(2) On STM32L4, parameter available only on ADC instance: ADC2.
(3) On STM32L4, parameter available only on ADC instance: ADC3.
(4) On STM32L4, parameter available only on ADC instances: ADC1, ADC3.
(5) On STM32L4, parameter available on devices with only 1 ADC instance.
(6) On STM32L4, parameter available on devices with several ADC instances.
(7) On STM32L4, fast channel (0.188 us for 12-bit resolution (ADC conversion rate up to 5.33 Ms/s)). Other channels are slow channels (0.238 us for 12-bit resolution (ADC conversion rate up to 4.21 Ms/s)).
SamplingTimeThis parameter can be one of the following values: (1) On some devices, ADC sampling time 2.5 ADC clock cycles can be replaced by 3.5 ADC clock cycles. Refer to function LL_ADC_SetSamplingTimeCommonConfig().
Return values:
None

Definition at line 4682 of file stm32l4xx_ll_adc.h.

References __ADC_MASK_SHIFT, __ADC_PTR_REG_OFFSET, ADC_CHANNEL_SMPRX_REGOFFSET_MASK, ADC_CHANNEL_SMPx_BITOFFSET_MASK, and ADC_CHANNEL_SMPx_BITOFFSET_POS.

Referenced by HAL_ADC_ConfigChannel(), and HAL_ADCEx_InjectedConfigChannel().

__STATIC_INLINE void LL_ADC_SetChannelSingleDiff ( ADC_TypeDef *  ADCx,
uint32_t  Channel,
uint32_t  SingleDiff 
)

Set mode single-ended or differential input of the selected ADC channel.

Note:
Channel ending is on channel scope: independently of channel mapped on ADC group regular or injected. In differential mode: Differential measurement is carried out between the selected channel 'i' (positive input) and channel 'i+1' (negative input). Only channel 'i' has to be configured, channel 'i+1' is configured automatically.
Refer to Reference Manual to ensure the selected channel is available in differential mode. For example, internal channels (VrefInt, TempSensor, ...) are not available in differential mode.
When configuring a channel 'i' in differential mode, the channel 'i+1' is not usable separately.
On STM32L4, channels 16, 17, 18 of ADC1, ADC2, ADC3 (if available) are internally fixed to single-ended inputs configuration.
For ADC channels configured in differential mode, both inputs should be biased at (Vref+)/2 +/-200mV. (Vref+ is the analog voltage reference)
On this STM32 serie, setting of this feature is conditioned to ADC state: ADC must be ADC disabled.
One or several values can be selected. Example: (LL_ADC_CHANNEL_4 | LL_ADC_CHANNEL_12 | ...)
Reference Manual to LL API cross reference:
DIFSEL DIFSEL LL_ADC_SetChannelSingleDiff
Parameters:
ADCxADC instance
ChannelThis parameter can be one of the following values:
SingleDiffThis parameter can be a combination of the following values:
Return values:
None

Definition at line 4853 of file stm32l4xx_ll_adc.h.

References ADC_SINGLEDIFF_CHANNEL_MASK, and ADC_SINGLEDIFF_CHANNEL_SHIFT_MASK.

Referenced by HAL_ADC_ConfigChannel(), and HAL_ADCEx_InjectedConfigChannel().