-
-
Notifications
You must be signed in to change notification settings - Fork 590
Description
What I came up with is a "ADC_sequencer" as I call it. Basically a scheduler for analog reads. The original core for stm32 actually starts and stops and disables the analog digital converter at every read, this means powering it down, and then requires a startup stabilization again at the start of every read, so there is a delay in the analogRead(). What I have done is:
1.Make it non blocking: at every call read previous result, and start new conversion.
2.Do not disable the ADC when changing channels: this means we do not have to do the ADC startup delay every time.
3. Increase the channel sampling time: This means that when changing channels we get a much better sample of the newly selected channel. And just because we can do that because now it is still much faster than previously powering UP/DOWN the adc block all the time.
4. Same applies to the ADC of ATMEGA, it is also already coded but not yet tested and debugged, so interesting to see the Loops/S increase on Atmega.
5. Currently the code that I am testing is located here:https://github.com/TBAMax/speeduino/tree/ADCclean2
But it is not based on the latest release, some features may be missing. Feel free to use the code, to build on it.
The main core of the idea implementation is in the https://github.com/TBAMax/speeduino/blob/ADCclean2/speeduino/sensors.ino ADC_sequencer()
function though many other functions are attuned to it.
Currently when testing on the STM32F407VE all analog readings seem stable and loops speed is minimum 17kLoops/s (when the ignition/fuel is running) and about 28kLoops/s when engine stopped, occassionally jumping to the 50k.