This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

How can I avoid sending a repeated start between TWI write and TWI read?

I am communicating with a temperature sensor (MLX90614), which has flag register. However, in order to read this register, I must send a read sequence without issuing the repeated start between the write and read operations. Here is what I want to do in a step-by-step approach:

  1. Send start
  2. Send the slave address ID with the nWrite bit low (8 bits)
  3. Receive an ACK from the slave
  4. Send out the command to read the flags, 0xF0 (8 bits)
  5. Receive an ACK from the slave
  6. Do not send a repeated start. (Normally, there would be a repeated start here).
  7. Send the slave address with the nWrite bit high, indicating a read (8 bits)
  8. Send out 16 bits of clock to read in the MSB and LSB from the slave, placing ACKs appropriately.
  1. Issue a stop.

I think that I need to use GPIOTE with PPI to get this to work, but do not know how to specify the number of toggles that would be needed to describe the event. And upon describing the event, what action should be taken.

Can someone advise?

Thank you,

Noah

Parents
  • I do not understand this answer! The write function does not have a "no repeat start bit flag"! Here is the prototype, and as you can see, the flag is for either including or not including a stop at the end of the write transaction. But, I have tried both setting and resetting the "no_stop" flag, and this has no affect on the repeated start: ret_code_t nrf_drv_twi_tx(nrf_drv_twi_t const * p_instance, uint8_t address, uint8_t const * p_data, uint8_t length, bool no_stop);

Reply
  • I do not understand this answer! The write function does not have a "no repeat start bit flag"! Here is the prototype, and as you can see, the flag is for either including or not including a stop at the end of the write transaction. But, I have tried both setting and resetting the "no_stop" flag, and this has no affect on the repeated start: ret_code_t nrf_drv_twi_tx(nrf_drv_twi_t const * p_instance, uint8_t address, uint8_t const * p_data, uint8_t length, bool no_stop);

Children
No Data
Related