App note: Reading two bytes of data over I2C

Some I2C sensors and devices store more then one byte of data that needs to be read by a microcontroller. Many of these devices change the data once a stop bit has been received.
Problems might occur if the data is read by the microcontroller in two consecutive 1byte transactions. If so, the microcontroller will send a stop bit between two data transmissions, thus prompting the device to update it’s data and corrupt the second byte.
Here is a app note from Maxim explaining how to properly read two bytes without any data corruption. Instead of sending a stop bit after the first byte is received, a repeated start should be sent by the master, thus insuring no data corruption will occur.
This entry was posted in app notes and tagged I2C, reading 2 bytes, sensor.

Comments
Isn’t this sort of an obvious part of the protocol?
I agree.
It’s not obvious when someone blindly calls an opaque serial API twice to create a 16-bit access from two 8-bit accesses. For firmware developers who code at the lowest level, this sort of thing is easy, but for folks who only write C and don’t read data sheets then it might be an easy mistake.
…and if Maxim went through the trouble of writing the app note, then I would say others (besides hobbyists) are running into the same corruption issue.
Well, if you’re using C functions to interface with an I2C device, you should read the data sheet for the device. Look up the protocol you intend on using… plain and simple. Writing app notes to market towards people who don’t read data sheets seems… stupid.
What I’m saying is that this information is a 10 second Google search.
Google search is always fast and easy when you already know the answer. But if you had a 10-bit ADC that was only failing randomly and infrequently, but otherwise working just fine, then I doubt a Google search on the specific problem would reveal the actual solution. Besides, this one App Note is shorter than any of the multiple data sheets that it is relevant to.
Granted, I have enough experience not to make these kinds of mistakes, so I didn’t learn anything new. Yet this App Note was very popular – more popular than most. So it must appeal to some readers. If you’re not one of them, then fine, go design some awesome hardware and/or firmware!