Skip to main content
Visitor II
November 14, 2024
Solved

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

  • November 14, 2024
  • 1 reply
  • 751 views

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...

    This topic has been closed for replies.
    Best answer by mƎALLEm

    Hello,

    It's considered at this line:

    SofLit_0-1731597027918.png

    Condition: No ADC multimode configured.

    Knowing that in multimode ADC1 is the master.

    1 reply

    mƎALLEmAnswer
    Technical Moderator
    November 14, 2024

    Hello,

    It's considered at this line:

    SofLit_0-1731597027918.png

    Condition: No ADC multimode configured.

    Knowing that in multimode ADC1 is the master.

    nick_bergAuthor
    Visitor II
    November 14, 2024

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

    Thanks