Hi,
I am finding a strange intial nack sending behaviour on my MSP430F5438a.
The master sequence is START -> Slave address+write -> (Slave sends ack) -> Register Addr -> (slave sends ack)-> START->Slave Addr+Read -> (Slave sends ack)-> (Slave sends data)-> NACK -> Stop
When I initially send the I2C engine does not send a NACK. After that it sends the NACK correctly. I have repeated the reading in a loop and it never gives a problem except intially.
Code snippet
inline uint8_t accl_single_read_cmd(uint8_t regaddr) {
char tmpch = 0;
while(UCB1STAT & (UCBBUSY|UCSCLLOW)) {
;
}
send_start(ACCL_I2C_WRITE); //Write
i2c_send(regaddr);
send_start(ACCL_I2C_READ); //Read
set_nack(); //Send NACK.
tmpch = i2c_recv();
send_stop(); //Send STOP.
return tmpch;
}
Initial waveform.
Subsequent waveform (Correct behaviour)
What seems to be wrong?