Username:    Password: Remember me
SCANALOGIC
ikalogic's easy to build high performance logic analyzer
By Ibrahim Kamal
Last update: 9/8/08


Here is one project we are really proud of, and we hope that its simple design will encourage you to build your own, and use the provided software to obtain your own logic analyzer for less than 10$.

This device can help you in most of your projects, it's an essential measuring device when it comes to digital electronics.

Those pages will discuss all what you need to know to understand how it works, and build your own, and use it.

1.What is a Logic Analyzer?
You could read the definition on wikipedia, but as you may already know, I have my way of explaining things to beginner!

I would say that a logic analyzer is a device used to view the voltage of "logic" electric signals that are usually too fast to be measured by a voltmeter. A logic analyzer it not exactly like an oscilloscope, as it cannot measure analog voltages. Actually, it can only measure the logic state of a signal, see if it's a 1 or a 0. '0' being Zero volts and '1' being 5V (for classic TTL logic devices).

The main keypoint that makes a logic analyzer better than another is the sampling rate, or the maximum number of samples that can be recorded by second.

From a functional point of view, a logic analyzer records the states of logic signals, usually after some 'triggering condition' is met, then, recorded signals are displayed on a screen for in depth analysis.

2. Introducing Scanalogic
Scanalogic is a simple, yet effective logic analyzer specially designed to be easily built by beginners, so that it can be used for debugging and analyzing their projects.

It can be used at sampling rates as high as 4 Million Samples per second. It has only 4 channels, but that is more than enough for most hobby projects, further more, most communication buses nowadays have very few transmission lines, ranging from 2 to 4, so decided 4 was more than enough.

Scanalogic is a combination of a hardware (figure 2.a) and software application (figure 2.c). As you will see later, the hardware is as simple as it can get: An ATMEGA16 micro controller and a NAND gate! The code to be loaded in the micro controller is provided at the end of this page.

Figure 2.a

The hardware records the samples at the desired sampling rate, then send them to the PC application via the UART port of the microcontroller and the RS232 port of the PC. If your PC doesn't have an RS232 port, as mine, you can still use a USB-RS232 converter cable, as shown in figure 2b.

Figure 2.b

The software is made with visual basic. A setup file is included at the end of the page. It is compatible with windows ME all the way up to XP (or maybe Vista, can someone confirm?).

The Scanalogic software controls the hardware (as you can see, there are no buttons on the hardware) It allows you to setup the triggering conditions, to start sampling, to receive sampled signals, display them, analyze them, and even store them for later analysis.

Figure 2.c
NOTE: The software is actually in beta testing, more functions are coming in next versions like:
- SPI, I2C, UART Decoding
- Saving Screen-shot to JPG file
- Post triggering data sampling.


3. Building the hardware
There are no secrets held for the hardware, as the real power of this logic analyzer comes from the innovating source code, loaded inside the ATMEGA16 microcontroller.
As you can see in figure 3.b, there are only a microcontroller, and a NAND gates IC and all of it resides in an old CDROM power supply box. The DB9 connector for serial communication is firmly glued to the box with an epoxy resin. The whole is powered from the RTS line of the RS232 connection (pin number 4), so there is no need for external power supply (but you may as well use any 5V power supply if

Figure 3.a
your serial port cannot deliver the required current).

As you can see in the schematic below, there are no level shifting IC like the MAX232, but believe or not, most if not 100% of current serial communication hardware is compatible with the approach below, where the signals are simply 'inverted', but not shifted to +/- 12V. (Originally, in the RS232 protocol, a logic 1 is represented with -12v, and a logic 0 is represented by +12V).

Pin 4 of the DB9 connector is used to power the device, as it rises to +12V (theoretically) when a communication is being carried out. The Diode D3 makes sure no negative power supply is applied to the device, and the 5.1V zener diode D4 prevent supply voltage from rising above 5.1 volts. Using the handshaking signals as a power supply is far from being my invention, it have been used in a lot of devices like mice and old external keypads...

Figure 3.b
The probes are directly connected to micro controller. A better approach would be to add buffers to protect the micro controller but, for simplification, I didn't include one.

The crystal oscillator X1 can be anything from 1Mhz to 16Mhz, but remember that the clock frequency of the microcontroller directly affects the maximum sampling rate, according to the following equation:

Max_Sampling_rate = Clock_frequency/4


That is simply because, the most efficient code I could ever write, needs at least 4 clock cycles to sample and store new signals.

D1 is simply a red LED, used to signal if the device is powered up and correctly functioning.

Download the hex file to be loaded into the ATMEGA16 for different crystal frequencies:
- 8 MHz
- 12 MHz
- 16 MHz
(Need hex files for other frequencies? request for it in the forum)


