STM32 ADCv2 SW triggered start not working Topic is solved

Report here problems in any of ChibiOS components. This forum is NOT for support.
Post Reply
faisal
Posts: 382
Joined: Wed Jul 19, 2017 12:44 am
Has thanked: 45 times
Been thanked: 62 times

STM32 ADCv2 SW triggered start not working

Post 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);
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: STM32 ADCv2 SW triggered start not working

Post by Giovanni »

Hi,

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

Giovanni
faisal
Posts: 382
Joined: Wed Jul 19, 2017 12:44 am
Has thanked: 45 times
Been thanked: 62 times

Re: STM32 ADCv2 SW triggered start not working

Post 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
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: STM32 ADCv2 SW triggered start not working

Post by Giovanni »

Hi,

Np, better make sure.

Giovanni
Post Reply