The I2C slave (Cy8kit-145-40xx psoc) is not detected by raspberry pi.

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

cross mob
UlMo_4589691
Level 1
Level 1
First like given

SDA(P0.5) and SCL(P3.0). The raspberry detects another I2C. Here is the code. I am using PSoC 4.

#include <project.h>

uint8 bufSize;

uint8 readBuffer[] = {1,2,3,4,5,6,7,8,9,10};

uint8 writeBuffer[10];

uint8 byteCnt;

uint8 userArray[10];

uint32 status;

int main()

{   

    I2C_1_I2CSlaveInitReadBuf(readBuffer, 10);

    I2C_1_I2CSlaveInitWriteBuf(writeBuffer, 10);

    I2C_1_Start();

   

    readBuffer[2]=11;

   for(;1;)

    {

    status=I2C_1_I2CSlaveStatus();

    if(0u!= (status & !I2C_1_I2C_SSTAT_RD_CMPLT))

   

    {

        I2C_1_I2CSlaveClearReadBuf();

    }

   

        if(I2C_1_I2CSlaveStatus() & I2C_1_I2C_SSTAT_RD_CMPLT)

        {

            byteCnt=I2C_1_I2CSlaveGetWriteBufSize();

            for (uint8 i=0; i<byteCnt;i++)

            {

                userArray=writeBuffer;

            }

            I2C_1_I2CSlaveClearWriteStatus();

            I2C_1_I2CSlaveClearWriteBuf();

        }

    }

}

0 Likes
1 Solution

Hi UlMo_4589691,

Can you please try the following steps -

1. Connect the device to your PC

2. Set P1[0] and P1[1] as the I2C SCL and SDA pins and program the device.

3. Open Bridge Control Panel.

4. Click on KitProg2 to connect to your device.

5. Click on the List tab present near the bottom-left corner of the window.

6. This should list your device address as shown in the image. Please share the screenshot of the Bridge Control Panel.

pastedImage_1.png

Please ensure that in your setup -

1. The Kit's I2C address and the sensor I2C address is different.

2. An external pull-up resistor (typically 4.7 kohm) is connected to the I2C lines.

3. The ground of your Kit and RPi are shorted.

Thanks and Regards,

Rakshith M B

Thanks and Regards,
Rakshith M B

View solution in original post

0 Likes
3 Replies