- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi every body!
I have a matter that I want we will discuss about that.
It is:
Example: Range of SLA: 0x00 - 0xFF.
If I don't known SLA of device, can you please tell me solutions to check SLA of that device via I2C protocol?
Many thanks!
- Labels:
-
PSoC 1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
poll all possible address at the beginning of the program with time out. ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi H L,
Can you detail your solution, please?
Because : 0x00 - 0xFF, have about 256 times check.
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If you have a lot of devices, you need to issue the address and wait for the ACK from the slave, if you get an ACK. then the address is used. ( Don't scan the reserved address)
However if you have only one device, I think there is a few special reserved address that can be used. But need to check.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
BTW normal I2C device only has 7 bit address. (There are 10bit version around but not as common).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
scanning all 120 address should be around 12mS at the normal 100kHz rate, not too long
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks H L!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Welcome.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Here was an approach using sketch to throw code together
easily (Arduino) -
http://todbot.com/blog/2009/11/29/i2cscanner-pde-arduino-as-i2c-bus-scanner/comment-page-2/
Regards, Dana.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
No need to re-invent the wheel. Just make sure not to scan the 8 reserved address.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi H L, Dana!
I have done a sample project to scan SLA of DS1307 with PSoC1 CY8C24123A.
But it can't work well.
I'm using I2CHW user module for I2C protocol,
I2CHW_fSendStart() function to check SLA , true or fail!
If I use code ( this code is commented in project):
//
statusSLA = I2CHW_1_fSendStart(104, 0);//SLA of DS1307 is 0x68 = 104; 0 as I2CHW_WRITE
TX8_PutSHexByte(statusSLA);
TX8_PutCRLF();
DelayMsUnsignedInt(5);
//
statusSLA = 1 (true, checked SLA DS1307) appear once ( 1 time), not more.
I think value of statusSLA always equal 1. I don't why!
If I scan SLA to get true SLA of DS1307 by code:
//
for (i = 0; i < 128; i++)
{
statusSLA = I2CHW_1_fSendStart(i,0);
DelayMsUnsignedInt(2);
if (statusSLA == 0)
{
TX8_CPutString("Fail");
TX8_PutCRLF();
}
else
{
TX8_CPutString("SLA = ");
TX8_PutSHexByte(i);
TX8_CPutString("FOUND!");
TX8_PutCRLF();
}
}
//
I can't check SLA of DS1307, statusSLA = 0 (not vary).
I think , when i = 104, I'll checked SLA of DS1307 truly (FOUND).
I want while I scanning SLA of DS1307, I'll found it.
Can you check project for me, please?
Below is my project.
Many thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I would suggest to shut down the I2C master after an unsuccessful I2CHW_1_SendStart(). I am not quite sure what will happen when you do an I2CHW_1_SendStop(), but I would try that as well.
Additionally I would use I2CHW_1_READ as the second parameter to SendStart(), not just 0 (zero) which would indicate that you try to write to the device.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Bob!
I'll try to modify code.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for your help!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
So it works now as expected?
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Bob,
I did that you advised. I scanned SLA of DS1307.
But 2 SLA: 0x68, 0x69 appeared (found)!
SLA of DS1307 only is 0x68. I can't understand why 0x69 found!
How do you think about 2 SLA of DS1307 appeared?
Many thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
guys can you tell me the concept of slave addressing? I'm using PSoC 1 & CY8C20434, in that I have a code working for the 5 buttons; for them I have a pre-assigned SLA but I don't get it how to do that & for the more no. of sensors.
please help me with it.
I'm attaching my project here. Thanks.
Regards---
Amit
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This should help -
http://www.cypress.com/?rID=34486 AN50987 - Getting Started with I2C in PSoC® 1
Regards, Dana.