0

I have connected an ESP 32 to a MAX11613 chip using this library:

https://github.com/eta-systems/MAX11615/blob/master/src/MAX11615.c

I translated the library for ESP32 using Wire.h. After using the Init-function and the Read-Function the output values for the potentiometer make no sense. They fluctuate randomly with only the max and min values being correct.

My question is: Which step might I have to do. My guess is that I need to do the configuration-function. But I dont understand which data (uint8t) I have to send to the ADC within this function:

uint8_t MAX11615_Configuration(MAX11615* chip, uint8_t data){ data = data & (~0x80); // make REG bit 7 = 0 (configuration byte) if(HAL_I2C_Master_Transmit(chip->wireIface, chip->devAddress, &data, 1, 10) != HAL_OK) return 1; return 0; } translated to:

uint8_t MAX11613::MAX11613_Configuration(structMAX11613* chip, uint8_t data){
data = data & (~0x80); // make REG bit 7 = 0 (configuration byte)

Wire.beginTransmission(chip->devAddress);
Wire.write(data);
Wire.endTransmission();

if (Wire.endTransmission() != 0) {
    return 1;
} else {
    return 0;
}

}

Or might I have to use this setup-function:

uint8_t MAX11613::MAX11613_Setup(structMAX11613* chip, uint8_t data){
/*data = data | 0x80; // make REG bit 7 = 1 (setup byte)
if(HAL_I2C_Master_Transmit(chip->wireIface, chip->devAddress, &data, 1, 10) != HAL_OK) 
    return 1;
return 0;*/
Wire.begin();
data = data | 0x80; // make REG bit 7 = 1 (setup byte)
Wire.beginTransmission(chip->devAddress);
Wire.write(data);
if (Wire.endTransmission() != 0) {
    return 1;
} else {
    return 0;
}

}

Sorry for my many guesses, I don't know which step is missing to setup a translation of the potentiometer values from the adc to the ESP32.

  • See page 14 of [datasheet](https://datasheets.maximintegrated.com/en/ds/MAX11612-MAX11617.pdf) on what need to be done for setup/configuration – hcheung Feb 21 '22 at 10:27
  • Hey. Thank you very much :) I now know which data I have to send to those functions :) – schnecktec Feb 21 '22 at 13:04
  • Actually if you read the [source code](https://github.com/eta-systems/MAX11615/blob/master/src/MAX11615.c#L48-L70) and the README, it call this function which in turn called setup then configuration. – hcheung Feb 21 '22 at 13:08
  • That's true. Thanks, again :)) I will play around with the vRef and config value in those functions and report back later this week if it worked. – schnecktec Feb 21 '22 at 13:58

0 Answers0