Using Bus Pirate to Suss Out Registers, commands, etc. on undocumented I2C sensors

Not sure where to direct this question, so I’ll start here. I work a lot with various microcontroller modules from Adafruit, and almost every module they sell - sensors, displays, etc., which utilize either SPI or I2C, all have a library file, in Python, provided by Adafruit, that takes care of handling all the required interfacing in the code between the microcontroller and the sensor/display. I just have to have it as an include in my main code. My issue is that I often encounter MANY sensors and devices, most with I2C interfaces, for which I can find no Python-compatible driver files, and I’d need to write my own. But with insufficient documentation, these sensors are often useless to me. Would your Bus Pirate v5 have capabilities to suss out where the registers are on these unknown devices, so I could write the code I need to successfully use these random sensors (often from Chinese suppliers with Chinese datasheets.) This would be incredibly useful if so… Thanks for your info,

Dave Xanatos

Checkout this functionality:

That looks promising…

Searching for an I2C address is handy, but I think the BP can be very handy in generating “raw” I2C commands, and seeing raw results. You use […] to send raw commands, and can control LSB and MSB, use hex/decimal/ASCII, repeat bytes, add delays, etc. and read bytes,
See the BusSyntax for more info Syntax Reference | Bus Pirate 5 Firmware

I built the bus pirate specifically for probing weird chips. It’s not automatic though, but it can make it much smoother.

My best recommendation for Chinese data sheets is to use your phone to translate them until you get used to the organization. Then it will just kind of be obvious without knowing a ton of characters. I know a handful of characters and it gets me around.

1 Like

I’ve used python scripting to “fuzz” i2c devices with the previous bus pirate. I haven’t needed to do that since I’ve gotten the BP5.

It wasn’t anything fancy; mutate the data out and check the response to see if you get anything unexpected back.

1 Like