Author Topic: use analog oscilloscope for checking I2C  (Read 4548 times)

0 Members and 1 Guest are viewing this topic.

Offline Mbakker1996Topic starter

  • Newbie
  • Posts: 6
  • Country: nl
use analog oscilloscope for checking I2C
« on: October 23, 2017, 11:47:47 am »
Hi,

I want to test an I2C bus with a oscilloscope. I can buy an analog oscilloscope from Ebay for $60. but I want to make sure that it is possible to measure I2C frequency with an analog oscilloscope.

I know it is possible with a digital oscilloscope but those are very expensive. (even on Ebay).

Martijn
 

Offline Mjolinor

  • Frequent Contributor
  • **
  • Posts: 328
  • Country: gb
Re: use analog oscilloscope for checking I2C
« Reply #1 on: October 23, 2017, 11:53:42 am »

A better solution would be to buy a logic sniffer or equivalent if you are not concerned with levels.

A 60$ scope will soon wind you up to the point of shortening your life through stress at the inability to show you what you are trying to see.
 

Offline frozenfrogz

  • Frequent Contributor
  • **
  • Posts: 936
  • Country: de
  • Having fun with Arduino and Raspberry Pi
Re: use analog oscilloscope for checking I2C
« Reply #2 on: October 23, 2017, 11:57:19 am »
If you strictly need to analyze I2C data lines, you would be better of to get a logic analyzer like the Salea Logic (there are also a lot of cheap clones to get).
Most devices work with the Sigrok suite: https://sigrok.org/

There is also the Bus Pirate and Logic Sniffer among several other variations of logic analyzers.

If you already have some Arduino hardware, you can build a logic analyzer yourself, there are a couple of instructions on the web.
He’s like a trained ape. Without the training.
 

Offline Gyro

  • Super Contributor
  • ***
  • Posts: 9504
  • Country: gb
Re: use analog oscilloscope for checking I2C
« Reply #3 on: October 23, 2017, 12:00:17 pm »
Such a scope, in combination with a cheap 8 bit logic analyser from ebay (well under $10) could be a useful low cost combination.

You can use the scope to check logic levels, edges, noise etc (analogue domain stuff). The logic analyser in combination with Sigrok open-source software would let you decode the I2C streams and timing (digital domain stuff).
« Last Edit: October 23, 2017, 12:04:26 pm by Gyro »
Best Regards, Chris
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 12860
Re: use analog oscilloscope for checking I2C
« Reply #4 on: October 23, 2017, 12:04:44 pm »
It depends.  A 50MHz or better dual trace delay timebase CRO can resolve I2C transfers well enough that you can pan through the data packet a byte at a time using the delay multiturn control, manually decoding it and writing down the result.  However to do so you need to be able to generate a repeating data packet with stable timing, and preferably a separate signal to trigger on at the start of the packet.  Without control of the master's firmware, if you are unlucky, you don't get to see much except a blur.  You will be able to confirm logic levels and you *MAY* be able to roughly estimate the speed, but that's about it.  OTOH if you are lucky and the master provides a lot of repeating bus activity (e.g frequently polling a sensor), you may be able to get a stable display of the first few bytes of the transfer that you can take measurements from and even decode.

With a single timebase CRO its a lot more difficult. It probably wont have a large enough holdoff range to stabilise the display without moving the variable timebase control from its calibrated position, which leaves you with the situation of being able to see some of the data but not being able to make time measurements.

TLDR:  A CRO isn't the right tool for the job, use a logic analyser with I2C protocol decoder or a DSO.
 

Offline TK

  • Super Contributor
  • ***
  • Posts: 1722
  • Country: us
  • I am a Systems Analyst who plays with Electronics
Re: use analog oscilloscope for checking I2C
« Reply #5 on: October 23, 2017, 12:17:46 pm »
OP wants to measure i2c clock frequency.  Yes, you can do it with a $60 analog scope.  It is most probably going to be 100kHz or 400kHz, the most common i2c frequencies.
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 12860
Re: use analog oscilloscope for checking I2C
« Reply #6 on: October 23, 2017, 12:25:11 pm »
Good luck with that.  If the master only transfers a few bytes a second, you probably wont see anything useable.  If one or more of the slaves uses clock stretching, it can be even more problematic.    OTOH if the transfer is repetitive and frequent a CRO has a good chance of at least giving you the clock speed.
 

Offline TK

  • Super Contributor
  • ***
  • Posts: 1722
  • Country: us
  • I am a Systems Analyst who plays with Electronics
