stevemarple/MCP342x

Timeout with convertAndRead()

Closed this issue · 5 comments

I'm getting a timeout (error=3) when running the following code with MCP3424 connected to ESP8266 (ESP-01). I have another device on the same I2C bus that works normally.

The convertAndRead() call seems to return almost immediately even though I'm trying to increase the timeout value (here 10 secs?).

  long value = 0;
  MCP342x::Config status;
  // Initiate a conversion; convertAndRead() will wait until it can be read
  uint8_t err = adc.convertAndRead(MCP342x::channel1, MCP342x::oneShot,
           MCP342x::resolution16, MCP342x::gain1,
           1000000 * 10, value, status);

I'm using version 1.0.1 it seems.

Arduino has only these available:

image

Workaround is to use negative timeout :)

I'm using version 1.0.1 it seems.

Arduino has only these available:

image

You are using v1.02, which is the latest.

The timeout argument to convertAndRead() is unsigned long; specifying a negative value is likely to result in a large positive value due to the integer wrapping.

I'm using version 1.0.1 it seems.
Arduino has only these available:
image

You are using v1.02, which is the latest.

The timeout argument to convertAndRead() is unsigned long; specifying a negative value is likely to result in a large positive value due to the integer wrapping.

Right, it's 1.0.2.

Closing this now as I believe it is fixed by your commits in #8 which are now in v1.0.3. Thanks again for your contributions.