Page 1 of 1
STM32F4 ADC question
Posted: Tue Jan 24, 2017 11:49 pm
by Rick Burnett
I've been reading the documentation and I think I understand most things, there are 2 things I am unclear about.
1. If I have a conversion group that has the same input listed multiple times in a row, would that be a way to allow the circuitry longer to settle and just keep the last value that got written out? Right now I am using 480 as my sample time, but I'd like to double that.
2. If I have a conversion group of 4 things, let's say CH1, CH2, CH3, CH4. I am not running in repeating mode. Does this mean it waits till all 4 samples are done before calling my callback?
Thanks!
Rick
Re: STM32F4 ADC question
Posted: Wed Jan 25, 2017 8:54 am
by Giovanni
Hi,
1) The time is an HW feature, it is not possible to set higher delays. You may consider making a group of one channel and sample it in a thread with a slow rate or trigger it with a timer. If you have multiple channels then you could make multiple groups of one channel and restart conversions from the ADC callback switching from group to group using some kind of state machine.
2) No, the callback is called when you buffer is filled, in case of circular conversions it is also called when half buffer is filled. If the buffer is just one row then it is called only at the end.
Giovanni
Re: STM32F4 ADC question
Posted: Wed Jan 25, 2017 7:36 pm
by Rick Burnett
1) I guess what I meant on question 1, if I read say channel 1 twice in a row, what I couldn't figure out is, what does the ADC do when it continues, does it reset the internal cap states to some known setting, or does the next channel start where the previous read on that ADC let off. Or, does it drain all the internal caps between readings.
It would seem to me that it must drain the cap values after it reads them before starting the next read.
In this case, I am thinking there are 2 options from what you've given as an example. I could (a) read the same input multiple times which really I am just wasting a bunch of reads that are not necessary, or (2) since I am running these not-not-continous, I can just either use a timer to select when they fire, or, just sleep in the callback for a bit of time to have it wait.
What I do now is have the callback restart a single conversion. In the callback, I switch an external mux to a different set of channels (I needed more ADC inputs that the internal muxing could provide). So I want to wait a bit longer for the propagation of the new values after the mux switches.
Thanks for the help, this is really great.
Rick
Re: STM32F4 ADC question
Posted: Wed Jan 25, 2017 8:24 pm
by Giovanni
Hi,
That question should be asked to ST, I doubt it reset caps because I guess that would cause noise but I am not certain.
Giovanni