4 Replies Latest reply on Jun 3, 2019 7:20 PM by MoTa_728816

    I2C master couldn't send data after received NACK?

    shyuc_4247356

      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?).

        • 1. Re: I2C master couldn't send data after received NACK?
          BragadeeshV_41

          Hi shyuc_4247356,

           

          When a I2C master receives a NACK, a STOP condition is generated and the data wouldn't be transmitted.

           

          Regards,

          Bragadeesh

          1 of 1 people found this helpful
          • 2. Re: I2C master couldn't send data after received NACK?
            shyuc_4247356

            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?

            • 3. Re: I2C master couldn't send data after received NACK?
              JoMe_264151

              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

              • 4. Re: I2C master couldn't send data after received NACK?
                MoTa_728816

                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.

                000-schematic.JPG

                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[i]) ;

                                print(str) ;  

                            }

                            print("\n") ;

                            I2CS_SlaveClearWriteBuf() ;

                            prompt() ;

                        }

                    }

                }

                ================

                 

                Then I could send data from I2CM (Master) to I2CS (slave)

                001-TeraTerm-log.JPG

                For the details please refer to the datasheet of the component.

                 

                Attached is my sample project using CY8CKIT-059.

                 

                moto