Hello,
i'm quite new in arduino. I'm working on a home-made i2c network to drive attinys slaves (attiny85) by an arduino master(arduino uno).
hardware : -1 arduino uno as master
-1 attiny85(1MHZ) on breadboard as slave
-wires between slave and master for 5v,gnd,SCL,SDA
-2 pull-ups resistor 4k7 on SDA and SCL
sketch arduino uno master :
#include "Wire.h"
void setup()
{
Wire.begin();
Serial.begin(115200);
Serial.println ("IC2 master starting");
}
void i2c_scan_p()
{
Serial.println ();
Serial.println ("Scanning");
int nbr_module = 0;
Wire.begin();
for (byte i = 1; i < 127; i++)
{
Wire.beginTransmission (i);
if (Wire.endTransmission () == 0)
{
Serial.print ("adress found: "),Serial.print (i, DEC),Serial.print (" (0x"),Serial.print (i, HEX),Serial.println (")");
nbr_module++;
}
}
delay(1000);
Serial.println ("Scan done");
Serial.print ("there is "),Serial.print (nbr_module, DEC),Serial.println (" module(s) on the bus");
}
void loop()
{
i2c_scan_p();
}
sketch of attiny85 slave :
#include "TinyWireS.h"
void setup(){TinyWireS.begin(63);}
void loop(){}
I have done some i2c test and as far as know, i can detect and communicate (both way) with the attinys85 on the bus. all my test have been done with adress between 1 and 16. I used as much as 6 attinys at the same time and everything worked perfetcly.
In order to see larger application and to get a better understanding, i'm trying to use all adresses available. The Wire library says that adress are coded on 7 bit wich allow 127 adresses. TinyWires library says that it works the same as Wire library, so 7 bit as well for the adress.
the problem is : i CAN'T detect or communicate with any adress higher than 63. wich is basicaly the half of what the libraries say.
I have tried a lot of adress definition (not at the same time ofc) :
TinyWireS.begin(64); //also with (73) or (85) or (110)
TinyWireS.begin(0x40);
TinyWireS.begin(B01000000);
TinyWireS.begin(B1000000);
TinyWireS.begin(B10100000); //(just to avoid the second bit in case of ...)
//and of course :
TinyWireS.begin(i);
//with :
int i = 64 ;
byte i = 64 ;
byte i = 0x40 ;
#define i 0x40 ; // ect ...
I guess it has something to do with :
""the eighth bit determines if it's being written to or read from.
tinywires says :
TinyWireS.begin(I2C_SLAVE_ADDR); // initialize I2C lib & setup slave's address (7 bit - same as Wire)
When i give the slave the adress 63, the i2cscanner return :
Scanning
adress found: 63 (0x3F)
Scan done
there is 1 module(s) on the bus
When i give the slave the adress 64 or more, the i2cscanner return :
Scanning
Scan done
there is 0 module(s) on the bus
i'm missing something here, it may be huge, i'm always owned by basic stupid things
By the way, if it's just an hardware limit or something, it will work for me, but i'm very curious to understand.
(I searched a lot on google and made a few research on the forum but unsuccessfully. If i missed a topic explaining the subject i'm sorry)
eye_a