Skip to content

Want faster and better ADC (analog digital converter) reads with ADC_sequencer(). (Massively improved main Loops/s.) #778

@TBAMax

Description

@TBAMax

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy