[docs] python-smbus and repeated starts

Roger roger at kistruck.co.uk
Tue Jan 20 22:18:11 CET 2015


	I am a moderately ignorant near-beginner with Python. I have a problem with trying to read a particular sensor chip attached to the i2c bus connections of a Raspberry Pi. The sensor is the MMA8451Q by Freescale Semiconductor; a well-established device with good performance and more features than I am likely to need in a long while. 

I have managed to read a different sensor (ADXL345) on the same i2c bus, using the standard tools available in Linux (I am using Raspbian on the Pi), so I have successfully used a handful of commands from the smbus repertory. I had to learn how to do it by copying from a previous piece of code written by someone else. 

Unfortunately for me, the MMA8451 _requires_ repeated start commands to read its data registers, and I cannot find any documentation that covers it. I have looked at the Python official documentation, and a search for 'smbus' or 'i2c' yields no search results at all. I have spent a good many hours thrashing through Google too, and also Github, and failed to find any useful leads. See : 

<http://wiki.erazor-zone.de/wiki:linux:python:smbus:doc>  and 
<http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/plain/Documentation/i2c/smbus-protocol>  and 

What seems to be missing is anything about the Python SMBus module to explain how it handles the crucial elements of the i2c protocol, and when it uses repeated-start signals in particular. 

It may be that I have not been very clever in finding what is there, but if so I would be glad to know. 

With thanks for any help you can give. 

Roger Kistruck
5 The Limes
Long Melford
CO10 9SX
phone: +44 1787 311165
mobile: +44 7791 185660

More information about the docs mailing list