Miniature 4-channel logic analyzer on avr. Improvement of logic analyzer from China. Type of printed circuit board and location of components

Although occasionally, there is a need to track what is happening on some logical lines, and synchronously on 4-8. I have long wanted to have a logic analyzer (hereinafter referred to as LA) for these purposes, and finally got around to it.
In short, for the impatient - you can take it. Fully complies with the stated characteristics, the software is quite usable. More details - under the cut :)

What is a logic analyzer and what is it for?

In short, this is something like a very crude multi-channel oscilloscope. Very rough - it shows only two levels, 0 and 1, that is, whether the observed signal exceeded a given level or not. That’s why it’s called logical, its purpose is to observe logical signals, that is, logical zeros and ones.
This may be necessary, for example, when debugging some kind of interface with several lines - working with memory, synchronous control of something, multi-wire interfaces, etc. It is also used in reverse engineering, when you need to study the operation of a device, determine the communication protocol used, and even get a dump of data transmitted, for example, via a synchronous UART.
Many aircraft, in addition to directly recording signals, can decode them using certain protocols, although this is not a mandatory property of the aircraft. Particularly sophisticated ones can even automatically determine the protocol used with sufficient confidence, but this already depends on the software included with the aircraft.

Delivery

It arrived instantly - I ordered it on March 29, and on April 11 it was already in my department. It came by regular mail, was packed in a standard yellow bag with a bubble wrap. Nothing extraordinary :)

Specifications from the seller's page

Peculiarities:
- small and light
- maximum sample frequency: 100MHz on 3 channels, 50MHz on 6 channels, 32MHz on 9 channels, 16MHz on 16 channels
- large volume of saved samples, compression support
- built-in PWM generator
- USB2.0/3.0 compatible
- powerful and easy to use software
- support for automatic online updates
Characteristics:
- number of channels: 16
- maximum sampling frequency: 100MHz
- measurement bandwidth: 20MHz
- minimum captured pulse width: 20ns
- maximum size of saved samples: 10G/channel
- permissible input voltage: -50V / +50V
- input resistance and capacitance: 220KΩ, 12pF
- adjustable trigger level: -4V ~ +4V, step: 0.01V
- number of PWM generator channels: 2
- PWM frequency range: 0.1 ~ 10MHz
- PWM generator frequency setting step: 10ns
- PWM generator pulse width adjustment step: 10ns
- PWM generator output voltage: +3.3V
- output resistance of the PWM generator: 50Ω
- standby consumption: 100mA
- maximum current consumption: 150mA
- dimensions: 95mm * 55mm * 23mm
- supported operating systems: Windows XP, Vista, Windows 7/8/10(32/64bit)
- supported standard protocols: UART/RS-232/485, I2C, SPI, CAN, DMX512, HDMI CEC, I2S/PCM, JTAG, LIN, Manchester, Modbus, 1-Wire, UNI/O, SDIO, SMBus, USB1. 1, PS/2, NEC InfraRed, Parallel, etc...

Equipment

The kit consisted of two packages - one contained a USB cable, the other contained the analyzer itself with all its accessories:

The cable looks very good, thick, but quite soft. I have nothing to estimate the cross-section of the power wires in it, and this is not important given the declared consumption of the analyzer. But its softness is a big plus when working with such a small and light box.
Among the essentials were: the analyzer itself, three combs of nine wires of different colors, two combs of two wires each, 20 clips, a disk with the program and a piece of paper with the address from where to download the latest software:


Here's a larger piece of paper:

The analyzer itself is made in a nice case with a completely original design (compared to the boring square boxes into which the Chinese mold everything they can). Although it seems that Gainta had one like this among the standard cases... Nevertheless, it looks very good. Everything is done very carefully, there are no unnecessary gaps anywhere, nothing is warped :)
The front nameplate indicates the model name, provides brief characteristics and illustrates the purpose of the input connector pins. In addition, there is an indicator showing the status of the analyzer - when idle it smoothly lights up and goes out, and blinks frequently during sampling.
At one end there is a 20-pin input connector - 16 channels, two grounds and two PWM generator outputs. At the other end there is a USB connector:





The kit includes three combs of 9 wires and two of two wires. If you can still come up with something with two-wire ones - for example, one for the ground, the second for two channels or for a PWM generator, then why THREE large combs is not clear... Not otherwise, one of them is a spare :)

When connecting two nine-pin combs, we get all 16 channels and two grounds. The length of the wires on all combs is 20 cm, all wires end in heat-shrink-insulated “mothers” for connecting clips. On each comb, one wire has white heat shrink - it is assumed that this is ground, so that it is more difficult to confuse, the rest have black heat shrink:

Clips - exactly 20 pieces. That is, you can use them to connect all 20 pins of the input connector - 16 channels, 2 grounds and 2 PWM generators. It’s unlikely that this will ever be needed, but it’s a plus for the Chinese for not being greedy :) The colors of the clips do not suffer from particular variety, unlike the wires:


On the other hand, if you show minimal care, you may not confuse anything by looking not only at the clips, but also at the wires connected to them.
The usual tetrahedral pins stick out from the back of the clips, like on IDC connectors:


The “mothers” of the wires fit onto these pins quite tightly and do not show any desire to jump off; the connection is quite reliable.
Elementary clip device:




There are no locks or latches, the back simply pulls together and the inner plate comes out after a 90 degree turn. The pin is simply soldered, which is good news in terms of maintainability :)
To connect to the wire, you need to press on the back, and a miniature clip comes out of the spout and opens. The back part is released and, under the action of a spring, the clamp goes back in, closing at the same time:




It holds the wire confidently, both quite thick, about 1.5mm, and thin, about 0.3mm:




In general, these clips do not shine with quality, but they are quite functional in most cases.

Analyzer operation, software

First, we must immediately clarify one point: this analyzer does not have its own memory; all samples are immediately transferred to the computer, where they are saved. True, in the characteristics there is a mention of compression, so, most likely, it does not stupidly transmit 100 megabits per channel at a sampling frequency of 100 MHz. However, at high frequencies it is very demanding on the quality of the USB channel. Ideally, the root hub to which the analyzer is connected should not serve any other clients. For example, for me it worked at full speed only in the connector on the front panel of the computer. But on a netbook it was never able to provide 50 MHz for 6 channels, although it already worked for 5 channels, and provided 100 MHz for three channels.

So, software. Initially, I didn’t pay attention to the piece of paper that contained the address of the site with the software, so I took out an external DVD from the bins and honestly tried to install the program from it. The program was installed, but the drivers did not want to install (Windows XP). After searching on the Internet, I went to this site indicated on the piece of paper and downloaded a slightly more recent version of the program from there. Although the drivers in it seemed to be the same, they installed normally from the new version and the analyzer came to life :)

The program interface is very simple at first glance (and at second glance too, to be honest). At first, it’s not even clear how you can do anything useful in it at all :) But as you get deeper, respect for it begins to grow :) In general, I got the following impression from the program: completely unobtrusive, nothing superfluous, but quite sufficient for most tasks. There are also minor flaws, of course, but they do not spoil the impression too much.
This is what the program window looks like:


With quick clicks you can adjust the sampling frequency and depth (number) of saved samples:


Selecting higher sampling rates will automatically limit the number of available channels.
In the channels themselves, you can choose for each of them its name, location, and vertical size. For one of the channels, you can set the trigger condition - on the edge, on the fall, on the high level, on the low level, or without a trigger. If the trigger was previously installed on another channel, it will be reset there, that is, the trigger can be installed on any channel, but only on one.
In the general settings, you can remove unnecessary channels and set the boundary voltage, relative to which zeros and ones will be counted:

I had a handkerchief on hand in which only SPI and USB could be found, so I decided to look at them. The screenshots will show already configured channels, but initially there is no data on the signals and the channels are simply named - Chanel 0, Chanel 1, etc.
I connected the first two channels to USB, the next 4 to SPI and launched the analyzer. Here's what I got overall:


This is all 2 seconds of observation :) Now you need to connect decoding. Select the desired protocol from the list:

And a window for setting up this protocol appears.
For USB:


For SPI:


As you can see, SPI has quite rich settings that allow you to view this protocol in all its manifestations.
After assigning channels to protocol signals, the program offers to automatically rename the channels according to the names of the signals, this is exactly what I have already done in the screenshots. And now, at a sufficient magnification, data according to the protocol will be shown above the graphs. For example, here is one of the USB frames:


As you can see, the program not only shows the numerical values ​​of the transmitted bytes, but also their intra-protocol meaning - CRC, SYNC, ACK, etc. True, there are places that the program and I did not understand; it seems that the USB speed slows down sharply at some moments:

And here is a piece of the SPI exchange:

This is what it will look like in the file:

In addition, you can save not samples, but decoded protocol data. Here, for example, is a piece of a saved CAN exchange in my car (unfortunately, I didn’t take screenshots):
Time [s],Packet,Type,Identifier,Control,Data,CRC,ACK 0.0002935s,0,DATA,0x0591,0x08,0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00,0x284A,ACK 0.0016248s,1,DATA,0x0 5D1, 0x02,0x10 0x00,0x0249,ACK 0.0023359s,2,DATA,0x0635,0x03,0x00 0x00 0xFD,0x0D93,ACK 0.0033871s,3,DATA,0x0470,0x08,0x40 0x01 0x00 0x4 6 0x00 0x00 0x00 0x1F,0x5D2D,ACK 0.0046378 s,4,DATA,0x0531,0x04,0x01 0x40 0xF0 0xB1,0x40D3,ACK 0.005489s,5,DATA,0x05C1,0x04,0x00 0x00 0x00 0x20,0x0AA2,ACK 0.0063502s,6,DATA,0x 065F,0x08,0x01 0x5A 0x5A 0x5A 0x36 0x31 0x5A 0x43,0x3840,ACK 0.0075009s,7,DATA,0x0651,0x08,0x80 0x02 0x50 0xAF 0x38 0x57 0x00 0x00,0x50D4,ACK 0.0086 621s,8,DATA,0x0621,0x08,0x20 0x2C 0x69 0x18 0x81 0x64 0xFD 0x00,0x4FE1,ACK 0.0233258s,9,DATA,0x0291,0x05,0x00 0x00 0x00 0x00 0x00,0x1DE1,ACK 0.0333432s,10,DATA,0x03E1,0x08,0x20 0x00 0x30 0x01 0xA2 0x00 0x84 0x00,0x50DB,ACK 0.0432946 s,11,DATA,0x03C3,0x08,0xAB 0x00 0x00 0x00 0xA8 0xF0 0x00 0x64,0x0F7B,ACK 0.0444855s,12,DATA,0x040C,0x08,0x00 0x01 0x01 0x01 0x00 0x00 0x00 0x00,0x290F,ACK 0.053637s,13, DATA,0x0470,0x08,0x40 0x01 0x00 0x46 0x00 0x00 0x00 0x1F,0x5D2D,ACK 0.0548882s,14,DATA,0x0531,0x04,0x01 0x40 0x00 0x41,0x191A,ACK 0.0632503s,15,DATA,0x0291,0x05,0x00 0x00 0x00 0x00 0x00,0x1DE1,ACK 0.0666019s,16,DATA,0x0497,0x08,0x00 0x00 0x00 0x00 0x64 0x00 0x00 0x20,0x501A,ACK 0.0733737s,17,DATA,0x0 151.0x04.0x00 0xE0 0xB0 0x50.0x5718,ACK 0.0833265 s,18,DATA,0x02C1,0x06.0x00 0x00 0x00 0x00 0x06 0x00.0x5677,ACK 0.0843872s,19,DATA,0x0359,0x08.0xB8 0x01 0x00 0x00 0x00 0x2B 0x4 0 0x00,0x4875,ACK 0.0856485s,20,DATA, 0x035B,0x08,0x08 0xB4 0x0C 0xB5 0x0B 0xFF 0x02 0x80,0x157E,ACK 0.0868492s,21,DATA,0x0369,0x08,0x3F 0x00 0x00 0x00 0x00 0x00 0x 00 0x00,0x45C9,ACK 0.0881104s,22,DATA,0x0381,0x06, 0x01 0x00 0x00 0x00 0x00 0x00,0x18D3,ACK 0.0892516s,23,DATA,0x0397,0x08,0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00,0x4293,ACK 0.09 05824s,24,DATA,0x03B5,0x06,0x00 0x00 0x00 0x00 0x00 0x00 ,0x007C,ACK 0.0916936s,25,DATA,0x0457,0x03.0x01 0x40 0x00,0x6539,ACK 0.0925447s,26,DATA,0x04B9,0x06.0x00 0x00 0x00 0x00 0x00 0x00 ,0x11A3,ACK 0.0936154s,27,DATA, 0x0400,0x08,0x0C 0x01 0x09 0x05 0xAC 0x00 0x00 0x00,0x3DDD,ACK

What else do you have? When moving the cursor over the channel graph, the width of the current pulse, period, frequency and filling are automatically shown (relevant for PWM). You can display two or three markers and drag them along the chart, and they will be attracted to the nearest fronts and downturns. Information about the exact time of the marker and the time interval between them will be displayed on the right:


Here the markers are located at the beginning of USB frames, which, as is known, follow every millisecond with fairly high accuracy, which the analyzer confirms. Or rather, it confirms its fairly good accuracy :)

PWM generator

Well, everything is simple here. It is there, both channels, everything works. You can quickly turn each channel on and off directly in the main window at the top by clicking on the corresponding inscription (PWM1 PWM2). Green - active, red - disabled. The generator settings are called up in a separate window:


I don’t even know what else to say about him :)

Entrails

The structure, as I suspect, is classic - input matching, trigger comparators, FPGA and controller with USB. I generally suspect that this is a clone of the same Saleae :)








The second side of the board is completely empty.
Everything is very neat, no snot, unwashed flux, etc. Internalities do not disturb the harmony of appearance :)

Bottom line

I liked the device. Everything that is stated in it works. The software made a very pleasant impression. To be honest, I didn’t even expect such work from the Chinese :) There are drawbacks, but they are minor - I would like, for example, to assign different colors to signals. But this is more of a nitpick.

When buying all sorts of Chinese electronics for my “crafts,” I often encounter the problem of a poor description of the work,

The topic of today's article is the use of a cheap Chinese logic analyzer purchased on Aliexpress.

What is a logic analyzer? This is such a device... for logical analysis))) A film with Robert De Niro immediately comes to mind

Why is it needed? Well, of course, engage in logical analysis))). Or rather, by analyzing the logical levels of different microcontrollers and their peripherals. What is commonly called reverse engineering.

Characteristics

  • Software compatibility with Saleae Logic 8
  • Number of digital inputs - 8
  • Two indicators - power and status of logical inputs
  • Input impedance 100KOhm, input capacitance 5pF
  • USB Powered
  • Supported sampling rates:
  • 24MHz,16MHz, 12MHz, 8MHz, 4MHz, 2MHz, 1MHz, 500KHz, 250KHz, 200KHz, 100KHz, 50KHz, 25KHz;
  • Number of stored values ​​of one measurement - 10000

