This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Specific I2C sequence command

I am trying to read data from a sensor through I2C which follows below particular sequence attached. 

The 1st piece in this sequence is to wakeup the sensor and ends with NACK. The 2nd piece is to send slave address and register before reading data back. 

From before I know I should use nrf_drv_twi_tx(&m_twi, Address, tx_buf, 1, false); command to send the 2nd piece, but I dont know how to send the first piece. Meaning how to send just slave address. 

Please advise. 

Parents
  • Hi,

    NACK is the default response if no slave devices ACK the slave address. You can send a dummy packet with whatever data in the buffer, if the slave is not awake to ACK the address,it should not matter if there is one additional byte sent on the bus. I do not have a logic analyzer available to verify if the master will send out the data byte if it receives a NACK on the slave address. You can also try to set the length parameter to 0, I belive the TWI peripheral will still send out the slave address.

    Make sure that your handle the ANACK event/error in your TWI master application and don't pass this to APP_ERROR_CHECK.

    Best regards,
    Jørgen

Reply
  • Hi,

    NACK is the default response if no slave devices ACK the slave address. You can send a dummy packet with whatever data in the buffer, if the slave is not awake to ACK the address,it should not matter if there is one additional byte sent on the bus. I do not have a logic analyzer available to verify if the master will send out the data byte if it receives a NACK on the slave address. You can also try to set the length parameter to 0, I belive the TWI peripheral will still send out the slave address.

    Make sure that your handle the ANACK event/error in your TWI master application and don't pass this to APP_ERROR_CHECK.

    Best regards,
    Jørgen

Children
No Data
Related