I2C: need to decode -- any software tools?

Discussion in 'General Electronics Chat' started by someonesdad, May 19, 2011.

  1. someonesdad

    Thread Starter Senior Member

    Jul 7, 2009
    I've been asked if it's possible to write some code to decode I2C and similar serial protocol signals. Of course, I assume it is. Here's the task (let's assume the task is to decode some I2C data):

    I'll be given two sampled waveforms that represent the transitions on the data and clock lines of an I2C connection (think of them as some deep scope or logic analyzer traces). I need to decode that data into the stream of information it represents.

    My preference would be to find a chunk of open source software that already does this. The next preference would be to purchase a library to do such a task. My last preference is to write my own code to do this (even though I'd probably get paid to do this), mainly because I think it would be silly to write something that has probably been implemented many times already.

    I have no experience with this stuff. Can anyone recommend some software tools to help with this task?
  2. Triden

    New Member

    May 10, 2011
    This may or may not be what you are looking for.

    Check out SUMP (http://www.sump.org/projects/analyzer/client/). Its a free open source logic analyzer client. The latest version, 0.8, has an I2C decoder. You may be able to modify it to read and analyze already captured waveforms.
    Last edited: May 19, 2011
  3. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    Yeah, it's been done. Google "I2C sniffer" and you will get some useful hits.

    I2C is a bit different then something like an RS-232 interface as the handshaking is build into the serial data stream, and the data packet bytes have various meanings depending on the specific device being talked or listened to. However, all streams start and end the same way with an addressing command and a stop command at the end so you can break the stream up into individual transactions.

    The Wikipedia article on I2C is as good as any.
  4. someonesdad

    Thread Starter Senior Member

    Jul 7, 2009
    Triden: thanks -- I'll take a look at the link.

    Ernie: yeah, I've found a number of such things. However, they're typically hardware-oriented things and I've got a scripting language (python) with a couple of big arrays of sampled data sitting in memory. Thus, I'm hoping to find some python or C code that interprets such information. I found Prodigy Test and sent an email to them; I wonder if there are others who do similar things.

    Here's a link that describes an ISR-based decoding scheme. Maybe I'll just have to write something that simulates that. I'd much rather find an existing open source solution or buy something from someone than spend the programming effort though.