Tarcontar:
Hi,
i am searching for an solution to reset the I2C Connection of my arduino, Im have connected it to an raspberry pi and use the i2c Connection to send the pi to sleep. I want to be able to reset the i2c Connection (what is done in Wire.begin()) since i want to wake the pi over analog pin 5 when it is in halt mode. I was lookin at the source Code of wire.h and what is done int twi_init() but cant get it to work.pinMode(WAKE_PIN, OUTPUT);
digitalWrite(WAKE_PIN, LOW);delay(1000);
digitalWrite(WAKE_PIN, HIGH);
pinMode(WAKE_PIN, INPUT);this is my Code to wake the pi, it works if i dont use Wire.begin() but after that it doesnt work anymore. I tried to disable the pullup resistors before with:
digitalWrite(SDA, 0);
digitalWrite(SCL, 0);but it still doesnt work.
Any ideas?
Tarcontar
After you have completed your Wire transactions, use this command to close down the I2C hardware and release A5 and A4
TWCR = 0; // reset TwoWire Control Register to default, inactive state
You will have to issue a Wire.begin() before you can use the I2C interface again. After the TWCR=0; statement, all Wire.h processes are aborted. So if you have your UNO acting as an I2C slave you will have to go through the init process. Wire.begin(), Wire.onRequest(),Wire.onReceive().
Chuck.