lpcware

I2C Master Acking after Receive

Discussion created by lpcware Employee on Jun 15, 2016
Content originally posted in LPCWare by elsingc on Mon Jun 22 05:38:23 MST 2015
I am using the LPC810 with the HMC5883L. I have it all working except the receive part. Whenever I go to receive something, it will read in the data, however, there is always a NACK when I want to stop transmission. I believe this is causing the HMC5883L to then want to resend the old data as I cannot get the updated data. My code flow is below.

Load MSTDAT with ((Address << 1) | 1)
Set CTRL to start
uint32_t temp = MSTDAT
set CTRL to stop.

Its very simple. One thing I noticed is that if I read twice, the first byte read is acked, but the last byte is always nacked. I think I am not stopping it correctly. Does anybody know whats up?

Outcomes