Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting Slave Address over 0x3F #41

Open
patrickpoirier51 opened this issue Dec 28, 2017 · 2 comments
Open

Setting Slave Address over 0x3F #41

patrickpoirier51 opened this issue Dec 28, 2017 · 2 comments

Comments

@patrickpoirier51
Copy link

I can get stable reading when Slave Address is < 0x40 with this code
void setup() {
pinMode(Rx, INPUT);
pinMode(Tx, OUTPUT);
mySerial.begin(9600);
TinyWireS.begin(I2C_SLAVE_ADDR);
TinyWireS.onRequest(requestEvent);
}
void requestEvent()
{
SendCount++; //increment this
switch (SendCount)
{
case 1:
sendByte = distLow;
break;
case 2:
sendByte = distHigh;
SendCount=0;
break;
}
TinyWireS.send(sendByte);
}

When Address is => 0x40 , its spitting garbage.

Wild guess:
Seems to be an issue with the write bit being the 7th bit (instead of 8)

@rambo
Copy link
Owner

rambo commented Jan 2, 2018

The write bit is not the issue, but I think I've heard of this problem before but never had any time to really look into it.

@anderstogern
Copy link

Hi there and thanks for this great library!

I can confirm this issue.

For a long period of time (about a year) I have been able to successfully use slave address 0x50 for a slave that only returned a single byte of data and did not receive anything (no receiveEvent defined).

Recently, I had the need to change the slave to return 3 bytes and receive a single byte. Changing the code broke the communication and it was only after several nights of frustration that I discovered this issue and gave changing the address (to 0x20) a try, which immediately fixed the problem.

For good measure, the slave is an AtTiny84 and the master an Adafruit Huzzah ESP8266 (not the Feather one).

Cheers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants