- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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();
}
}
}
Solved! Go to Solution.
- Labels:
-
PSoC 4 Architecture
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
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
Rakshith M B
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
Rakshith M B
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
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
Rakshith M B