Code Monkey home page Code Monkey logo

esp32_ad7190's People

Contributors

gism avatar gripmeter avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

badaev52 meins321

esp32_ad7190's Issues

Reading value even if timed out?

I think you are reading the value from the data register even if MOSI never goes low

src/AD7190.cpp

uint32_t AD7190::getDataRegisterAvg(uint8_t sampleNumber) {

  uint32_t samplesAverage = 0;
  for (uint8_t i = 0; i < sampleNumber; i++) {
    waitMisoGoLow();                                                  //  TODO: Check if this can be removed
    uint32_t v = getRegisterValue(AD7190_REG_DATA, 3);
    
    uint8_t channel = v & 0x7;   
    samplesAverage += (v >> 4);
  }
  
  samplesAverage = samplesAverage / sampleNumber;
  return samplesAverage ;

}

examples/AD7190_continuousReadMode/AD7190_ContinuousReadMode.ino

void loop() {

  timeOut = !ad7190->waitMisoGoLow();
  rawAd7190Data = ad7190->getDataRegisterAvg(3);

  if (timeOut)Serial.println("RDY time out");
  
  ...
  
}

Is this deliberate or a bug?

If you change the code to

while (p_ad7190->waitMisoGoLow()) {}
m_rawAd7190Data = p_ad7190->getDataRegisterAvg(3);

The the output rate goes from ~1-11kHz (depending on what is being logged to serial monitor, baud rate, rest of program etc.) to ~30Hz.

When just reading the data regardless of whether MISO has gone low, every few seconds the ADC reading is significantly wrong. I expect this is when the data is being read while the ADC is updating the register values

I expect to get the high frequency, the RDY pin needs to be configured as an interrupt which I will try next.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.