2023-06-01 05: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
Thanks :)
Solved! Go to Solution.
2023-06-01 05:23 AM - edited 2023-11-20 04: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
2023-06-01 05:23 AM - edited 2023-11-20 04: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
2023-06-01 05:26 AM
Got it - thanks!