On one side there is a 10-pin connector and pinout on the body

With another Mini USB for power and connection to a computer

Entrails

Inside the case there is a board containing a microprocessor with a high-speed USB interface CY7C68013A from CYPRESS, an EEPROM ATMLH432 and a bus driver LVC245A from NXP.

At the analyzer input there are 100 Ohm current-limiting resistors, 100 KOhm pull-up resistors and 5 pF capacitors. Everything is honest, as in the description.

Connection

To connect the analyzer, the kit includes 10 connecting wires for pin contacts. I immediately bought these clip-on clips.

The quality of the clamps is very mediocre, but good clamps will cost more than the analyzer itself

Software

This is perhaps the most interesting thing about this analyzer. It comes with native software from Saleae Logic.

Versions are available for OSX, Linux and Windows in 32 and 64 bits.
Saleae Logic 1.2.3 under Windows 7 worked with half a kick, the software started, the hardware was recognized, despite the “Beta” version.

Interesting features in software from Saleae Logic

Trigger for recording a logical sequence on each channel

  • To change the logical level to “0”
  • To change the logical level to “1”
  • For a positive impulse of a given duration
  • To a negative pulse of a given duration

Calculation of statistical readings based on the current measurement

Decoding protocols: Async Serial, I2C, SPI, Hide, 1-Wire, Atmel SWI, BISS C, CAN, DMX-512, HD44780, HDLC, HGMI CEC, I2S/ PCM, JTAC, LIN, MDIO, Manchester, Midi, Modbus , PS/2 Keyboard/Mouse, SMBus, SWD, Simple Parallel, UNI/O, USB LS and FS

Logging using decodable protocol

In addition, this analyzer can be flashed with software from USBee

Let's do some analysis

I was just figuring out connecting the DYP-ME007Y ultrasonic sensors, which look absolutely identical, but work completely differently.

If one works exactly according to the datasheet: a short pulse on the “trigger” triggers an ultrasonic pulse and the distance is measured by the duration of the echo. Then the second and third (with a blinking LED) approximately once every 100ms, without any external kicks, measures the distance itself and sends it at a speed of 9600 in the form of four bytes (including the checksum). Saleae Logic allows you to enable decoding of a serial bus signal into a sequence of bytes. Sensors of the second type work perfectly with the “TRIG” output disabled, although they may be waiting for some command at this input, but even a magic device will not show this.

Next, you wanted to look at the PWM signal of Atmegi 168? I turned on all six channels supporting PWM at different levels and was surprised to find that the frequency of two PWM channels differs from the other 4. Are different timers involved?

What's on my data bus?

The magic device and the program normally decoded the sequence output to the LEDs. Even the colors of the LEDs appeared.

There are no problems with analyzing the I2C bus either. The software coped with decoding normally. You can see write packets to registers when the TM1637 display driver is running

A 315 MHz RF receiver connected directly to the analyzer received a signal from the radio switches and issued a Manchester code. After selecting the speed, the Manchester code is converted by a smart program into a sequence of bytes.

I wonder, what about the accuracy of measuring time intervals? I didn’t have an exact pulse generator at hand, but Arduino tone(1000) at 1000Hz

and tone(20000) at 20KHz give a fairly accurate result.

To test the high frequency, I quickly assembled a generator based on the NE555. We managed to squeeze 8 MHz out of it. The analyzer absorbed this frequency normally. It was not possible to test it at 20 MHz, but 8 is also a very good result for such a cheap piece of hardware.

A short summary

