How to Open Logic Analyzer & Serial Port with industrial Raspberry PLC
Take a Raspberry Pi PLC, connect it through Serial port to a logic analyzer and learn how to use it!
27 December, 2021 by
How to Open Logic Analyzer & Serial Port with industrial Raspberry PLC
Boot & Work Corp. S.L., Fernandez Queralt Martinez

INTRODUCTION

According to Wikipedia, a logic analyzer is an electronic instrument that captures and displays multiple signals from a digital system or digital circuit. A logic analyzer may convert the captured data into timing diagrams, protocol decodes, state machine traces, assembly language, or may correlate assembly with source-level software.

In this blog, we will learn how to connect a logic analyzer to the Raspberry PLC through Serial port, and we will learn how to see the incoming and outcoming data.

Latest Posts

REQUIREMENTS

HOW TO CONNECT LOGIC ANALYZER & RASPBERRY

First of all, we are going to set the connections.
Connect the hardware as you can see in the table and picture below:

RASPBERRY PLCSALEAE LOGIC ANALYZERLAPTOP
GNDGND
TXCHANNEL 1
RXCHANNEL 2

USBUSB
Odoo • Image and Text

SEND DATA THROUGH SERIAL PORT  

From the Raspberry PLC, we are going to execute a very basic test about sending data through the serial port. 

You can use the programming language that you like the most. We are going to send an 'a' using bash script.

1. Access to your Raspberry PLC.

2. Create a file called test.sh

touch test.sh

3. Give permissions to the file:

chmod 755 test.sh

4. Edit your file and add this code:

#!/bin/bash
stty 115200 -F /dev/ttyS0
while [ 1 ] ; do
        echo -ne "a" > /dev/ttyS0
        sleep 0.5
done

5. Run the script:
sudo ./test.sh

INSTALL SALEAE LOGIC ANALYZER SOFTWARE

Once the hardware is correctly connected and you are sending data from the Raspberry PLC's serial port, you can go to Saleae's website > and download the package that fits you better. In our case, we are going to download the Linux 64 bit .zip

Odoo • Image and Text

Click on it and download it. Once downloaded, extract files and double click on the Logic file to launch the software. 

LAUNCH THE LOGIC ANALYZER SOFTWARE

Once you launch the software, you should see a window like this:

Odoo • Image and Text

You can see the 8 channels on the left, and another panel on the right.

1. Select the chanel 00 and name it as TX.

2. By the channel 0 selected, click on the  symbol next to Analyzers of the panel on the right > Async Serial.

3. Select Serial 0 - 'TX'.

4. Set the same baudrate as in the Raspberry code. In our case: 115200. Leave the rest by default. Click on Save.

5. Do the same for the RX, from step 1 to 4.

6. Go to the Start button and click on the arrows. Select 4Ms/s and 2 seconds, as there is a 0.5 delay in our code, and will allow to see 4 incoming data.

7. Click on any place.

8. Click on the Start button.

9. Get your data!

Odoo • Image and Text

DATA REPRESENTATION

The points from the frame received, represents the bits from the data in little endian, so the least significant bit (also LSB) will be the first one to be read.

In this case, we can see that we get an 10000110, but read as a little endian like 01100001, so if we convert this to hexadecimal, we get 61, which is an 'a' in ASCII.


 Now, explore the logic analyzer software and explore all the possibilities it offers! Check it out >

Find what you are looking for
Search in our Blog

How to Open Logic Analyzer & Serial Port with industrial Raspberry PLC
Boot & Work Corp. S.L., Fernandez Queralt Martinez
27 December, 2021
Share this post
Archive

Looking for your ideal Programmable Logic Controller?

Take a look at this product comparison with other industrial controllers Arduino-based. 

We are comparing inputs, outputs, communications and other features with the ones of the relevant brands.


Industrial PLC comparison >>>

Do you want more information?

Just fill the form!

Tell me more!