Page 1 of 1

STM32 ADCv2 SW triggered start not working

Posted: Sat Mar 15, 2025 11:48 pm
by faisal
See adc_lld_start_conversion:

Code: Select all

  /* The start method is different depending if HW or SW triggered, the
     start is performed using the method specified in the CR2 configuration.*/
  if ((cr2 & ADC_CR2_SWSTART) != 0) {
    /* Initializing CR2 while keeping ADC_CR2_SWSTART at zero.*/
    adcp->adc->CR2 = (cr2 | ADC_CR2_CONT) & ~ADC_CR2_SWSTART;

    /* Finally enabling ADC_CR2_SWSTART.*/
    adcp->adc->CR2 = (cr2 | ADC_CR2_CONT);
  }
  else
    adcp->adc->CR2 = cr2;
}


The "Finally enabling ADC_CR2_SWSTART." code should be:

Code: Select all

adcp->adc->CR2 = (cr2 | ADC_CR2_SWSTART);

Re: STM32 ADCv2 SW triggered start not working

Posted: Sun Mar 16, 2025 6:36 am
by Giovanni
Hi,

Are you sure? the variable "cr2" already contains ADC_CR2_SWSTART, it should work as is.

Giovanni

Re: STM32 ADCv2 SW triggered start not working

Posted: Mon Mar 17, 2025 12:40 am
by faisal
Giovanni wrote:Hi,

Are you sure? the variable "cr2" already contains ADC_CR2_SWSTART, it should work as is.

Giovanni


You're right :) . Sorry for the bother

Re: STM32 ADCv2 SW triggered start not working

Posted: Mon Mar 17, 2025 6:04 am
by Giovanni
Hi,

Np, better make sure.

Giovanni