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
Rakshith
Moderator
Moderator
Moderator
250 likes received 1000 replies posted 750 replies posted

Hi ulmo_4589691​,

Please add the following line of code before 'I2C_1_I2CSlaveInitReadBuf(readBuffer, 10);' -

CyGlobalIntEnable;

This enables the interrupts.

Regards,

Rakshith M B

Thanks and Regards,
Rakshith M B
0 Likes

I added the line in my code, but the I2C device is not detected. In parallel two other sensors are detected by I2C. Hence the error must be in the cypress system. Please find attached my project as a bundle.

I flashed the code successfully and tried different SCA and SCL. Is it possible that the pins are also connected to other items on the board, as

EZ-BLE

EZ-BLE

LED

KIT-Prog

SCL

P1[0]

P0[4]

P2[0]

P3[0]

SDA

P1[1]

P0[5]

P2[1]

P3[1]

Do you have any other hint?

Looking forward to receiving your answer.

0 Likes

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
0 Likes