Re: use analog oscilloscope for checking I2C
« Reply #7 on: October 23, 2017, 12:37:33 pm »
We are all making too many assumptions without asking questions
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 12860
Re: use analog oscilloscope for checking I2C
« Reply #8 on: October 23, 2017, 12:43:38 pm »
A logic analyser with an appropriate sample rate and memory depth will be able to capture useful data and tming from any correctly functioning I2C bus that runs at logic levels it supports.  A $60 CRO may or may not show you anything useful, and unless you have other uses for it is not cost-effective.
 

Offline Mbakker1996Topic starter

  • Newbie
  • Posts: 6
  • Country: nl
Re: use analog oscilloscope for checking I2C
« Reply #9 on: October 23, 2017, 12:49:37 pm »
I have 1 master and 1 slave in my example. But there is a high chance that I need a oscilloscope in the future. So I think the best solution is to buy the oscilloscope. But I will also consider to make use of a logic analyser. Does someone have a recommendation for a logic analyser?
« Last Edit: October 23, 2017, 01:53:59 pm by Mbakker1996 »
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11253
  • Country: us
    • Personal site
Re: use analog oscilloscope for checking I2C
« Reply #10 on: October 23, 2017, 05:16:43 pm »
Forget about analog scopes for I2C. You will see something, but only about 5% of what you actually need to debug any problems.

LA can be obtained for $7 shipped. There is no reason to not have one.
Alex
 

Offline Mbakker1996Topic starter

  • Newbie
  • Posts: 6
  • Country: nl
Re: use analog oscilloscope for checking I2C
« Reply #11 on: October 23, 2017, 05:47:27 pm »
Does someone has a good recommendation for a cheap LA?
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11253
  • Country: us
    • Personal site
Alex
 

Offline David Hess

  • Super Contributor
  • ***
  • Posts: 16615
  • Country: us
  • DavidH
Re: use analog oscilloscope for checking I2C
« Reply #13 on: October 23, 2017, 07:13:01 pm »
We used to find the baud rate of RS-232 using an analog oscilloscope all the time; the last time I did it was relatively recently on a GPS receiver.  The problem as has been pointed out is whether the I2C signal is continuous enough to produce a clear display.  It should actually be easier with I2C since it has a separate clock signal to look at.
« Last Edit: October 23, 2017, 07:14:38 pm by David Hess »
 

Offline Mbakker1996Topic starter

  • Newbie
  • Posts: 6
  • Country: nl
Re: use analog oscilloscope for checking I2C
« Reply #14 on: October 24, 2017, 06:35:49 am »
I'm a little bit new with oscilloscopes and I'm wondering of it is possible to 'record' period of time. like only the i2c call and then analyse it. By digital oscilloscope it is possible but I don't know of that is possible by an analog os
 

Offline Mbakker1996Topic starter

  • Newbie
  • Posts: 6
  • Country: nl
Re: use analog oscilloscope for checking I2C
« Reply #15 on: October 24, 2017, 06:37:10 am »
The standard fare is a Saleae clone https://www.ebay.com/itm/USB-Logic-Analyzer-24MHz-8-Channel-UART-IIC-SPI-Debug-for-MCU-FPGA-ARM-/191685084604



thank you for your reply! I'm very interested in the device and going to order it in the couple of days. but the shipping time takes to long.
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 12860
Re: use analog oscilloscope for checking I2C
« Reply #16 on: October 24, 2017, 06:47:35 am »
I'm a little bit new with oscilloscopes and I'm wondering of it is possible to 'record' period of time. like only the i2c call and then analyse it. By digital oscilloscope it is possible but I don't know of that is possible by an analog os
No, not on a standard analog CRO.   There was such a thing as an analog storage oscilloscope, which could hold a single shot trace on the screen for several minutes, but they haven't been made for many years (superseded by the early DSOs),  are pretty rare and most of the surviving ones' CRTs have degraded to the point that their storage mode is no longer functional.
 

Offline abraxa

  • Frequent Contributor
  • **
  • Posts: 377
  • Country: de
  • Sigrok associate
Re: use analog oscilloscope for checking I2C
« Reply #17 on: October 24, 2017, 06:58:47 am »
The standard fare is a Saleae clone https://www.ebay.com/itm/USB-Logic-Analyzer-24MHz-8-Channel-UART-IIC-SPI-Debug-for-MCU-FPGA-ARM-/191685084604



thank you for your reply! I'm very interested in the device and going to order it in the couple of days. but the shipping time takes to long.

