cancel
Showing results for 
Search instead for 
Did you mean: 

Missing case for ADC2 software start in STM32f7xx HAL driver HAL_Adc_Start_IT()

nick_berg
Associate II

Hi,

 

Looks like the HAL driver for the STM32f7xx ADC is missing a case for using the software start of the ADC2 peripheral in the HAL_ADC_Start_IT function.

 

Starting from line 1128:

    else
    {
      /* if instance of handle correspond to ADC1 and  no external trigger present enable software conversion of regular channels */
      if((hadc->Instance == ADC1) && ((hadc->Instance->CR2 & ADC_CR2_EXTEN) == RESET))
      {
        /* Enable the selected ADC software conversion for regular group */
          hadc->Instance->CR2 |= (uint32_t)ADC_CR2_SWSTART;
      }

      /* if dual mode is selected, ADC3 works independently. */
      /* check if the mode selected is not triple */
      if( HAL_IS_BIT_CLR(ADC->CCR, ADC_CCR_MULTI_4) )
      {
        /* if instance of handle correspond to ADC3 and  no external trigger present enable software conversion of regular channels */
        if((hadc->Instance == ADC3) && ((hadc->Instance->CR2 & ADC_CR2_EXTEN) == RESET))
        {
          /* Enable the selected ADC software conversion for regular group */
          hadc->Instance->CR2 |= (uint32_t)ADC_CR2_SWSTART;
        }
      } 

 

I think ADC2 should also be considered in this function. In fact, it is not mentioned anywhere in this driver...

1 ACCEPTED SOLUTION

Accepted Solutions
SofLit
ST Employee

Hello,

It's considered at this line:

SofLit_0-1731597027918.png

Condition: No ADC multimode configured.

Knowing that in multimode ADC1 is the master.

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

View solution in original post

2 REPLIES 2
SofLit
ST Employee

Hello,

It's considered at this line:

SofLit_0-1731597027918.png

Condition: No ADC multimode configured.

Knowing that in multimode ADC1 is the master.

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

You are right, I accidentally enabled the multi mode by writing too large a value to CCR->ADCPRE...

Thanks