Go Down

Topic: i2c interface with LPC1114 and Arduino board (Read 4 times) previous topic - next topic

ranjeetray



And it is not working, Can you please suggest something on the range of address.


Yes, I suggest you use the I2C scanner I mentioned above. Did you?




Dear Sir


Thanks a lot for your kind support.

It is working now, the address given in PCA9532 datasheet is wrong, it is 0x60 and not 0xC0.

Thanks...

ranjeetray


Quote
You can download all the relevant NXP sample code and driver from the following link.

I know of this page but there's a 1000 files there, which one?

I don't have an LPC11xx to run it on anyway I'm afraid but may be able to see what some of these calls do.

Just looking at the PCA9532, address 0xC0 is a write to address 0x60. Is that what you intended?

BTW, it looks like you are using an LPC XPresso base board, is that the case?

______
Rob






Dear Sir


Thanks a lot for your kind support.

It is working now, the address given in PCA9532 datasheet is wrong, it is 0x60 and not 0xC0.
It is working with address 0x60.
Can you please explain it "address 0xC0 is a write to address 0x60", Sorry I could not understand.

Thanks...

Nick Gammon

If you look at the datasheet, it clearly shows that 0xC0 includes the read/write bit. The I2C library inserts that for you, so you shift the address right once, giving 0x60 as Graynomad suggested above.

You need to use the address 0x60.

Nick Gammon


Can you please explain it "address 0xC0 is a write to address 0x60", Sorry I could not understand.


To write to the device you take 0x60, shift it left once, giving 0xC0. To read from the device you take 0x60, shift it left once, giving 0xC0 and then set the low-order bit, giving 0xC1.

The I2C library does that for you, so you tell the I2C library 0x60.


Graynomad

I think you should start your own thread ranjeetray, this appears to have nothing to do with this one.

______
Rob
Rob Gray aka the GRAYnomad www.robgray.com

ranjeetray

#35
Oct 10, 2012, 01:54 pm Last Edit: Oct 10, 2012, 01:57 pm by ranjeetray Reason: 1
Respected Sir


I am sending data(CSP header) as 0x50,0x46,0x00,0x00 to Gomspace Camera Nanocam C1 U(I2C address is 0x06) and I am expecting 50 bytes of data, but I am getting 0xFFFFFFFF. Is it happening due to frequency synchronization or any other hardware problem.

Code: [Select]

#include <Wire.h>

void setup()
{Wire.begin();
Serial.begin(9600);
}
void loop()
{int rtrn;

int outgoingByte[] = {0x50};
int outgoingByte1[] = {0x46};
 int outgoingByte2[] = {0x00};
  int outgoingByte3[] = {0x00};

//For payload camera
Wire.beginTransmission(0X06);
{Wire.write(outgoingByte[0]);
Wire.write(outgoingByte1[0]);
Wire.write(outgoingByte2[0]);
Wire.write(outgoingByte3[0]);
rtrn = Wire.endTransmission();}
delay(1);
Wire.requestFrom(0X06, 100);    
while(!Wire.available());    
{char c = Wire.read();
Serial.println(" Returning Success on Writing to the Payload::");
Serial.println(rtrn,DEC);    
Serial.println("Data read from Gomspace Camera:");
Serial.println(c,HEX);
Serial.println(c,BIN);}
delay(1);

Serial.println(' ');
Serial.println(' ');    }






Thanks & Regards...  :-)

PaulS

Quote
I am sending data(CSP header) as 0x50,0x46,0x00,0x00 to Gomspace Camera Nanocam C1 U(I2C address is 0x06) and I am expecting 50 bytes of data

The key might well be that you are expecting them IMMEDIATELY. As in with a few nanoseconds. That hardly seems likely.

Code: [Select]
rtrn = Wire.endTransmission();} // We're done sending
delay(1); // Wait 1 millisecond for the data to get there.
Wire.requestFrom(0X06, 100);    // Ask for 100 character response
while(!Wire.available());    //  Wait until there is one character back
{char c = Wire.read(); // A useless curly brace
Serial.println(" Returning Success on Writing to the Payload::");
Serial.println(rtrn,DEC);    
Serial.println("Data read from Gomspace Camera:");
Serial.println(c,HEX);
Serial.println(c,BIN);} // Another one


Putting each (necessary) { on a new line (like some styles dictate), and putting each } on a new line (like EVERY style dictates), and using Tools + Auto Format to fix you horrid indenting would make your code easier to read.

As would getting rid of the useless curly braces.

Nick Gammon

Quote
I am expecting 50 bytes of data ...


Code: [Select]

Wire.requestFrom(0X06, 100);    // Ask for 100 character response


Why ask for 100 then? Please read what you are posting.




The buffer size of the Wire library is 32 bytes. Thus you cannot request 50 bytes and certainly not 100.




Code: [Select]

Wire.requestFrom(0X06, 100);    // Ask for 100 character response
while(!Wire.available());    //  Wait until there is one character back


Wire.requestFrom does not return until it has a response, so doing Wire.available is redundant. However you should check the return code from Wire.requestFrom to make sure it worked. Perhaps there is no device at address 6.




http://www.gammon.com.au/i2c

Nick Gammon

Quote
3060.05 KB, 1360x768 - viewed 1 times.


I asked you in another thread, please don't post 3 Mb screenshots of text. Just copy and paste the text itself. That saves a lot of bandwidth.

ranjeetray


Quote
I am expecting 50 bytes of data ...


Code: [Select]

Wire.requestFrom(0X06, 100);    // Ask for 100 character response


Why ask for 100 then? Please read what you are posting.




The buffer size of the Wire library is 32 bytes. Thus you cannot request 50 bytes and certainly not 100.




Code: [Select]

Wire.requestFrom(0X06, 100);    // Ask for 100 character response
while(!Wire.available());    //  Wait until there is one character back


Wire.requestFrom does not return until it has a response, so doing Wire.available is redundant. However you should check the return code from Wire.requestFrom to make sure it worked. Perhaps there is no device at address 6.




http://www.gammon.com.au/i2c



Respected Sir

Thanks a lot for your kind reply.
I am sorry Sir.
It is my mistake it should be 50 only in this function Wire.requestFrom(0X06, 100); . Actually Sir, I have tried with Wire.requestFrom(0X06, 1); Wire.requestFrom(0X06, 2); Wire.requestFrom(0X06, 6); Wire.requestFrom(0X06, 8); Wire.requestFrom(0X06, 16); Wire.requestFrom(0X06, 32); Wire.requestFrom(0X06, 50); Wire.requestFrom(0X06, 64); and Wire.requestFrom(0X06, 100); but in all the cases it gives same result as 0xFFFFFFFF only.
I could not understand the problem .


Thanks & Regards....  :-)

Nick Gammon

Is this question anything to do with "i2c interface with LPC1114"?

Is that connected to "Gomspace Camera Nanocam C1 U"?

Graynomad

From post #32

Quote
I think you should start your own thread ranjeetray, this appears to have nothing to do with this one.


______
Rob
Rob Gray aka the GRAYnomad www.robgray.com

ranjeetray


Is this question anything to do with "i2c interface with LPC1114"?

Is that connected to "Gomspace Camera Nanocam C1 U"?


Respected Sir

I apologize for this, I will start a new thread for this.


Thanks & Regards...   :-)

Go Up