Fast ADC polling with STM32F466?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-06-01 5:02 AM
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 :)
Solved! Go to Solution.
- Labels:
-
ADC
-
STM32F4 Series
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-06-01 5:23 AM - edited ‎2023-11-20 4:13 AM
> 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?
JW
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-06-01 5:23 AM - edited ‎2023-11-20 4:13 AM
> 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?
JW
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-06-01 5:26 AM
Got it - thanks!