A logic analyzer is a very necessary and useful thing for those who are engaged in digging up Chinese peripherals for microcontrollers (Let's call it nicely - reverse engineering)
Among the advantages of this piece of iron I would like to note:

  • Attractive price
  • Compatible with quite convenient Saleae Logic software
  • Input protection in the form of LVC245A bus driver
  • Small dimensions

I didn’t find any obvious shortcomings in this piece of hardware. I wish I had purchased a logic analyzer sooner - how much time I would have saved on so many projects. Undoubtedly, for some, the capabilities of this piece of hardware will not be enough. There are a lot of more sophisticated models, but the price of $100-200 makes these devices much less affordable for radio amateurs.

Shall we analyze anything else?

1. Introduction:

This logical analysis The ator is designed for recording, issuing and analyzing various sequences of pulses and sequential protocols with a given period. Taken for the hardware multiprogrammer on FT232

2. Short description

The analyzer has 7 input/output channels, which are connected to various devices under study at the user's discretion.

Channels 1-5 correspond to input/output. These channels can be output or input depending on the channel setting. Channel 5 is not routed to any connector, but has a contact pad on the board.

Channel 6 – input only. This channel is used in conjunction with channel 1 and serves to simulate bidirectional input/output, for example, as in the I2C bus, that is, the direction of transmission of the channel changes as the protocol operates. The output data goes to output 3, and the input data goes through channel 6. See “I2C protocol implementation” for more details.

Channel 7 is output only. This channel on the programmer is implemented as a powerful 12V output. For example, it was used as backlight power when working with the display from Nokia 6100 (see examples of use)

On the left side of the program working window there are settings for the analyzer ports - these are:

  • baud rate (BoudRate)
  • channel inversion (check “ N.E.G."
  • port direction ( IN/OUT)
  • size of the output array (size up to 65kbit is allowed)

In the central part of the program window there is a graphical display of the status of the channels in the form of a time diagram. And at the bottom of the field there is additional information, which displays the nuances when using the various selected analyzer modes.

On the right side of the program field there are controls for the simulated protocols. Available:

  • protocol selection drop-down menu
  • 7 drop-down menus (per channel): select channel assignment and protocol signal
  • protocol data inversion (not to be confused with port inversion)
  • window for data entry (to set the numerical sequence of the protocol)

3. Management anddata input.

Left mouse click sets the cursor to this location on the waveform panel without changing the state of this bit.

Right click on the waveform panel, places the cursor at this location and changes the state of the bit at this location.

In addition to entering data with the mouse, you can enter it from the keyboard. After pressing the “0” or “1” key, 0 or 1 is entered in place of the cursor, respectively. Also, for convenience, the function of the “0” button is duplicated to the “2” button, that is, when you press the “2” key, 0 is entered.

Array data entry(for the record only). The protocol sequence can be entered in decimal (1 34 987), binary (0b100 0b101010 0b1111111111111) and hexadecimal (0xFA 0x 12C 0x 1a 2cb ). Data is entered separated by spaces. It is also possible to mix data formats (123 0b1010 0x12aB).

The data is entered followed by an increment of the address. When the array boundary is reached, its size will increase. Maximum data array size – 65 kbit

Entering data by file. To enter data by file, you must create a file with any extension, for example, txt. Free format.

You can separate numbers in a file with a dot, comma, or space. Explanations in the file are separated by semicolons “;”.

Example file contents:

123 343, 234 ; here are the explanations after the semicolon

0x12F, 0b10101010 ; and so on.

Driver for the analyzer.

The analyzer uses special functions of the FT232R, for which you must install the special driver FTD 2XX. Installing a regular COM port is not suitable. It is advisable to take the driver from the manufacturer - for example.

4. Analyzer connection:

The appearance of the analyzer is shown in Figure 2.

J 1– power supply jumper (Vcc). Has 4 states: 1.8V, 3V, 5V and external power supply

XT1– miniUSB. PC connection.

XT 2– interface connector for connecting the analyzer to the test subject. Has 10 contacts:

1 channel 1 (input/output)
2 power output ports (Vcc) (depending on the state of the power jumper, the power will be input or output)
3 Cbus 4 is not used. But you can output the frequency 6,12,24 or 48 MHz (for more details, see “using Cbus”)
5 channel 2 (input/output)
7 channel 3 (input/output)
9 channel 4 (input/output)
4,6,8,10 total

XT3– interface connector for connecting the analyzer to the test subject. Has 10 contacts

1 power output ports (Vcc) (depending on the state of the power jumper, the power supply will be input or output).
3 channel 3 (input/output)
5 channel 4 (input/output)
7 channel 6 (input only)
9 channel 7 output 12V signal!!!
2,4,6,8,10 total

J2– jumper for 2 positions. Changes the function of channel 6.

position 1-2 change channel 6 from Vcc to 12V
position 2-3 change channel 6 from 0V to 12V
position 1-2 is used in the programmer to generate the MCLR signal when flashing PIC controllers.

Channels 1-5 are inputs by default and are in the third state (Z state). When a channel is set to output, it will only be output while transmitting.

Each channel has 300 ohm current limiting resistors.

Channel 6 is always the output. The default status is “0”.

5. Using the Cbus signal (XT2 connector pin 3)

This signal is not displayed in the analyzer because it is not synchronous with output signals and has a frequency higher than the output pulses. Not enabled by default.

Frequencies of 6, 12, 24 and 48 MHz can be output to this pin. This is done using a special MProg utility, you can take

6. A brief description of what to do to submit a frequency to Cbus:

  1. install the Mprog utility.
  2. select device search by clicking on the magnifying glass, or in the Device->Scan menu, after which the utility finds the device and displays its PID, etc.
  3. In the Tool tab, select the Read and Parse function, that is, we read the current settings and display this on the display.
  4. open the bookmark FT 232 R (if it did not open itself), after which 2 fields open. Invert rs 232 signzl (this does not concern us, since the analyzer program manages these signals in its own way) and the field I/O Controls.
    The I/O Controls field has 4 submenus C1-C4.
  5. select menu C4. These are the additional functions of the Cbus4 signal. Of all the proposed functions, we are interested in CLK6, CLK12, CLK24 and CLK48. Everything should be clear from the names of the functions J . The remaining functions have no effect (more precisely, when selecting them, it is not possible to predict the state of this pin), since they are designed to work in COM port mode.
  6. In order for FT232R to use the selected function, you must save the project (without this it will not work), this is how this utility is written.
  7. After saving the project to disk, you can reprogram our FT232R. The lightning button is activated. After pressing it M prog will write our settings into the chip.

7. How to describe and use your own protocol

To create a protocol description, you will need to write your own INI file. I recommend copying one of the existing files and changing it. Let's take the file SPI_9BIT as an example. Explanations in these files must be indicated on separate lines!!!

;Settings header in this section of the file specifies specific protocol settings:


;number of lines in the protocol. There are 4 of them in this one
num_lin = 4
;below the lines are listed by number and their names are indicated
lin1 = MOSI
lin2 = MISO
lin3 = SCK
lin4 = SS
;number of transmitted bits
bits = 18
;add. information, it will be displayed in the additional information window.
waring = channel 6 is tied to channel 1 in hardware. The baudrate is divided by 2, since the clock is transmitted in 2 clock cycles
;protocol header. The sequences used in the protocol will be described below.


SS = N N N N N N N N N N N N N N N N N N N
SCK = N O N O N O N O N O N O N O N O N O
MOSI = 0 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8
MISO = N N N N N N N N N N N N N N N N N N N

In this section, the bit number 0 1 2 14 34, etc. is indicated as the transmitted bits. As a transmitted 1, write O (from English One), as a transmitted 0, write N (i.e. Null).

IMPORTANT: When describing a protocol, there may be a difference in the number of bits specified in num_lin and those described in the protocol section.

After you have corrected or written the INI file, you need to add an entry to the protocol.lst file. so that the program can find and use the new protocol.

8. An example of using the analyzer to analyze the I2C bus

First, we connect the analyzer to the I2C bus (the device under test is a nunchuck joystick from the Wii console), no external elements are required. The connection diagram is shown in Figure 3. I see no point in describing the protocol. This is written in detail on the internet.

As can be seen from the diagram, 3 channels are used for implementation (channels 1,4,5), and the I2C protocol is two-wire. The bottom line is that the analyzer does not have the ability to change the direction of the bus during signal transmission, so the separation of the input and output signals occurs on a transistor (see diagram). Thus, channel 1 is the output: it outputs data in I2C. And channel 5 is input: it receives data via I2C.

To configure, select “I2C” in the interface selection menu and set the following checkboxes and buttons:

Channel 1 NEG (inverse output) OUTSDA _OUT output data

Channel 4 OUTSCL clock signal

Channel 5 IN SDA _IN input data

9. An example of using an analyzer to analyze a busSPI (9bit)

This example demonstrates an imitation of the serial protocol for controlling the display from Nokia6100. The diagram for connecting the display to the analyzer is shown in Figure 4. Of the external elements, only a current-limiting resistor is needed to backlight the display. A special feature is that SPI transmission is not 8 bits, as usual, but 9.

To operate this protocol, a separate 9-bit SPI was created in the analyzer.

Configuring the analyzer and protocol signals.

To configure, select “SPI _9BIT” in the interface selection menu and set the following checkboxes and buttons:

Channel 1 OUT; we will register this signal manually. It's not on the record

Channel 2 OUT SS ;chip select signal

Channel 3 OUT SCK ;protocol clock

Channel 4 OUT MOSI ;data signal

Since we have no received data, all signals are configured as output and no MISO protocol signal is used.

It is also necessary to set the power jumper to the 3.3V position, since the device will be powered from the analyzer.

Arduino is a unique microcontroller that allows you to create any device, limited only by the engineer’s imagination. Today we will talk about one of these projects and analyze the antenna analyzer on Arduino, as well as all the nuances that you will have to deal with when soldering and programming it.

In fact, a spectrum analyzer on Arduino is a fairly simple project, but it is ideal for beginners and those who want to add this device to their toolkit. Let's look at what a logic analyzer on Arduino is, and what pitfalls await you when designing and soldering it.

Logic analyzer circuit based on Arduino MK

First we need to design what we will solder. A logic analyzer is a simple instrument whose whole job is to read and analyze a binary code (digital signal) transmitted through the application of electricity.

In other words, every 5 volts supplied to the device is a one, the absence of such is a zero. This binary code is used in data encoding and in many devices, including those based on Arduino. Reading begins, as a rule, with one. And to check your project with binary encoding, you will need a logic analyzer.

The easiest way is to try the device on the I2C bus, which is used in most electronic devices to this day. To figure out what we need to design, let's look at the main characteristics of the device:

  1. 4 channels for logical analysis of incoming signals.
  2. The variability of signal frequencies is up to 400 kHz; this range will cover most modern devices, except for specialized ones.
  3. The input voltage should be up to +5 Volts, as already described, this is the standard taken as a unit (signal presence).
  4. LED display for displaying information. Particularly sophisticated programmers can buy a couple of LEDs and build their own display of the diagonal they need, but for everyone else, writing software for such a device will be too labor-intensive and will turn out to be an unnecessary step. Therefore, here we will consider a device version with an LCD display.
  5. 4 batteries for power supply, 1.2 V at a maximum voltage of 4.8 Volts.
  6. RAM. It is advisable to take two varieties - high-speed (3.6ms per signal) and low-speed (36 s), this solution will allow you to cover the entire range of signals.
  7. A control panel or a pair of buttons.
  8. Any shell for fastening the structure. You can print it on a 3-D printer, you can take an unnecessary plastic box or do without a case at all. Here we will not give advice, the device works, whether with a shell or without, the choice is yours.

For power, you need to choose batteries, since 4 1.5 Volt batteries can damage the Arduino and burn the board. Not to mention the danger to the LCD display. Therefore, do not skimp and take quality components. After all, the quality of the final product is equal to the parameter of its worst component.

Don't forget to add switch S1 to the final circuit, which will be used to supply power and turn off the device so that the batteries do not simply discharge.

Special pull-up resistors will also be required, which will eliminate false data that may appear due to the electromagnetic field of the signal probe fingers. As a result, noise and distortion on the digital inputs will be minimal.

You can take the LED as you wish, it is necessary to indicate the presence of a digital signal, and it can be completely replaced by software for the LCD display. This solution is convenient only as an indicator of recording digital signals into memory, but in any case, you will activate the device manually, so such an indication, if necessary, can be removed.

Recommended peripherals for creating a logic analyzer based on the Arduino microcontroller

From all of the above, you have already compiled a rough list of peripherals for purchase, but let’s clarify this point. In the logic analyzer you will need:

  1. The Arduino microcontroller itself. It makes no difference which one you choose, it will only affect the final size of the device. The software for any version looks the same. The board in the photo above was used.
  2. LCD display. If you have an old push-button telephone, you can remove it and set up a “waste-free” production.
  3. Resistors of various capacities.
  4. Current sensor.
  5. 4 batteries.
  6. An LED or two.
  7. Memory card, but this is optional.

In addition, you will naturally need a soldering iron, solder and other accessories. It’s better to find a place in advance where you will collect all this. And if you are working with a soldering iron for the first time, study the fire safety rules and features of its operation so as not to re-solder each part 10 times.

Programming Arduino MK when implementing the “logic analyzer” project

Thanks to the popularity of Arduino, there are already ready-made libraries and functions for logic analyzers on this MK. All you have to do is choose the right one and rewrite the program code for your device. After all, boards, sensors and other inputs are different for everyone, and in order for your device to work without problems, you will have to adjust someone else’s code to your needs. If you don’t want to bother yourself and you have experience programming in C++, you can use any environment you like.

The code for the circuit in the photo above could be like this:

/*********************************** 128 by 64 LCD Logic Analyzer 6 channel and 3Mb/s By Bob Davis Uses Universal 8bit Graphics Library, http://code.google.com/p/u8glib/ Copyright (c) 2012, [email protected] All rights reserved. ******************************************************/ #include "U8glib. h" // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16 //U8GLIB_ST7920_128X64_4X u8g(8, 9, 10, 11 , 4, 5, 6, 7, 18, 17, 16); // **** NOTE **** I Moved the three control pins !!! U8GLIB_ST7920_128X64_4X u8g(8, 9, 10, 11, 4, 5, 6, 7, 1, 2, 3); int Sample; int Input=0; int OldInput=0; int xpos=0; void u8g_prepare(void) ( u8g.setFont(u8g_font_6x10); u8g.setFontRefHeightExtendedText(); u8g.setDefaultForegroundColor(); u8g.setFontPosTop(); ) void DrawMarkers(void) ( u8g.drawFrame (0,0,128,64); u8g .drawPixel (20,1); u8g.drawPixel (40,1); u8g.drawPixel (60,1); u8g.drawPixel (80,1); u8g.drawPixel (100,1); u8g.drawPixel (20, 62); u8g.drawPixel (40,62); u8g.drawPixel (60,62); u8g.drawPixel (80,62); u8g.drawPixel (100,62); ) void draw(void) ( u8g_prepare(); DrawMarkers(); // wait for a trigger of a positive going input Input=digitalRead(A0); while (Input != 1)( Input=digitalRead(A0); ) // collect the analog data into an array // No loop is about 50% faster! Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC ; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample =PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; Sample=PINC; // display the collected analog data from array for(int xpos=0; xpos<128; xpos++) { u8g.drawLine (xpos, ((Sample&B00000001)*4)+4, xpos, ((Sample&B00000001)*4)+4); u8g.drawLine (xpos, ((Sample&B00000010)*2)+14, xpos, ((Sample&B00000010)*2)+14); u8g.drawLine (xpos, ((Sample&B00000100)*1)+24, xpos, ((Sample&B00000100)*1)+24); u8g.drawLine (xpos, ((Sample&B00001000)/2)+34, xpos, ((Sample&B00001000)/2)+34); u8g.drawLine (xpos, ((Sample&B00010000)/4)+44, xpos, ((Sample&B00010000)/4)+44); u8g.drawLine (xpos, ((Sample&B00100000)/8)+54, xpos, ((Sample&B00100000)/8)+54); } } void setup(void) { pinMode(A0, INPUT); pinMode(A1, INPUT); pinMode(A2, INPUT); pinMode(A3, INPUT); pinMode(A4, INPUT); pinMode(A5, INPUT); // assign default color value if (u8g.getMode() == U8G_MODE_R3G3B2) u8g.setColorIndex(255); // RGB=white else if (u8g.getMode() == U8G_MODE_GRAY2BIT) u8g.setColorIndex(3); // max intensity else if (u8g.getMode() == U8G_MODE_BW) u8g.setColorIndex(1); // pixel on, black } void loop(void) { // picture loop // u8g.firstPage(); do { draw(); } while(u8g.nextPage()); // rebuild the picture after some delay delay(100); }

Don't forget to download libraries for working with Arduino. And also take into account that the output goes to the LCD screen. When you finish writing the software, simply load it onto the board using a special USB adapter.

It may happen that due to the way information is displayed on the LCD display, you do not have enough permanent memory of the device. In this case, it makes sense to buy a flash drive and attach it to the system. Fortunately, this is done quite simply, and all you need is a special adapter for your physical drive form factor.

A logic analyzer is an indispensable assistant in debugging digital circuitry. Let's look at the basic techniques for working with the Saleae Logic Analyzer and its Chinese analogues.

For work we will need:

  • connecting wires (I recommend this set);
  • breadboard.

1 Logic Analyzer Specifications Saleae logic analyzer

A logic analyzer is a tool for timing analysis of digital signals. This is an indispensable, truly indispensable tool when debugging digital electronics. Original analyzers from famous manufacturers cost a lot of money. You can buy such a device from our Chinese friends for pennies. Therefore, if you don’t have it yet, be sure to purchase it. The capabilities of this small device are quite impressive.

The table lists the main parameters of the logic analyzer, my Chinese copy of the company's analyzer Saleae.

2 Driver installation for Saleae logic analyzer

Fortunately, for this logic analyzer - a Chinese copy - the driver from the original is suitable. Go to the official website, download the program for your operating system and install it. The drivers will be installed along with the program. By the way, an overview of the program’s capabilities in the form of instructions in English is attached at the end of this article.

If you have a copy of another company, for example, USBee AX Pro, then with a high degree of probability, drivers from the manufacturer of the original analyzer will also be suitable for it.

3 Examples of work with logic analyzer

For the first experiment, let's take a USB-UART converter on the FTD1232 chip. Let's connect the analyzer to the USB port. We connect the pins of channels 1 to 6 to the pins of the USB-UART converter. By and large, we are most interested in only two lines - Rx and Tx, we can get by with only them. The converter is identified in the system as a COM port. Let's launch any terminal (here, for example, is a good program for working with a COM port) and connect to the port.


Connecting a USB-UART converter on the FTD1232 chip to a logic analyzer

Launch the program Saleae Logic. If the drivers for the analyzer are installed correctly, the program title will indicate Connected- connected. Let's say we don't know which channel there will be a signal on and which channel won't, so we won't set a trigger to start capturing the signal. Just click on the arrows of the big green button Start(Start) and put it in the field Duration(Duration) say 10 seconds. This is the time during which the logic analyzer will collect data coming from all 8 channels after pressing the “Start” button. We start the capture and simultaneously send some message to the COM port. After 10 seconds, the analyzer will finish collecting data and display the result in the signal viewing field. In this case, the signal will be on only one channel, which is connected to the Tx (transmitter) pin of the USB-UART converter.


For clarity, you can configure decoder intercepted data. To do this, in the right column we find the field Analyzers, click the plus icon - “Add”, indicate the type - Async Serial. A window will appear asking you to select settings. In the first field, enter the number of the channel on which you have data. Let's leave the rest as is. After pressing the button Save(Save), blue marks will appear above the corresponding channel field displaying the byte values ​​that were intercepted. By clicking on the gear in this decoder, you can set the display mode of values ​​- ASCII, HEX, BIN or DEC. If you sent a string to the COM port, select ASCII mode and you will see the text that you sent to the port.


Right there, in the right column of the Saleae Logic program, you can add bookmarks to the intercepted data, measure delays and durations, set all kinds of markers, and even search through data for decoded protocols.

Let's connect the logic analyzer to the USB-RS485 converter in the same way. There are only two data lines, so you can set a trigger to trigger on the edge of any of the channels: the signal in the RS-485 protocol is differential and the pulse edges appear simultaneously on each of the channels, but in antiphase.


Click the “Start” button in the analyzer program. Using our terminal, we will connect to the USB-RS485 converter and transfer some data. When the trigger is triggered, the program will begin collecting data and, upon completion, display it on the screen.


Saleae Logic allows you to export saved data in the form of images and text data, save program settings, annotations and channel decoders.

The last example in this short review is a captured data frame transmitted over the serial SPI protocol. Channel 2 shows the slave selection signal, channel 0 shows the clock pulses, and channel 1 shows the actual data from the master to the slave.


conclusions

A logic analyzer can be very useful when developing and configuring all kinds of electronic devices, when writing software that works in conjunction with hardware, when working with microcontrollers, FPGAs and microprocessors, for analyzing the operation of various devices and data exchange protocols, and for many other applications. In addition, it is portable and does not require a separate power supply.

Download instructions for using the program for the Saleae logic analyzer

  • Download instructions for using the program for the Saleae logic analyzer from Depositfiles.com
  • Download instructions for using the program for the Saleae logic analyzer from File-upload.com
  • Download instructions for using the program for the Saleae logic analyzer from Up-4ever.com
  • Download instructions for using the program for the Saleae logic analyzer from Hitfile.com