4. Downloading and using the PC side software
Scanalogic software, especially this first version is very simple and intuitive.

After you have plugged the Hardware, the configuration is simply made via 3 steps:
1- Press F2 to chose the crystal frequency at which your microcontroller is running, and to chose the COM port to which the hardware is connected.
2- Press F3 to chose the sampling rate
3- Press F4 to chose the triggering condition

Then you simply need to Press F5 anytime to start the sampling. Note that if you chose a triggering condition, the sampling will only start when this condition is met.


Download the installation file for SCANALOGIC


I hope this article was useful. Any comments and further questions are welcome in the forum below.


Project under construction,
register to the forum to get informed of updates by e-mail.



Discussion (Last 15 posts preview...)
Preview of the last 15 messages discussing this page. Messages are sorted from the newest to the oldest.
Posted by:
sgx
on: 12 Nov 2008
Re: Scanalogic
['Quote ]
Hi All

Ika, I have a question, mabye if you don't have time to develop your PC software, you can share api for this hardware or make functionality (decode spi, itc ect...), to insert plugin or something like that

- btw good job :) I search stuff like that but without any satisfying result
Posted by:
mekanixz
on: 07 Nov 2008
Re: Scanalogic
['Quote ]
im into pic ?C using a custom made programmer and mplab.for avr im not using anything yet,im on the research level,but i really liked your device and im trying to understand some stuff so that i can build it
Posted by:
User avatar
ikalogic

on: 07 Nov 2008
Re: Scanalogic
['Quote ]

Quoting mekanixz: HELLO everyone,im new to atmel products,so i have some questions starting with this: Each time i unplug the device from the pc and i plug it again i have to reprogram the processor?or does it keep the program in memory?
second,does it work ok with a db cable?(serial-to-usb cable)


what software/hardware are you using to program you µC?
Posted by:
mekanixz
on: 07 Nov 2008
Scanalogic
['Quote ]
HELLO everyone,im new to atmel products,so i have some questions starting with this: Each time i unplug the device from the pc and i plug it again i have to reprogram the processor?or does it keep the program in memory?
second,does it work ok with a db cable?(serial-to-usb cable)
Posted by:
migqc
on: 07 Nov 2008
Re: Scanalogic
['Quote ]
Hello All,
Been experimenting in different approaches to get the circuit powered by the usb to rs232 converter , At the moment im using the NAND gate aaproach as proposed on the website, tried to get the power from the DTR line but it seems that the voltage and current drawn but those two devices AVR and NAND make impossible the comunication , its and ON and OFF sometimes it samples the data sometimes not , (using two diodes as circuit regulator,like in the circuit provided by ikalogic).
Then if i change the power to a normal regulator 7805 and power the circuit externally everythings works as a charm , thats a shame i cannot use the DTR lines a power source on my laptop , another solution to solve the problem is attached a USB cable to it and get the 5 V produced by it and then power thecircuit using that approach ,it will be an extra cable connection but it will remove the need of having an external main adapter 110V to 9V or a 9V batteries, Cheers MQ
Posted by:
segu
on: 06 Nov 2008
Re: Scanalogic
['Quote ]
migqc
See the schematic proposed by dinofizz, only 2 diodes in DTR so not much current in DTR is wasted. Also maybe the brand of (max)232 make impact in the current consumption so the RS232 converter can work. Maybe in your experiment too much current drawn in the pseudoDTR. Also there are the USB powered hubs (more current). In my opinion powering the AVR as ika proposed is fine. Maybe some day ika put the code here so we can try with other AVR less current demanding (picopower).
Good luck
Posted by:
dinofizz
on: 06 Nov 2008
Re: Scanalogic
['Quote ]
I myself have not tested the Scanalogic with a laptop and USB-Serial cable, using the DB9 signals to power the circuit.

I have however used a DIY Nokia mobile phone data cable which uses the DTR line to self-power the circuit and it works perfectly with a laptop and USB-Serial cable.

http://www.panuworld.net/nuukiaworld/ha ... s/fbus.htm
Posted by:
migqc
on: 06 Nov 2008
Re: Scanalogic
['Quote ]
Interesting results Segu , thanks for the time spent doing that , by reading the post and the voltage obtained on your desktop pc (RS232 connector), i can easily suspect that volatge levels on new laptops are small on the DTR line and probably even more when you used a resource such as a USB dongle to transform it to a DB9 connector, interesting i tried to power a max 233 from the actual db9 connector and (DTR line) that was giving me a volatge of 8.87 then i used a 7805 to regulated the voltage to 5v but surprinsingly the volatge gets regulated to 3.2 V which is too low to power the MAX 233 device , so i could not have any USART comunication and display of messages thorough teraterm , I believe that the circuit i was using to regulated the voltage did not help that much because i have and led a 220 resistors and 4 100nf ceramic caps and also a diode connected to pin 1 of it , i think it will be better to use less components to achieve better volatge on the 7805 output and finally become 5V , will experiment soon to see if that will work and also use the aproach to regulated the volatge to 5V as used in the project described on the website, If anyone has ever run this circuit on a laptop and using a USB to RS232 (connector ) and got some useful information, please your ideas are welcome , Regards MQ
Posted by:
segu
on: 05 Nov 2008
Re: Scanalogic
['Quote ]
migqc
Curiosity ... as me, like answers. I have 3 RS232, 1in the MB and 2 in a added PCI board. I have a PIV 2.8 Mhz as you see a little outdated as I have RS232 in the MB.
I have at the moment 2 cables connected, the MB and one PCI
Report:
You are talking of the DTR signal. I have Tera term too, but used Bray++ 1.9b (20080315) as it has better control of lines (ie. graphics, GUI).
Connected 1 wire to pin 5 gnd and 1 wire to pin 4 DTR in both used ports.
Measured with my old Micronta DMM.
Measurements (finally!)
Port COM1 +10.63 V and -10.05 V
Port COM4 +11.30 V and -10.74 V
Port COM3 not used (but I can say it will be the same)
Bray++ as I said can control the connection and the lines, ie. I connect RS232 and disconnect, I turn on DTR and turn off DTR without exiting the program.
More questions welcome, answers if I have.
Hope this helps.
Good luck
Posted by:
migqc
on: 05 Nov 2008
Re: Scanalogic
['Quote ]
Just out of interest , i am using a USB to RS232 port on a laptop , i built the system and works perfect ! no problem with that , the only thing i want to do is to implement the concept diode - zener diode as discribed in the circuit (connected to pin 4 of DB9) so i can power the system without the need of an external battery.

I was testing the DB9 socket voltage levels in pin 4 and found out that the voltage was 8.87 volts when a program such as Tera term was open (meaning the COM1 was active) as soon as the program was closed (COM1 inactive) the volatge change to be -9.06V which was weird to me, i believe the volatge levels changes as COM1 is active or inactive perhaps something to be related to the signal protocols working for that particular USB converter, Can anyone do the same experiment but on normal desktop PC (without USB dongle) plain -rs232 DB9- socket connector and tell me the voltages produced?
just iam interested to know the voltage levels on a desktop pc are higher than the ones i have got , meaning i could not power the system in the way i want to be .

Hope someone is interested and willing to help , Regards MQ
Posted by:
User avatar
ikalogic

on: 04 Nov 2008
Re: Scanalogic
['Quote ]

Quoting migqc: EXCELLENT PROJECT!!! Works on windows Vista also the circuit works well with a MAX233 connected to the TX and RX lines ,MANY THANKS


Thanks, It's good to know the project works on VISTA!
Posted by:
migqc
on: 04 Nov 2008
Scanalogic
['Quote ]
EXCELLENT PROJECT!!! Works on windows Vista also the circuit works well with a MAX233 connected to the TX and RX lines ,MANY THANKS
Posted by:
dinofizz
on: 03 Nov 2008
Scanalogic
['Quote ]
Thank you so much for this project. I used to to debug some I2C problems. Life saver!
Posted by:
User avatar
ikalogic

on: 31 Oct 2008
Re: Scanalogic
['Quote ]

Quoting jaja: Hi Ibrahim,
when do think to have an update of the SW, which is able to decode e.g. I2C or SPI?

Thanks,
ja


not before a couple of months. i am in a very tough period now. Later, i'll work on many things that need work on the site...


thanks for you interest :)
Posted by:
jaja
on: 31 Oct 2008
Scanalogic
['Quote ]
Hi Ibrahim,
when do think to have an update of the SW, which is able to decode e.g. I2C or SPI?

Thanks,
ja
You have to be a member to post replies.
Username: Remember me
Register now! it only takes an instant.
Forgot your password?


 
Unless mentioned, all content is written and designed by Ibrahim Kamal, copying is prohibited and unethical
ikalogic.com: Electronics and Robotics related projects.
All content on this site is provided as is and without any guarantee of any kind. We cannot be held responsible for any errors, omissions, or damages arising out of use of information available on this web site.
Creative Commons License
IMPORTANT COPYRIGHT NOTE: Electronics and Robotics Articles by Ibrahim KAMAL are licensed under a Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 United States License.