cancel
Showing results for 
Search instead for 
Did you mean: 

Has anyone implemented the ADC calls with LL commands for G4

MKunz.1
Associate II

Dear

I have configured ADC3 using MXcube:

In my main I tried this:

 LL_ADC_ClearFlag_ADRDY(ADC3);

 LL_ADC_Enable(ADC3);

 /* USER CODE END 2 */

 /* Infinite loop */

 /* USER CODE BEGIN WHILE */

 while (1)

 {

    LL_ADC_ClearFlag_EOC(ADC3);

    LL_ADC_ClearFlag_EOS(ADC3);

    LL_ADC_REG_StartConversion(ADC3);

    while(LL_ADC_IsActiveFlag_EOS(ADC3) == 1);

    uint8_t   ui_Rank;

    uint16_t   uw_ADC3_Conversions[10];

    ui_Rank = 1;

    while(ui_Rank < 11)

    {

       uw_ADC3_Conversions[ui_Rank-1] = LL_ADC_INJ_ReadConversionData12(ADC3, ui_Rank);

       ui_Rank++;

    }

    float f_Temperature;

    f_Temperature = uw_ADC3_Conversions[9] / 3.6416; // Temperature calculation

... End of snippet

The results are always 0.

I don't know where the problem is.

Best regards

Martin

1 ACCEPTED SOLUTION

Accepted Solutions
TDK
Guru

> Has anyone implemented the ADC calls with LL commands for G4

Yes. Of of several examples:

https://github.com/STMicroelectronics/STM32CubeG4/blob/3e5243a22addb3cd323dba491eaf43c85ff448f3/Projects/NUCLEO-G431RB/Examples_LL/ADC/ADC_Oversampling_Init/Src/main.c

If you feel a post has answered your question, please click "Accept as Solution".

View solution in original post

1 REPLY 1
TDK
Guru

> Has anyone implemented the ADC calls with LL commands for G4

Yes. Of of several examples:

https://github.com/STMicroelectronics/STM32CubeG4/blob/3e5243a22addb3cd323dba491eaf43c85ff448f3/Projects/NUCLEO-G431RB/Examples_LL/ADC/ADC_Oversampling_Init/Src/main.c

If you feel a post has answered your question, please click "Accept as Solution".