Show Posts
Pages: [1] 2 3
1  Using Arduino / Interfacing w/ Software on the Computer / Re: SUMP compatible logic analyzer code for Arduino. on: September 28, 2014, 02:29:50 pm
I'm not sure the Logic Pirate supports more than basic triggering.  I think it just triggers if any of the trigger enabled pins change state.  I believe via a pin state change interrupt.  While it has a very nice sized buffer at 256k, you have to decide if you need large buffer or more sophisticated triggering.  If you just want a large buffer some of the continuous read over USB types like the Saleae Logic might be better with a capture size limited only by your computer's storage capacity.

The Open Workbench Logic Sniffer (OLS) supports most of the triggering capabilities of an HP (now Agilent) 16550A logic analyzer according to this post. For serious use I do recommend the OLS and a couple of the probe cables.

Of course an Arduino is a good tool for some basic logic analyzer work as long as you work within the limitations.  Client side issues (with decoders for example) will be the same with whatever hardware you use.  Though if some of the issues are related to capture precision the better hardware will help.

Regarding phantom signals I think that is generally some noise / cross talk on the pins issues with the chip.  You can put a 1k or 10k resistor to ground on pins you're not using to pull them down.  You could also use weak pull-down (or up) resistors (say 1M ohm) on all pins, even ones used for data, to help stabilize the signal.  Of course you also might want some current limiting resistors between the Arduino pins and the signal you're measuring as well. 

Your signal does look slightly different after the line decoder pass.  You might try using the clock recovery feature in that decoder if you know the clock rate on your signal.  I don't know that much about the decoders' inner workings as I have only used a couple of them a few times.  If you capture your original signal and save the data and PM me I can take a look at it though I'm definitely not an expert on the client.

2  Using Arduino / Interfacing w/ Software on the Computer / Re: SUMP compatible logic analyzer code for Arduino. on: September 27, 2014, 06:14:23 pm
Hi, I'm glad you're able to use the code.

Regarding triggering, the Arduino logic analyzer supports basic parallel triggers where it looks at the state of each pin and if they match the enabled trigger's values, it starts the capture.  What you're thinking of is a serial trigger where it samples the same pin repeatedly and compares the trigger pattern with the last N samples.  At least that is my understanding.  The Arduino logic analyzer doesn't support serial triggers.  The Open Workbench Logic Sniffer (OLS), available for $50 from Seeedstudio, supports serial triggers as well as more complex triggers.

Essentially you would set a trigger on your data pin by clicking the 'Mask' checkbox for that pin and leaving the value unchecked.  Assuming the pin is pulled high by default. (I don't see the screenshot) That will trigger when that pin is low.  Unfortunately that is all you can easily do.  Once it triggers it will begin sampling until it runs out of buffer.  At 10KHz sample rate that would be about 100ms buffer.  That should get ~93ms of your Manchester encoded data.  If you use an Arduino Mega you can get about 7x that hopefully due to the larger memory for sampling.  The OLS hardware has 24Kbytes of buffer.

Regarding the line decoder, I have only messed with it with the "test device" generated sample.  It seems to generate on channel 2.  If you use the line decoder, setting it to manchester and channel 2, and click analyze, it should generate data on channel 0 and clock on channel 1.   Then set it to non return to zero and tell it data is on channel 0 and clock on channel 1 and hit analyze.  It should decode the data.  I've never tried it with data decoded from the Arduino logic analyzer, but I would be interested in your results or even the data capture out of the OLS client.
3  Using Arduino / Interfacing w/ Software on the Computer / Re: SUMP compatible logic analyzer code for Arduino. on: July 06, 2014, 07:04:32 pm
Cool. I'm glad it is working for you.  You shouldn't need the resistor to disable auto-reset with OLS 0.9.7.   Try it without it and see if it works ok.  Just make sure you select one of the Arduino device types and then try 'show device metadata'.  It should work.
4  Using Arduino / Interfacing w/ Software on the Computer / Re: SUMP compatible logic analyzer code for Arduino. on: June 21, 2014, 01:16:46 am
Hey appreciate the thanks, glad you're able to get some use out of my project.
I have a number of variations of the Arduino now for testing and with the code updates to the OLS client to include my config files I need to cleanup my project a little so there is less confusion about what is needed.  Hopefully that will happen before too long so people picking up my project for the first time aren't confused by somewhat outdated information.

Anyway, regarding using a DUE or getting a real logic analyzer, I strongly recommend the Open Workbench Logic Sniffer (OLS) for $50 from Seeedstudio for more serious work.  The $10 logic analyzer's on eBay tend to be Cypress EZ-USB FX2LP development boards that clone the Saleae Logic firmware or similar.  Then people seem to (illegally) use the Seleae Logic software with these clone boards.  Sadly you end up with a proprietary logic analyzer and software that is essentially pirated.  Not what you really want IMHO.  $50 for the OLS is a great way to go.  The authentic, licensed Saleae Logic package for $149 sounds good based on what I've read about it, but certainly isn't open source or open hardware.

The Logic Analyzers on eBay seem to be based on Cypress EZ-USB FX2LP boards.  These have an 8051 compatible core and decent speed.  In theory it would be possible to create SUMP compatible firmware to replace the cloned firmware being used.  Then the OLS alternative client could be used with it as well.  I might investigate doing that at some point in the future, but no promises.  I think the ATMega328p based code is good enough and really a hardware board like the OLS should be the next logical step.

More likely future work would be incorporating Leonardo changes back into my code versus trying to get a completely different platform working.

Note that the Arduino USB Nano boards on eBay for around $7 should work with my code and can easily be dedicated as a logic analyzer at that price.  It is hard to beat $7 for basic functionality.  I should be getting one in a week or so and will verify it works well.

As I mentioned earlier in this thread I did a proof of concept of an ethernet based AGLA since the OLS client supports talking to a logic analyzer over tcp/ip.  I haven't messed with that code recently, but it was working with a WizNet W5100 based board.  I didn't see much demand for a such a thing, but are a few corner cases it could be useful.  For example helping to debug some sensors or similar in their production location outside or in the shop etc where you can't sit and watch it with your laptop due to environmental concerns like it is cold / hot / up high / uncomfortable conditions etc.  Then sitting at your desk and using the AGLA over the network would be nice.  Due to the ethernet needing the SPI the port used by capture routines needs to be adjusted and tweaked, which I might get to at some point.

Anyway, I will try to cleanup the documentation / code to reflect modern OLS clients and ATMega328 based Arduinos. (And hopefully add ATMega32U4 like Leonardo)  If you have any feature requests that are reasonable or just general suggestions let me know.  Note that the code is doing most of the what it can with the limited hardware already.
Things that aren't really practical or limit the specs too much:
-- Advanced triggers, unless very low sample rate is used. (get a nice FPGA based OLS)
-- Bit stuffing samples for one channel to get 8192 samples.  Again, needs a really low sample rate due to the amount of manipulation needed.  End result is fairly unusable due to low speed.  The Mega is a better solution if you have one, or the OLS (24KB of samples) or the Logic Shrimp (also available at Seeedstudio) which has 4 channels and 256K samples per channel.
-- More channels.  Again, would significantly reduce the sample rate and also the number of samples.
-- More speed.  The fastest we can sample is 5.33MHz and the timing isn't ideal with the OLS client so 4MHz is it right now.  The 5.33MHz rate might be usable with some tweaks with the OLS client or settings.  I'm not sure here, but 4MHz to 5.33MHz might not be worth the effort.  If you really need it faster, the OLS hardware does 200MHz loosely and 100MHz is precise timing.

Some of these features might be nice for an alternative firmware with lower samples rates.  I'm just not sure it is worth the effort for 100kHz or 10kHz sample rates rather than just using the OLS.  One of my goals was to have generally straight-forward code for an Arduino and I think so far I have been able to do it fairly well.

I'm thinking of reorganizing the repository to have separate directories for versions like megaram or ethernet, in addition a main one that supports most boards via #ifdef like currently.  That way test, PoC or alternative versions (like Leonardo or Due or Cypress EZ-USZB) could be on the main branch in their own directories.

Feedback & suggestions welcomed, but no guarantees on getting to them. ;-)
5  Using Arduino / Interfacing w/ Software on the Computer / Re: SUMP compatible logic analyzer code for Arduino. on: February 11, 2014, 03:16:08 pm
How do i open all the channels in Logic Sniffer. I am using windows operating system and i am only able to view one channel as if now.. the channel on pin 8.

