PSoC1 and Slave Address (SLA) of device

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

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!

0 Likes
19 Replies
Anonymous
Not applicable

poll all possible address at the beginning of the program with time out. ?

0 Likes
Anonymous
Not applicable

Hi H L,

   

Can you detail your solution, please?

   

Because : 0x00 - 0xFF, have about 256 times check.

   

Thanks.

0 Likes
Anonymous
Not applicable

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.

0 Likes
Anonymous
Not applicable

BTW normal I2C device only has 7 bit address. (There are 10bit version around but not as common).

0 Likes
Anonymous
Not applicable

scanning all 120 address should be around 12mS at the normal 100kHz rate, not too long

0 Likes
Anonymous
Not applicable

Thanks H L!

0 Likes
Anonymous
Not applicable

Welcome.

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

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.

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

"sketch" should be "MIT Scratch"

   

 

   

    

   

          http://scratch.mit.edu/

   

 

   

Regards, Dana.

0 Likes
Anonymous
Not applicable

No need to re-invent the wheel. Just make sure not to scan the 8 reserved address.

0 Likes
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

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!

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

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

0 Likes
Anonymous
Not applicable

Thanks Bob!

   

I'll try to modify code.

0 Likes
Anonymous
Not applicable

Thanks for your help! 

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

So it works now as expected?

   

 

   

Bob

0 Likes
Anonymous
Not applicable

 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!

0 Likes
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

Below code was modified (main.txt)!

0 Likes
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

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

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

This should help -

   

 

   

    

   

          

   

http://www.cypress.com/?rID=34486     AN50987 - Getting Started with I2C in PSoC® 1

   

 

   

 

   

Regards, Dana.

0 Likes