I need help with I2C communication.
The master IC (Arduino Uno) is communicating with a digital potentiometer at address 0101 0000 (only 7 bit 010 1000 in beginTransmission).
First I need to send 0000 0000 as the address for the wiper register I want to write to.
(Everything up until now works perfectly fine by itself)
When I add the second write line Wire.write(byte(res_value)) to write a value to the register at 0x00 the slave sends a NACK already after Wire.beginTransmission(ADDR_POTI)
But it sends an ACK after Wire.beginTransmission(ADDR_POTI) as well as Wire.write(byte(res_value)) when I only send these two lines and Wire.endTransmission()
Please if you have any idea on how to make this work, tell me.
Edit: Thanks for your replies, swapped the image with code.
Am using the DS3501 Digital Potentiometer https://www.analog.com/media/en/technical-documentation/data-sheets/DS3501.pdf
I got the info about NACK or ACK respectively from measuring the SDA Line via analog oscilloscope. I do not have documentatin of these signals atm
#include <Wire.h>
#define ADDR_POTI B0101000
#define ADDR_RESISTANCE_REGISTER B00000000
byte res_value = 20;
byte read_res_value = 0;
void setup()
{
Wire.begin(); // join i2c bus
Serial.begin(9600);
}
//Potentiometer takes values ranging (0...127 dec) into Wiper Register for setting resistance(127 built-in resistors)
void loop()
{
Wire.beginTransmission(ADDR_POTI); // transmit to device at Address 0101 0000 (digital potentiometer)
Wire.write(ADDR_RESISTANCE_REGISTER); // register address, write
Wire.write(byte(res_value)); // Store res_value in register
Wire.endTransmission();
delay(1);
}