What Arduino hardware are you using and what version of the Logic Sniffer client?
You should always see more than 1 channel in the client.  Do you mean you are only seeing 1 channel change, or literally only seeing a single line in the client?
Can you post a screenshot of the client window?   Or PM it to me.
6  Using Arduino / Interfacing w/ Software on the Computer / Re: SUMP compatible logic analyzer code for Arduino. on: January 24, 2014, 08:08:19 pm
What board type do you have selected?  I'm using the 1.0.5 IDE and with either Arduino Uno or Duemilanove w/ATmega328 it verifies with no size issues.

If you're using an ATmega168 you'll need to comment out either the 'captureInline4mhz()' or the 'captureInline2mhz()' call around line 314 or 318.

Can you change the Arduino IDE preferences to show verbose messages during compilation?
Then you could PM me the last 20-30 lines of the logs or a pastebin link.

I might change that part to a #ifdef so it just automatically comments out the 2mhz version on a '168.
7  Using Arduino / Interfacing w/ Software on the Computer / Re: SUMP compatible logic analyzer code for Arduino. on: September 07, 2013, 02:20:39 pm
yes , i realize that . and now it works .
but how i can configure pc software to run continous ??

As barbudor mentioned it doesn't run continously.  There are USB logic analyzers that send the samples real-time across the USB bus and the PC uses its virtually unlimited memory to record millions of samples or whatever.  Those cost real money unfortunately and don't usually come with a nice open source client either.  So it is a trade off, but using SUMP on the Arduino is cheap and easy and you don't need to dedicate the Arduino full time to use as a logic analyzer if you don't want, you can always reload a different sketch.

Here is a great video someone made showing the use of the Arduino generic logic analyzer (AGLA).

It is a great demonstration of looking at the clock, data, latch and 3 outputs from a shift register driven by an Arduino.

You can setup a trigger to start capturing when you see a specific pin toggle.  You can add a button and press it yourself when you need to trigger if you have to, but ideally something in the logic signal you're looking at will be the trigger.  In the shift register demo video he has two Arduinos, one with AGLA and one driving the shift register.  If you added a debug pin toggle somewhere in the code on the non-AGLA Arduino, you could trigger on that pin with AGLA.

That is actually the technique I use to time the sample rates.  I use the OLS (Openbench Logic Sniffer) hardware to watch a debug pin on the AGLA.  When I sample I toggle the debug pin a few times, then turn it on, sample, turn it off.  Since I have a trigger setup on the OLS to watch the debug pin it will start capturing when I initially toggle the pin.  Then I can measure the time between pin on, sample, pin off to see how long the sample took.

8  Using Arduino / Interfacing w/ Software on the Computer / Re: SUMP compatible logic analyzer code for Arduino. on: August 06, 2013, 01:37:35 pm
I've updated the AGLA code ( ) to support 2MHz and 4MHz capture rates.  This was done by using unrolled loops based on some work by Bob Davis ( )

The maximum sample rate at 16MHz is 5.333MHz (3 clock cycles per sample) but the timing doesn't work out right with that clock rate.  You can still get that rate by removing the NOP on the 4MHz rate if you want to experiment.  If you run your ATmega at 20MHz you can sample at 5MHz and it should work pretty well timing wise.  I haven't tried it yet, but hopefully will eventually.  Note this would generally be on your own board or a breadboard setup since the Arduino is clocked at 16MHz.

I settled on 2MHz and 4MHz as being particularly useful samples rates and they appear to be as accurate as the lower rates.  The code size is rather significant now do the unrolled loops.  It just fits on an ATmega328.  If you're using an ATmega168 you will need to comment out either the captureInline2mhz() or the captureInline4mhz() call.  Then the compiler won't link that function in and you'll be fine.  You can also comment out one of the other capture lines but I would say probably commenting out captureInline2mhz() is the way to go as it is the largest and leaves you with 4MHz.

