Browse Source

stm32: adc-v2: don't attempt to wait for start.

The ADC v2 peripheral doesn't have the same behaviour of starting, where
the hardware clears the bit immediately, on v2, it is not cleared until
the ADC is stopped, or the end of sequence flag is set.

Fixes https://github.com/libopencm3/libopencm3/issues/557
pull/815/merge
Karl Palsson 7 years ago
parent
commit
01320881e7
  1. 9
      lib/stm32/common/adc_common_v2.c
  2. 9
      lib/stm32/f3/adc.c

9
lib/stm32/common/adc_common_v2.c

@ -375,8 +375,10 @@ void adc_disable_vrefint(void)
/** @brief ADC Software Triggered Conversion on Regular Channels
*
* This starts conversion on a set of defined regular channels. It is cleared
* by hardware once conversion starts.
* This starts conversion on a set of defined regular channels.
* Depending on the configuration bits EXTEN, a conversion will start
* immediately (software trigger configuration) or once a regular hardware
* trigger event occurs (hardware trigger configuration)
*
* @param[in] adc ADC block register address base @ref adc_reg_base
*/
@ -384,9 +386,6 @@ void adc_start_conversion_regular(uint32_t adc)
{
/* Start conversion on regular channels. */
ADC_CR(adc) |= ADC_CR_ADSTART;
/* Wait until the ADC starts the conversion. */
while (ADC_CR(adc) & ADC_CR_ADSTART);
}
/**@}*/

9
lib/stm32/f3/adc.c

@ -401,8 +401,10 @@ void adc_disable_eos_interrupt(uint32_t adc)
/*---------------------------------------------------------------------------*/
/** @brief ADC Software Triggered Conversion on Injected Channels
*
* This starts conversion on a set of defined injected channels. It is cleared
* by hardware once conversion starts.
* This starts conversion on a set of defined injected channels.
* Depending on the configuration bits JEXTEN, a conversion will start
* immediately (software trigger configuration) or once an injected hardware
* trigger event occurs (hardware trigger configuration).
*
* @param[in] adc Unsigned int32. ADC block register address base @ref
* adc_reg_base
@ -412,9 +414,6 @@ void adc_start_conversion_injected(uint32_t adc)
{
/* Start conversion on injected channels. */
ADC_CR(adc) |= ADC_CR_JADSTART;
/* Wait until the ADC starts the conversion. */
while (ADC_CR(adc) & ADC_CR_JADSTART);
}

Loading…
Cancel
Save