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
  • Ole, I have not observed this to be sufficient; the repeated start is sent whether this parameter is set to "true" or reset to "false. As the function parameter's description states:

    "If set, the stop condition is not generated on the bus after the transfer has completed successfully (allowing for a repeated start in the next transfer)."

    What I need is the ability to start the "read" command without this command initiating another start. Or perhaps I am thinking about this incorrectly. Is there a way to transfer data packets from the slave device without using the "read" command; can the "write" command be used to get data back?

    A simpler solution would be the best, but I cannot find it and that is why I mentioned the GPIOTE - PPI approach.

Reply
  • Ole, I have not observed this to be sufficient; the repeated start is sent whether this parameter is set to "true" or reset to "false. As the function parameter's description states:

    "If set, the stop condition is not generated on the bus after the transfer has completed successfully (allowing for a repeated start in the next transfer)."

    What I need is the ability to start the "read" command without this command initiating another start. Or perhaps I am thinking about this incorrectly. Is there a way to transfer data packets from the slave device without using the "read" command; can the "write" command be used to get data back?

    A simpler solution would be the best, but I cannot find it and that is why I mentioned the GPIOTE - PPI approach.

Children
No Data
Related