STM32 ADCv2 SW triggered start not working Topic is solved

Report here problems in any of ChibiOS components. This forum is NOT for support.
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

Postby faisal » Sat Mar 15, 2025 11:48 pm

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: 14659
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1135 times
Been thanked: 947 times

Re: STM32 ADCv2 SW triggered start not working  Topic is solved

Postby Giovanni » Sun Mar 16, 2025 6:36 am

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

Postby faisal » Mon Mar 17, 2025 12:40 am

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: 14659
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1135 times
Been thanked: 947 times

Re: STM32 ADCv2 SW triggered start not working

Postby Giovanni » Mon Mar 17, 2025 6:04 am

Hi,

Np, better make sure.

Giovanni


Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 44 guests