Author Topic: What tool do I need / want. I2c debugging / sniffing  (Read 1613 times)

0 Members and 1 Guest are viewing this topic.

Offline TheBrickTopic starter

  • Regular Contributor
  • *
  • Posts: 63
What tool do I need / want. I2c debugging / sniffing
« on: August 19, 2025, 10:21:58 am »
Hi,
I am not quite sure what I am looking for so I will describe the situation that gave rise to the desire.

Context:
At work we had a problem with a i2c device that stopped working in some situations. The set-up was a r-pi running a custom o/s built from yocto talking to a collection of i2c device, one of which was a muC all on a custom board. The problem turned out to be a combination of bus speed, packet size and kernel driver version which I solved. However I was really stumped for a while as I felt like I couldn't see what was going on, on the bus, it was a case of find the magic combo. I wanted to be able to see is anything being sent, it clock being held low? is data being held low? If something is being sent what and how much of a packet?. I got ideas using i2ctools but I wanted to passively sniff the bus ideally. I have heard of bus pirate but I don't think that's what I want as that sound more for a flexible tool for sending / receiving things on various bus? Logic analyser maybe?

tldr:
I think I need something to passively sniff i2c bus and decode.

Reequipments:
  * A tool to sniff the bus passively (I think).
  * Low(ish) cost, there is no company paying for this. I am in the Uk and developer wadges over here are not that hot outside a few niches.
  * Linux and windows compatible (if relevant)
  * Ideally open source in some manor or at least a good attitude to customers nothing cloud based interface, requiring sub scription, must download app.
  * bonus if it is not a one trick pony and could do more than just i2c.
 

Online Psi

  • Super Contributor
  • ***
  • Posts: 12689
  • Country: nz
Re: What tool do I need / want. I2c debugging / sniffing
« Reply #1 on: August 19, 2025, 10:40:01 am »
You need a logic analyzer.  They passively log clock and data lines. Most are USB based so log to your PC for a period of time and then you review the digital logic edges/timing with data decode, or you can export decoded data to excel.

A lot of people really like the Saleae ones, Sadly, but not all that surprising given how useful they are, they have gone up in price and the cheapest one (8 channel) is $500USD.

There are cheaper logic analyzers available on aliexpress but your mileage may vary. Maybe someone has a good recommendation for a cheap one that works.
It really helps to be able to review the pulse timing/data on a PC screen, so I would recommend against getting a small LCD based one, even the scope ones can be a bit annoying to review data on.
« Last Edit: August 19, 2025, 11:43:34 am by Psi »
Greek letter 'Psi' (not Pounds per Square Inch)
 
The following users thanked this post: TheBrick

Offline artag

  • Super Contributor
  • ***
  • Posts: 1554
  • Country: gb
Re: What tool do I need / want. I2c debugging / sniffing
« Reply #2 on: August 19, 2025, 11:09:10 am »
The very cheap ones (eg https://www.ebay.co.uk/itm/176694391820) work fine for I2c, though may struggle with higher speeds. They're based on the same Cypress ezy-usb chip as the early Saleae devices and a heap of other designs. 

These are well supported by the Sigrok software. Other more expensive devices may come with their own software, sometimes copied from Saleae or Sigrok.

There's also one based on an RP2350 which looks good but works in a slightly different way, storing the data internally rather than streaming over USB. It's fairly new and the author is active in supporting it.

I agree with Psi, you will have a lot of data and the ability to pan and zoom freely on a large screen is important.

Some oscilloscopes also have I2C decoding and may offer zooming. One older model, the Yokogawa DL1540, allows for the printing of a very long zoomed-out trace on the built-in printer. This was the first method I used for debugging I2C some years ago! However it's still a short trace compared with a logic analyser and doesn't decode - you have to work it out manually.

The advantage of an oscilloscope over a logic analyser is that it shows up invalid logic levels. These can be difficut to find with a logic analyser because the logic analyser only records a digital value and may not pick up the same value as the device itself. An exception to this is the later Saleae devices which are not just logic analysers but multi-channel oscilloscopes recording actual voltage (at lower capture rates). This partly explains their price.

An older logic analyser such as HP or Tek has some uses but often won't have decode software for I2C and may have rather limited capture length. They're better for wide microprocessor buses and not so useful for I2C or SPI. Newer models will cope but at a cost.
If you want to look into that option I do have an old Philips I'd like to get rid of.

« Last Edit: August 19, 2025, 11:28:00 am by artag »
 
The following users thanked this post: TheBrick

Offline thm_w

  • Super Contributor
  • ***
  • Posts: 9841
  • Country: ca
  • Non-expert
Profile -> Modify profile -> Look and Layout ->  Don't show users' signatures
 
The following users thanked this post: TheBrick

Offline TheBrickTopic starter

  • Regular Contributor
  • *
  • Posts: 63
Re: What tool do I need / want. I2c debugging / sniffing
« Reply #4 on: August 20, 2025, 08:23:44 am »
Thanks guys. That's just what I need, conformation that a logic analyser is what I need to look for and the advantage of pc based for larger capture and view.

Thanks for the extra scope tip and limitation of what the logic analyser will see.

This give me something to start looking into.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf

 

-->