Pages: 1 2 [3]   Go Down
Author Topic: i2c interface with LPC1114 and Arduino board  (Read 3500 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Full Member
***
Karma: 0
Posts: 108
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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...
Logged

Offline Offline
Full Member
***
Karma: 0
Posts: 108
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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...
Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 480
Posts: 18728
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged


Global Moderator
Offline Offline
Brattain Member
*****
Karma: 480
Posts: 18728
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

Logged


nr Bundaberg, Australia
Offline Offline
Tesla Member
***
Karma: 126
Posts: 8499
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

______
Rob
Logged

Rob Gray aka the GRAYnomad www.robgray.com

Offline Offline
Full Member
***
Karma: 0
Posts: 108
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
#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...  :-)


* hgh.bmp (3060.05 KB, 1360x768 - viewed 14 times.)
« Last Edit: October 10, 2012, 06:57:33 am by ranjeetray » Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 610
Posts: 49073
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
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.
Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 480
Posts: 18728
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I am expecting 50 bytes of data ...

Code:
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:
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
Logged


Global Moderator
Offline Offline
Brattain Member
*****
Karma: 480
Posts: 18728
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged


Offline Offline
Full Member
***
Karma: 0
Posts: 108
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I am expecting 50 bytes of data ...

Code:
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:
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, smiley-cool; 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....  :-)
Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 480
Posts: 18728
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

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


nr Bundaberg, Australia
Offline Offline
Tesla Member
***
Karma: 126
Posts: 8499
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

From post #32

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

______
Rob
Logged

Rob Gray aka the GRAYnomad www.robgray.com

Offline Offline
Full Member
***
Karma: 0
Posts: 108
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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...   :-)
Logged

Pages: 1 2 [3]   Go Up
Jump to: