cancel
Showing results for 
Search instead for 
Did you mean: 

Fast ADC polling with STM32F466?

BSchm.6
Associate III

Hi,

I want to permanently sample ADC data with an ST32F466. Timing is not important, so the idea is to do that out of the main loop. So my idea is, whenever there is some time and whenever the main-loop reaches the related position in code, it reads out the related data register of the ADC and then uses it. When the ADC is not yet ready - no problem, the main-loop will try later when it reaches that position again.

When looking at the example ADC HAL code, this is what has to be done:

HAL_ADC_Start(&AdcHandle);
HAL_ADC_PollForConversion(&AdcHandle, 10) ;
if ((HAL_ADC_GetState(&AdcHandle) & HAL_ADC_STATE_EOC_REG) == HAL_ADC_STATE_EOC_REG)
{
    uhADCxConvertedValue = HAL_ADC_GetValue(&AdcHandle);
}

Now when looking into the code behind these functions, this is way too complex and time-consuming, even for the relaxed timing of my main-loop.

So my question: is there a way to set the ADC into a mode where

  • it permanently samples data from the related input once it has been initialised
  • writes the converted data into a register where the application can read it from
  • sets a "ready"-bit so that the main application can see there is a new value that can be read out of that data-register?

Thanks 🙂

1 ACCEPTED SOLUTION

Accepted Solutions

> ST32F466

Do you mean STM32F446?

> is there a way to set the ADC into a mode where

> a) it permanently samples data from the related input once it has been initialised

> b) writes the converted data into a register where the application can read it from

> c) sets a "ready"-bit so that the main application can see there is a new value that can be read out of that data-register?


_legacyfs_online_stmicro_images_0693W00000dJpP1QAK.pngJW

View solution in original post

2 REPLIES 2

> ST32F466

Do you mean STM32F446?

> is there a way to set the ADC into a mode where

> a) it permanently samples data from the related input once it has been initialised

> b) writes the converted data into a register where the application can read it from

> c) sets a "ready"-bit so that the main application can see there is a new value that can be read out of that data-register?


_legacyfs_online_stmicro_images_0693W00000dJpP1QAK.pngJW

BSchm.6
Associate III

Got it - thanks!