Offline
Full Member
Karma: 0
Posts: 108
|
 |
« Reply #30 on: July 27, 2012, 12:41:40 am » |
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
Full Member
Karma: 0
Posts: 108
|
 |
« Reply #31 on: July 27, 2012, 12:44:03 am » |
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
Melbourne, Australia
Offline
Shannon Member
Karma: 218
Posts: 13896
Lua rocks!
|
 |
« Reply #32 on: July 27, 2012, 12:53:57 am » |
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
Melbourne, Australia
Offline
Shannon Member
Karma: 218
Posts: 13896
Lua rocks!
|
 |
« Reply #33 on: July 27, 2012, 12:55:53 am » |
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
Tesla Member
Karma: 71
Posts: 6806
Scattered showers my arse -- Noah, 2348BC.
|
 |
« Reply #34 on: August 28, 2012, 06:11:19 am » |
I think you should start your own thread ranjeetray, this appears to have nothing to do with this one.
______ Rob
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Full Member
Karma: 0
Posts: 108
|
 |
« Reply #35 on: October 10, 2012, 06:54:37 am » |
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. #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... :-)
|
|
|
|
« Last Edit: October 10, 2012, 06:57:33 am by ranjeetray »
|
Logged
|
|
|
|
|
Seattle, WA USA
Offline
Brattain Member
Karma: 311
Posts: 35470
Seattle, WA USA
|
 |
« Reply #36 on: October 10, 2012, 07:22:00 am » |
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. 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
Melbourne, Australia
Offline
Shannon Member
Karma: 218
Posts: 13896
Lua rocks!
|
 |
« Reply #37 on: October 10, 2012, 03:07:16 pm » |
I am expecting 50 bytes of data ... 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.
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
Melbourne, Australia
Offline
Shannon Member
Karma: 218
Posts: 13896
Lua rocks!
|
 |
« Reply #38 on: October 10, 2012, 03:12:37 pm » |
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
Full Member
Karma: 0
Posts: 108
|
 |
« Reply #39 on: October 10, 2012, 10:22:40 pm » |
I am expecting 50 bytes of data ... 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.
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/i2cRespected 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,  ; 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
Melbourne, Australia
Offline
Shannon Member
Karma: 218
Posts: 13896
Lua rocks!
|
 |
« Reply #40 on: October 10, 2012, 10:47:32 pm » |
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
Tesla Member
Karma: 71
Posts: 6806
Scattered showers my arse -- Noah, 2348BC.
|
 |
« Reply #41 on: October 10, 2012, 11:05:06 pm » |
From post #32 I think you should start your own thread ranjeetray, this appears to have nothing to do with this one. ______ Rob
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Full Member
Karma: 0
Posts: 108
|
 |
« Reply #42 on: October 11, 2012, 12:45:03 am » |
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
|
|
|
|
|
|