In that case, you might want to check out http://hobbycomponents.com/153-testing as they're located in the UK and ship from there.
« Last Edit: October 24, 2017, 07:01:04 am by abraxa »
 

Offline Mbakker1996Topic starter

  • Newbie
  • Posts: 6
  • Country: nl
Re: use analog oscilloscope for checking I2C
« Reply #18 on: October 24, 2017, 07:39:25 am »
I just ordered a LA
 

Offline David Hess

  • Super Contributor
  • ***
  • Posts: 16615
  • Country: us
  • DavidH
Re: use analog oscilloscope for checking I2C
« Reply #19 on: October 24, 2017, 02:55:28 pm »
I'm a little bit new with oscilloscopes and I'm wondering of it is possible to 'record' period of time. like only the i2c call and then analyse it. By digital oscilloscope it is possible but I don't know of that is possible by an analog os

There are two separate problems if you want to see and be able to decode a message:

1. The short persistence of the analog oscilloscope means that the I2C waveform needs to be repeated, usually at 10s of Hz minimum, for an easy to read or even usable display.  An analog storage oscilloscope avoids this problem.

2. If more than one message is present, then a pretrigger is required to select the proper one for display.  In the past I would modify the system to trigger the oscilloscope before the specific message I wanted to see.  With I2C, this is a little easier because of the separate clock; one pretrigger for a whole series of messages can be used and then the delayed sweep feature of the oscilloscope may be used to select which message to display.  The delay time control effectively operates as a scroll wheel and in the past this was how a specific line in a video signal could be selected.  Further, trigger after delay allows this to be done with no jitter in real time unlike a lot of modern DSOs which lack this feature.

If modifying the system to generate a pretrigger is not possible, then it is sometimes feasible to use a word recognizer to generate a trigger on a message preceding the message you want to see.

None of the above applies if you just want to measure bit timing.
« Last Edit: October 24, 2017, 04:38:02 pm by David Hess »
 

Offline nfmax

  • Super Contributor
  • ***
  • Posts: 1560
  • Country: gb
Re: use analog oscilloscope for checking I2C
« Reply #20 on: October 24, 2017, 03:12:22 pm »
Back in the old days, a trick we used to use was to periodically reset the processor & trigger the scope from the reset signal. then use the delaying timebase to display the time period when the message of interest was transmitted - hopefully a fixed number of instructions after the reset. This gives a repetitive display on a non-storage scope. Now? Don't waste your time, get a DSO! You can now buy a brand new one (with a guarantee!) from a big-name supplier for well under £200. Analogue just isn't worth the hassle any more. And a DSO also does far more than a USB logic analyser can.
 

Online tggzzz

  • Super Contributor
  • ***
  • Posts: 19497
  • Country: gb
  • Numbers, not adjectives
    • Having fun doing more, with less
Re: use analog oscilloscope for checking I2C
« Reply #21 on: October 24, 2017, 03:40:38 pm »
I'm a little bit new with oscilloscopes and I'm wondering of it is possible to 'record' period of time. like only the i2c call and then analyse it. By digital oscilloscope it is possible but I don't know of that is possible by an analog os
No, not on a standard analog CRO.   There was such a thing as an analog storage oscilloscope, which could hold a single shot trace on the screen for several minutes, but they haven't been made for many years (superseded by the early DSOs),  are pretty rare and most of the surviving ones' CRTs have degraded to the point that their storage mode is no longer functional.

I have one (a 100MHz Tek 464) that is as easy to use as any analogue storage scope ever was [1]. You can see pictures and movies taken by an acquaintance (i.e. I'm not John Honniball!) at https://www.flickr.com/photos/anachrocomputer/albums/72157679671986765/with/32414861622/

Yes, I will consider selling it :)

[1] i.e. it makes a good advertisement for a halfway decent digitising storage scope :)
There are lies, damned lies, statistics - and ADC/DAC specs.
Glider pilot's aphorism: "there is no substitute for span". Retort: "There is a substitute: skill+imagination. But you can buy span".
Having fun doing more, with less
 

Offline james_s

  • Super Contributor
  • ***
  • Posts: 21611
  • Country: us
Re: use analog oscilloscope for checking I2C
« Reply #22 on: October 25, 2017, 06:43:34 pm »
They also made oscilloscope cameras which could be used to capture a single shot event, but unless you just want to try doing something the old fashioned way it's a lot of hassle for no gain. Analog scopes are really only good for looking at repetitive waveforms, to analyze any sort of digital data stream you'll need a storage scope or logic analyzer.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf