- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am trying to send some data from one I2C master to one non-exist I2C slave on the bus.
the I2C bus only has one master and the SDA/SCL lines have been pull-up as suggested by the spec.
could anyone help me to understand if that is even possible?
seems after master received the NACK after tx of Address, it wouldn't take any write to the I2C_DATA_REG and STOP condition will generated after TRANSMIT bit been set (this may because the lines are all been pull-up?).
Solved! Go to Solution.
- Labels:
-
PSoC 5 Device Programming
-
PSoC 5LP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The I2C protocol requires that a NAK is received to stop transmission. So there will be no workaround that confirms I2C.
What is your actual problem causing, can you tell us a bit more (upload project??)?
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi xiang.yuan_4247356,
When a I2C master receives a NACK, a STOP condition is generated and the data wouldn't be transmitted.
Regards,
Bragadeesh
Bragadeesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
thx BragadeeshV_41, so means this is hard coded in the Hardware, do I get this correct?
if so, is there any workaround available in the FW?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The I2C protocol requires that a NAK is received to stop transmission. So there will be no workaround that confirms I2C.
What is your actual problem causing, can you tell us a bit more (upload project??)?
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
May be sending to non-exist slave is not an easy task.
How about add another I2C in your device as a slave and let it pretend the slave you are planning to use later?
I tested with following set up.
main() is something like
================
int main(void)
{
int tmp ;
int byteCount = 0 ;
int i ;
init_hardware() ;
splash() ;
prompt() ;
for(;;) {
if (get_string(str) > 0) { /* received normal string */
sscanf(str, "%x", &tmp) ;
m_tx_data[0] = tmp & 0xFF ;
print("Master sending:") ;
sprintf(str, "0x%02X\n", m_tx_data[0]) ;
print(str) ;
I2CM_MasterClearStatus() ;
I2CM_MasterWriteBuf(i2c_slave_address, m_tx_data, 1, I2CM_MODE_COMPLETE_XFER) ;
while((I2CS_SlaveStatus() & I2CS_SSTAT_WR_CMPLT) == 0)
;
byteCount = I2CS_SlaveGetWriteBufSize() ;
sprintf(str, "Slave Received:[%d]", byteCount) ;
print(str) ;
I2CS_SlaveClearWriteStatus() ;
for (i = 0 ; i < byteCount ; i++ ) {
sprintf(str, " 0x%02X", s_write_data) ;
print(str) ;
}
print("\n") ;
I2CS_SlaveClearWriteBuf() ;
prompt() ;
}
}
}
================
Then I could send data from I2CM (Master) to I2CS (slave)
For the details please refer to the datasheet of the component.
Attached is my sample project using CY8CKIT-059.
moto