Note that you should really not expect to use triggers with 2MHz & 4MHz since I can't check the trigger conditions at those speeds.  You can use a trigger though, just know that the sample rate for the trigger condition is below 1MHz so if you are toggling something to trigger the logic analyzer make sure the toggle is long enough to get caught.  Once the trigger fires the sampling is done at the faster clock rate.

I've tested it on an Uno and a Mega and it works as expected.  If you test it and run into any problems (besides that slow upload!) let me know by filing an issue on github or posting here.

I also added some commented out code at the end of setup() to turn on timer2 at 100KHz on pin 11.  The code is '#if 0', just set that to '#if 1' to include it.  This is really only useful to validate your setup works with a know signal that is internally generated.  Since it is internal and using the same clock the sample code is using, it should give you a nice accurate 100KHz signal to look at in the OLS client.  I've submitted a pull request to get the new sample rates into the OLS client device profiles in version 0.9.7 but the github repository also has updated device profiles.

9  Using Arduino / Interfacing w/ Software on the Computer / Re: SUMP compatible logic analyzer code for Arduino. on: July 23, 2013, 12:33:21 am
My Arduino Uno R3 arrived today and I was able to reproduce the timeout issue.  Bumping the '' to 2000 took care of it.

For some reason the Uno R3 is slower to respond after reset than my original Uno or older Duemilenove and clones.  I will investigate it a bit further if I get a chance just to see what the deal is.

Anyway I updated the device profile on github and sent a pull request to get the change into the alternate client.  It should make it into OLS 0.9.7 (at RC1 right now) so Uno R3 users should be good once that is out.

Meanwhile can one of you folks that had problems with the R3 try bumping up the (change from 1500 to 2000) and report back?
10  Using Arduino / Interfacing w/ Software on the Computer / Re: SUMP compatible logic analyzer code for Arduino. on: July 13, 2013, 12:52:28 pm
Looks good.  What did the measurement tool calculate?  How did it compare to your Agilent?  Sample at 1MHz for a bit more precision.

The ATmega328 doesn't have much RAM so 1KB is about the limit.  The device profile is configured for only 1KB max, but since there is something odd with it, you're getting more options with the original SUMP device profile.  Now that you know the logic analyzer is working, you might try it with the correct device profile.  You could adjust some of the timeouts as well to see if you can get it to respond properly.

I merged in a patch for basic RLE support, but I haven't spent the time yet fully testing it and getting the timing correct.  It might help you get longer capture times.  You can use triggers as well to ensure you start capture around the interesting bits.

Really if you want larger samples you have a couple of options.  I would suggest the Open Bench Logic Sniffer for $50.  It is a very nice device for the price.  It is not unlimited either but has 24KB worth and supports RLE and advanced triggering.  Another option is a USB device like one from Saleae Logic that streams the samples so you effectively have a buffer only limited by the resources in your computer.  There are trade-offs.  I am biased I guess but I think the Arduino is "good enough" a lot of the time, but the OLS is well worth the $50 versus $300 for another USB model.

If we can figure out why the UNO R3 is finicky I think you will be fine in the short term with this sketch as a logic analyzer.  Several people have used it successfully for interesting projects:

11  Using Arduino / Interfacing w/ Software on the Computer / Re: SUMP compatible logic analyzer code for Arduino. on: July 10, 2013, 04:11:36 pm
Ok, it looks like it worked.  At least you got samples back from the Arduino.  Do you have a signal you can feed to it?  You need to sample at a rate that will show something based on the frequency you are generating.  E.g. if you look at a 10KHz square wave signal, try a 100KHz sample rate initially so you see the transitions.

I think I will order an R3 just to see if I can reproduce some of these issues.
12  Using Arduino / Interfacing w/ Software on the Computer / Re: SUMP compatible logic analyzer code for Arduino. on: June 30, 2013, 02:25:03 pm
Make sure you're not using a resistor to disable auto-reset.  It is not needed with newer versions of the client.

