- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
while(I2C_WAIT_BYTE_COMPLETE(I2C_CSR_REG))
uint8 state = 0;
uint8 dev_id = 0;
uint8 wBuffer[2] = {1,2};
/*Enable Global Interrupts */
CYGlobalIntEnable;
I2C_Start();
for (dev_id=5 ; dev_id<0xff ; dev_id++)
{
state = I2C_MasterSendStart(dev_id, 0); //always returns I2C_MSTR_NO_ERROR
if (state != I2C_MSTR_NO_ERROR)
{
state = I2C_MasterClearStatus();
state = I2C_MasterWriteByte(0x00); // stuck here every time
state = I2C_MasterSendRestart(dev_id, 1);
wBuffer[0] = I2C_MasterReadByte(I2C_ACK_DATA);
wBuffer[1] = I2C_MasterReadByte(I2C_NAK_DATA);
}
}
- Labels:
-
PSoC 5LP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
When you got stuck, the variable state must show an error (state != I2C_MSTR_NO_ERROR). You get stuck because you continue accessing the I2C
Bob