Electronics > Beginners

I2C Question (with Arduino)


Chet T16:
I'm trying to send some data to an I2C slave from an arduino. Maybe a silly question but do i need to have the slave connected to test the output from the arduino? At the minute i have the arduino connected directly to my logic analyser.

This is the data i captured between the master and slave earlier, its the radio and display in one of the cars.

This is the arduino code, pin 2 is the MRQ line

--- Code: ---#include <Wire.h>
void setup() {
   pinMode(2, OUTPUT);
digitalWrite(2, HIGH);
delay (1000);
void loop()
digitalWrite(2, LOW);
digitalWrite(2, HIGH);
digitalWrite(2, LOW);
digitalWrite(2, HIGH);

--- End code ---

And this is what i'm capturing on the logic analyser (note the write to address isn't the one in the code) Any i2c code i try run gives the same output)

So, yeah, i'm a bit confused. Is the arduino expecting a response from the slave? Even if it was i don't get why the address would be wrong. Is there different i2c protocols? I

Any input appreciated!

Short Circuit:
Yes, you need a device to talk to. When addressed, it will acknowledge it's address and subsequent transfers. Now, the transfer quits because there is no ack on the address.

Your master ist telleing your slave that he wants to write to him and waits for the aknowledge signal from the slave that tells the master that the slave is listeneing and he can proceed sending data to the slave. As the slave does not send the ACK the master knows that the adressee is not listening and quits his attempmts talking to the lasve.

Chet T16:
That would explain the ACK then  ::)

I'll have to connect everything up to the car tomorrow then, i couldn't earlier because i only had 1 usb cable with me and it was either the arduino powered up or use the logic analyser!


[0] Message Index

There was an error while thanking
Go to full version
Powered by SMFPacks Advanced Attachments Uploader Mod