cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC 5, 3 & 1 MCU

Anonymous
Not applicable

Dear all,

   

I'm new on PSoC and I got a problem of communication between a light sensor TSL2561 and my PSoC 5

   

(here the doc of the sensor : https://cdn-shop.adafruit.com/datasheets/TSL25911_Datasheet_EN_v1.pdf )

   

I can see the buffer on the debug mode but theres are empty, and my sensor don't write his data inside. The datasheet of the sensor talk about perform a four-byte I2C read operation using the auto-increment in the page 17, but I don't understand what is this.

   

 

   

My code :

   

#include <project.h>

   

#define TSL_ADDR    0x29

   

int main()
{
    CyGlobalIntEnable; 
    uint8 mwbuff1[7];
    I2C_Start();

   

    for(;;)
    {
        I2C_MasterReadBuf(TSL_ADDR,mwbuff1,7,I2C_MODE_COMPLETE_XFER);

   

        CyDelay(500);
    }
    I2C_Stop();
}

   

 

   

So what I have to add in my code, for read the light sensor's data.

   

 

   

Thanks.

   

Jacque

0 Likes
6 Replies
rola_264706
Honored Contributor II

Did you add the Pull up resistors to your I2C lines.  Please post your code so we can check it.

0 Likes
rola_264706
Honored Contributor II

Check out this example it has a PDF that explains it.

0 Likes
Anonymous
Not applicable

Thanks bobgoar,

   

Yes I have put the pull up resistor.

0 Likes
Bob_Marlowe
Expert II

Look into datasheet how the scl pin should be configured: Open drain, drives low.

   

Keep in mind that the APIs return a status byte which, when non-zero indicate an error condition.

   

 

   

Bob

0 Likes
rola_264706
Honored Contributor II

What version of Psoc Creator are you running? Please upgrade to 4.1.

0 Likes
Bob_Marlowe
Expert II

Creator 4.1 ??? Where did you get it from? I am running on Creator 4.0 SP1

   

 

   

Bob

0 Likes