hi
i am using DUE for control I2C. the slave IC can support restart I2C. so i use this code Wire.endTransmission(false);
int read_byte_value(unsigned char r)
{
int v1;
Wire.beginTransmission(address);
Wire.write(r);
Wire.endTransmission(false);
// delay(2);
Wire.requestFrom(address,1);
v1=Wire.read();
return v1;
// delay(100);
Wire.endTransmission();
delay(100);
// }
}
the slave's address is 0x07. the reg of slave is 0x01. and its value should be 0x80
but i use prober in SDA and SLC. I found SDA still exist stop signal
TWI (a subset of I2C) is a bit touchy on a DUE plus Wire library is not properly adapted for this board.
There are some example sketches using direct register programming to find workarounds. Note that a 10 Ohm resistor in serie on SDA and SCL lines should also provide an improvement against EMI.
There should be four bytes: address, write_date, address, read_data.
I think I see a fifth byte in the picture of the Arduino Uno.
Could you remove the Wire.endTransmission() after a Wire.requestFrom() ?
@Koepel: As per Sam3x datasheet, to read only one byte, a Start AND a Stop have to be sent at the same time BEFORE reading this single byte. When several consecutive bytes have to be read, a STOP has to be sent right BEFORE the last byte to read (see Sam3x datasheet page 715/716).