Here are some troubleshooting steps:
0. Make sure serial monitor is closed.
1. Reset Arduino via hardware button. ( you also unplug / replug if you want)
2. Click start capturing button in OLS client.
3. Set to correct com port, 115200bps, device type "original sump device" (do NOT click show device metadata)
4. Click triggers at the top, make sure they are not enabled.
5. Click Acquisition at the top, make sure it is Default, Internal, 500.0kHz, channel groups zero, 1.00kB no test/noise/RLE
6. click capture.
7. note what happens.  if necessary click 'STOP' in OLS client.
8. switch to Arduino IDE, open serial monitor, send '1' enter

Someone else with an UNO R3 reported somewhat similar symptoms and he was able to get it working after a bit.
Try adjusting these three settings: (not all at once) = 1500
device.receive.timeout = 100 = true

You could try 2000 or 3000 for the portdelay, bump the timeout to 500 and try toggling the portdtr.  Exit the client, unplug / replug the UNO, restart the client between settings change.

I would be interested to find out what makes a difference.  I have an original UNO (bootloader updated to the rev 0001) but it works fine for me.  Since I can't reproduce these R3 problems I might just pick up an UNO R3 to test out.  At least if we can't figure out an easy fix.
13  Using Arduino / Interfacing w/ Software on the Computer / Re: SUMP compatible logic analyzer code for Arduino. on: June 23, 2013, 12:24:44 am
A couple of updates.   I had broken triggers with my previous change to PORTD and I've fixed it.  I also went back to PORTB as the default (with PORTD as a #define option) as it seems to work better for me.

Secondly, I've added a branch with a "toy" release of a network attached logic analyzer.  If you have a Wiznet W5100 (only thing I have tested) Ethernet shield you can play around with it with Jawi's OLS client.  Configure your appropriate ip in the sketch, upload it and connect to it on port 1234 from the OLS client.
I'm using PORTD as most of PORTB is the SPI connection to the Ethernet shield.
It is on a branch if you want to mess with it:

It isn't particularly useful, but I suppose there might be a corner case where it helps.  Anyway, check it out, it is kind of fun talking to the logic analyzer via TCP/IP.

Lastly, I uploaded a primitive function generator sketch.  I use it with my logic analyzer testing along with an Open Bench Logic Sniffer.
You might get some use out of it.

One caveat about the function generator, it is setup for a LCD Keypad shield available on eBay.  Look for the "DF Robot" on the silkscreen.
If there is interest I could make a version with a different UI (one button & LED, or serial, or what?) if you want to make suggestions, you can post on github.
You can use the square wave generator (max of 8MHz) as an emergency clock source for an AVR if you need it. smiley
14  International / Français / Re: analyseur logique on: February 25, 2013, 08:08:42 pm
the only critisism i can't say to your project is, because of the need to do modification on the arduino board.

That's why i just write a little piece of code for arduino and processing to have a visualisation of what appen on different wire of my board.

Thanks AKkarol7.  I just wanted to find out if there were any issues I could fix to make my logic analyzer easier to use or more useful.  Making your own tool that does exactly what you need is cool too and part of the fun of learning how things work.

With a recent version of the sketch and client software you do not have to disable the automatic reset feature if you are using Jawi's alternative client.  I will try to improve my README so it is more clear in that area.  You should be able to just upload the sketch and launch the java client to use AGLA.

15  International / Français / Re: analyseur logique on: February 25, 2013, 06:46:27 pm
Je ne parle pas français. Désolé pour les erreurs de traduction.

Je suis l'auteur de l'esquisse Arduino analyseur logique. Si vous rencontrez des problèmes avec l'AGLA ou les fonctionnalités manquantes, j'aimerais obtenir de la rétroaction et de le corriger.

S'il vous plaît comprendre les limites actuelles sont dues à des contraintes matérielles de l'Arduino lui-même, je fais ce que je peux pour rendre l'échantillon le plus rapidement (et aussi profondément) que possible.

Pages: [1] 2 3