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
  • If you look in the MLX90614 datasheet at pages 14 and 15 you will see how the bus protocol looks like for a read or write. If you look closely you will notice that what you want for a sequential WRITE READ is to send a repeated start condition (the READ will produce it) but you do not want to to issue a stop condition after the WRITE.

    Your step 6 is wrong. You do want a start condition. What you don't want is a stop one before de read.

Reply
  • If you look in the MLX90614 datasheet at pages 14 and 15 you will see how the bus protocol looks like for a read or write. If you look closely you will notice that what you want for a sequential WRITE READ is to send a repeated start condition (the READ will produce it) but you do not want to to issue a stop condition after the WRITE.

    Your step 6 is wrong. You do want a start condition. What you don't want is a stop one before de read.

Children
No Data
Related