use analog oscilloscope for checking I2C - Page 1
Forum section: electronics / beginners

author: Mbakker1996
author_rank: Newbie
timestamp: October 23, 2017, 11:47:47 am
content: 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

author: Mjolinor
author_rank: Frequent Contributor
timestamp: October 23, 2017, 11:53:42 am
content: 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.

author: frozenfrogz
author_rank: Frequent Contributor
timestamp: October 23, 2017, 11:57:19 am
content: 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 theBus PirateandLogic Snifferamong 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.

author: Gyro
author_rank: Super Contributor
timestamp: October 23, 2017, 12:00:17 pm
content: 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).

author: Ian.M
author_rank: Super Contributor
timestamp: October 23, 2017, 12:04:44 pm
content: 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.

author: TK
author_rank: Super Contributor
timestamp: October 23, 2017, 12:17:46 pm
content: 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.

author: Ian.M
author_rank: Super Contributor
timestamp: October 23, 2017, 12:25:11 pm
content: 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.

author: TK
author_rank: Super Contributor
timestamp: October 23, 2017, 12:37:33 pm
content: We are all making too many assumptions without asking questions

author: Ian.M
author_rank: Super Contributor
timestamp: October 23, 2017, 12:43:38 pm
content: 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.

author: Mbakker1996
author_rank: Newbie
timestamp: October 23, 2017, 12:49:37 pm
content: 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?

author: ataradov
author_rank: Super Contributor
timestamp: October 23, 2017, 05:16:43 pm
content: 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.

author: Mbakker1996
author_rank: Newbie
timestamp: October 23, 2017, 05:47:27 pm
content: Does someone has a good recommendation for a cheap LA?

author: ataradov
author_rank: Super Contributor
timestamp: October 23, 2017, 05:49:27 pm
content: The standard fare is a Saleae clonehttps://www.ebay.com/itm/USB-Logic-Analyzer-24MHz-8-Channel-UART-IIC-SPI-Debug-for-MCU-FPGA-ARM-/191685084604

author: David Hess
author_rank: Super Contributor
timestamp: October 23, 2017, 07:13:01 pm
content: 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.

author: Mbakker1996
author_rank: Newbie
timestamp: October 24, 2017, 06:35:49 am
content: 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

author: Mbakker1996
author_rank: Newbie
timestamp: October 24, 2017, 06:37:10 am
content: Quote from: ataradov on October 23, 2017, 05:49:27 pmthank 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.

author: Ian.M
author_rank: Super Contributor
timestamp: October 24, 2017, 06:47:35 am
content: Quote from: Mbakker1996 on October 24, 2017, 06:35:49 amNo, not on a standard analog CRO. There was such a thing as ananalog 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.

author: abraxa
author_rank: Frequent Contributor
timestamp: October 24, 2017, 06:58:47 am
content: Quote from: Mbakker1996 on October 24, 2017, 06:37:10 amIn that case, you might want to check outhttp://hobbycomponents.com/153-testingas they're located in the UK and ship from there.

author: Mbakker1996
author_rank: Newbie
timestamp: October 24, 2017, 07:39:25 am
content: I just ordered a LA

author: David Hess
author_rank: Super Contributor
timestamp: October 24, 2017, 02:55:28 pm
content: Quote from: Mbakker1996 on October 24, 2017, 06:35:49 amThere 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.

author: nfmax
author_rank: Super Contributor
timestamp: October 24, 2017, 03:12:22 pm
content: 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.

author: tggzzz
author_rank: Super Contributor
timestamp: October 24, 2017, 03:40:38 pm
content: Quote from: Ian.M on October 24, 2017, 06:47:35 amI have one (a 100MHz Tek 464) that is as easy to use as any analogue storage scope ever was . You can see pictures and movies taken by an acquaintance (i.e. I'm not John Honniball!) athttps://www.flickr.com/photos/anachrocomputer/albums/72157679671986765/with/32414861622/Yes, I will consider selling it i.e. it makes a good advertisement for a halfway decent digitising storage scope

author: james_s
author_rank: Super Contributor
timestamp: October 25, 2017, 06:43:34 pm
content: 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.