Skip to main content
added 5 characters in body
Source Link
Bence Kaulics
  • 6.4k
  • 12
  • 35
  • 60

In your original code, set the End of Conversion Selection to disabled.

 hadc1.Init.EOCSelection = DISABLE;

It turned out that #define ADC_EOC_SEQ_CONV ((uint32_t)0x00000000) value is equal to DISABLE. So actually the EOCSelection should be configured as:    enter image description here to
to be able to poll the ADC multiple times.

Then you can read the ADC continously without stopping and starting the ADC:

int main(void)
{
    HAL_Init();
    SystemClock_Config();
    ConfigureADC();
    
    HAL_ADC_Start(&hadc1);
    while(1)
    {
        if (HAL_ADC_PollForConversion(&hadc1, 1000000) == HAL_OK)
        {
            ADCValue = HAL_ADC_GetValue(&hadc1);
        }
    }
}

This way it worked fine for me.

Since HAL is a quite new library there are not a lot of resources to be find but not impossible. I learned a lot from this tutorial, it demonstrates all possible ADC useage step by step; from simple polling, to using interrupts and DMA.

In your original code, set the End of Conversion Selection to disabled.

 hadc1.Init.EOCSelection = DISABLE;

It turned out that #define ADC_EOC_SEQ_CONV ((uint32_t)0x00000000) value is equal to DISABLE. So actually the EOCSelection should be configured as:  enter image description here to be able to poll the ADC multiple times.

Then you can read the ADC continously without stopping and starting the ADC:

int main(void)
{
    HAL_Init();
    SystemClock_Config();
    ConfigureADC();
    
    HAL_ADC_Start(&hadc1);
    while(1)
    {
        if (HAL_ADC_PollForConversion(&hadc1, 1000000) == HAL_OK)
        {
            ADCValue = HAL_ADC_GetValue(&hadc1);
        }
    }
}

This way it worked fine for me.

Since HAL is a quite new library there are not a lot of resources to be find but not impossible. I learned a lot from this tutorial, it demonstrates all possible ADC useage step by step; from simple polling, to using interrupts and DMA.

In your original code, set the End of Conversion Selection to disabled.

 hadc1.Init.EOCSelection = DISABLE;

It turned out that #define ADC_EOC_SEQ_CONV ((uint32_t)0x00000000) value is equal to DISABLE. So actually the EOCSelection should be configured as:  enter image description here
to be able to poll the ADC multiple times.

Then you can read the ADC continously without stopping and starting the ADC:

int main(void)
{
    HAL_Init();
    SystemClock_Config();
    ConfigureADC();
    
    HAL_ADC_Start(&hadc1);
    while(1)
    {
        if (HAL_ADC_PollForConversion(&hadc1, 1000000) == HAL_OK)
        {
            ADCValue = HAL_ADC_GetValue(&hadc1);
        }
    }
}

This way it worked fine for me.

Since HAL is a quite new library there are not a lot of resources to be find but not impossible. I learned a lot from this tutorial, it demonstrates all possible ADC useage step by step; from simple polling, to using interrupts and DMA.

added 282 characters in body
Source Link
Bence Kaulics
  • 6.4k
  • 12
  • 35
  • 60

In your original code, set the End of Conversion Selection to disabled.

 hadc1.Init.EOCSelection = DISABLE;

It turned out that #define ADC_EOC_SEQ_CONV ((uint32_t)0x00000000) value is equal to DISABLE. So actually the EOCSelection should be configured as: enter image description here to be able to poll the ADC multiple times.

Then you can read the ADC continously without stopping and starting the ADC:

int main(void)
{
    HAL_Init();
    SystemClock_Config();
    ConfigureADC();
    
    HAL_ADC_Start(&hadc1);
    while(1)
    {
        if (HAL_ADC_PollForConversion(&hadc1, 1000000) == HAL_OK)
        {
            ADCValue = HAL_ADC_GetValue(&hadc1);
        }
    }
}

This way it worked fine for me.

Since HAL is a quite new library there are not a lot of resources to be find but not impossible. I learned a lot from this tutorial, it demonstrates all possible ADC useage step by step; from simple polling, to using interrupts and DMA.

In your original code, set the End of Conversion Selection to disabled.

 hadc1.Init.EOCSelection = DISABLE;

Then you can read the ADC continously without stopping and starting the ADC:

int main(void)
{
    HAL_Init();
    SystemClock_Config();
    ConfigureADC();
    
    HAL_ADC_Start(&hadc1);
    while(1)
    {
        if (HAL_ADC_PollForConversion(&hadc1, 1000000) == HAL_OK)
        {
            ADCValue = HAL_ADC_GetValue(&hadc1);
        }
    }
}

This way it worked fine for me.

Since HAL is a quite new library there are not a lot of resources to be find but not impossible. I learned a lot from this tutorial, it demonstrates all possible ADC useage step by step; from simple polling, to using interrupts and DMA.

In your original code, set the End of Conversion Selection to disabled.

 hadc1.Init.EOCSelection = DISABLE;

It turned out that #define ADC_EOC_SEQ_CONV ((uint32_t)0x00000000) value is equal to DISABLE. So actually the EOCSelection should be configured as: enter image description here to be able to poll the ADC multiple times.

Then you can read the ADC continously without stopping and starting the ADC:

int main(void)
{
    HAL_Init();
    SystemClock_Config();
    ConfigureADC();
    
    HAL_ADC_Start(&hadc1);
    while(1)
    {
        if (HAL_ADC_PollForConversion(&hadc1, 1000000) == HAL_OK)
        {
            ADCValue = HAL_ADC_GetValue(&hadc1);
        }
    }
}

This way it worked fine for me.

Since HAL is a quite new library there are not a lot of resources to be find but not impossible. I learned a lot from this tutorial, it demonstrates all possible ADC useage step by step; from simple polling, to using interrupts and DMA.

Source Link
Bence Kaulics
  • 6.4k
  • 12
  • 35
  • 60

In your original code, set the End of Conversion Selection to disabled.

 hadc1.Init.EOCSelection = DISABLE;

Then you can read the ADC continously without stopping and starting the ADC:

int main(void)
{
    HAL_Init();
    SystemClock_Config();
    ConfigureADC();
    
    HAL_ADC_Start(&hadc1);
    while(1)
    {
        if (HAL_ADC_PollForConversion(&hadc1, 1000000) == HAL_OK)
        {
            ADCValue = HAL_ADC_GetValue(&hadc1);
        }
    }
}

This way it worked fine for me.

Since HAL is a quite new library there are not a lot of resources to be find but not impossible. I learned a lot from this tutorial, it demonstrates all possible ADC useage step by step; from simple polling, to using interrupts and DMA.