i2c/TWI sending data with Due from slave to slave just on one way possible?!

Hi Guys,

I have discovered an error by using Due as slave device in i2c bus an want to sent data to another slave (equivalent to master with adress sending to slave)

void DatenSendeni2c(String DataToSend, int ZielAdresse)
    Wire.begin();  //declare as master before sending data
    char b[33];
    DataToSend.toCharArray(b, DataToSend.length() + 1);
    Wire.write(b, DataToSend.length() + 1);
    Wire.begin(i2cAdresseEigene);  //redeclareto slave/master with adress after sending

If I don't use the Wire.begin() method before beginning the transmission, the Due with a declared Adress won't sent any data and will freeze.

Just with this solution it works...

I'm using the Arduine IDE 1.6.0 with Visual Micro Addon in Visual Studio 2013

Does anybody know somthing about this problem?

On Mega and Uno the Transmission from slave to slave is running without declaring to master before and redeclaring to slave after.

Best regards

Your description of your problem is confusing.

A slave I2C device cannot send data on its own initiative. There needs to be a request from an I2C master, to which the slave can respond by sending data.

generally concerning to i2c it’right, but concerning to arduinos i2c and the wire library it isn’t is.

You also can give an adress to a master device, so it’s able for the master to recieve without making a request.

I developed a smart home system making by 4 arduinos, which are assuming different functions (heating controlling and temperature sensoring, ethernet connection, lights controlling etc.)

this 4 Arduinos are communicating about i2c to each other, everyone of them is a master with adress or a slave (name it as you want, all of them are able to send and recieve about i2c).

Due has an arm chip, so their wire protocol is different. Use 'wire1' instead. Im surprised you got it to work at all.

When I'm using Wire1 instead of Wire there is no difference, it also freezes when the Due is declared as slave. Just when I'm adding the Wire.begin() (let the chambers open) it works.

Apperantly the ARM processor as matter of fact is working different to the normal ATMEGA chips. A different code is required to get the same functions in some cases as the ATMEGA.

This case is surely one of them.

thanks to all für helping!