# Bi directional UART analyzer with basic packet decoding capability

**URL:** <https://discuss.saleae.com/t/bi-directional-uart-analyzer-with-basic-packet-decoding-capability/970>\
**Category:** Extensions\
**Created:** [March 21, 2021, 9:22pm UTC](https://discuss.saleae.com/t/bi-directional-uart-analyzer-with-basic-packet-decoding-capability/970 "2021-03-21T21:22:28Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![martonmiklos](https://yyz2.discourse-cdn.com/flex030/user_avatar/discuss.saleae.com/martonmiklos/32/411_2.png) [@martonmiklos](https://discuss.saleae.com/u/martonmiklos)\
**Post date:** [March 21, 2021, 9:22pm UTC](https://discuss.saleae.com/t/bi-directional-uart-analyzer-with-basic-packet-decoding-capability/970/1 "2021-03-21T21:22:28Z")

</div>

Hi folks,

When reverse engineering packet based communications over UART it would be handful to have an analyzer which could export the decoded UART data “packetized”.

I am thinking about the following construction:

- The analyzer would have two input channels.

- A “packet end” delay could be specified for each channel: if no data received after the packet end delay the bytes recieved considered a “packet” which could be exported as one packet.

- Both channels could have text input for prefix and the export output would look like this way (\> and \< symbols used as as a prefix):

I have not found any similar analyzer, however I might overlooked it.

---

<div class="post-metadata">

**Author:** ![timreyes](https://yyz2.discourse-cdn.com/flex030/user_avatar/discuss.saleae.com/timreyes/32/108_2.png) [@timreyes](https://discuss.saleae.com/u/timreyes)\
**Post date:** [March 22, 2021, 10:03pm UTC](https://discuss.saleae.com/t/bi-directional-uart-analyzer-with-basic-packet-decoding-capability/970/2 "2021-03-22T22:03:11Z")

</div>

Thanks for letting us know your requirements. This might be possible via a High Level Analyzer extension added to the Async Serial Analyzer. More information on HLAs below:  
[https://support.saleae.com/extensions](https://support.saleae.com/extensions)

I wanted to gather some more information from you regarding the format you would prefer to be sure if this is possible via an HLA.

Right now, the export format for a single Async Serial Analyzer is shown below as an example:  
 ![Screen Shot 2021-03-22 at 4.59.29 PM](https://canada1.discourse-cdn.com/flex030/uploads/saleae/original/1X/8edf1f23ee3476d9dcea3d44de7c434aa353e45a.png)

Can you provide an example csv/txt file that shows how exactly you would like it to appear? I also don’t quite understand the 2 channel requirement, so if you could go into detail on that, that would be helpful as well.

---

<div class="post-metadata">

**Author:** ![martonmiklos](https://yyz2.discourse-cdn.com/flex030/user_avatar/discuss.saleae.com/martonmiklos/32/411_2.png) [@martonmiklos](https://discuss.saleae.com/u/martonmiklos)\
**Post date:** [March 22, 2021, 10:34pm UTC](https://discuss.saleae.com/t/bi-directional-uart-analyzer-with-basic-packet-decoding-capability/970/3 "2021-03-22T22:34:49Z")

</div>

> Can you provide an example csv/txt file that shows how exactly you would like it to appear? I also don’t quite understand the 2 channel requirement, so if you could go into detail on that, that would be helpful as well.

Ah, I see the problem: the code tag eat my brackets.

The HLAs and the old analyzers exports the data byte-per-byte.

However I would like to group the bytes to packets and print the packets line-by-line.

My idea for packet forming is simple: if a byte arrives within a certain amount of period to the previous one (user editable parameter) then it belongs to the same packet if not it is a new packet.

Here is an example of what I used to do:

 ![kép](https://canada1.discourse-cdn.com/flex030/uploads/saleae/original/1X/a17436c3ce0cfa7ff4e68bc01ba3bf6c46a0204b.png)

This is a basic command-response based UART communication which is quite common.

What I would like to see for this one as an output: one line for the command and one line for the response (prefixed with some user parameter). The bytes in the packets are printed with HEX separated by spaces.

In the image above this is the beginning of the R16 TX - STM command packet:

 ![kép](https://canada1.discourse-cdn.com/flex030/uploads/saleae/original/1X/dab5e806ef7064aae6a1eb48b28284fc8978edf8.png)

And this is the beginning of the response packet:

 ![kép](https://canada1.discourse-cdn.com/flex030/uploads/saleae/original/1X/33775cb81582cc3524554be2a11b5f133239f448.png)

My intention to have an export capability in the following way (TX, RX is the user specified “channel prefix”):

```
TX AA 12 01 D0 ...
RX AA 58 01 07 ...

```

During reverse engineering I often create traces while applying different circumstances to the target and do diff on the created traces with standard text comparison tools.

If the output is packetised properly it is easier to edit/spot differences/etc.

---

<div class="post-metadata">

**Author:** ![KurtE](https://yyz2.discourse-cdn.com/flex030/user_avatar/discuss.saleae.com/kurte/32/189_2.png) [@KurtE](https://discuss.saleae.com/u/KurtE)\
**Post date:** [March 23, 2021, 1:23pm UTC](https://discuss.saleae.com/t/bi-directional-uart-analyzer-with-basic-packet-decoding-capability/970/4 "2021-03-23T13:23:17Z")

</div>

I also second that this could be a nice feature. For example earlier when I was working with Dynamixel Servos by Robotis, I helped make a low level analyzer that worked with these servos, but this was on one serial line that runs in half duplex. Keep wondering about trying to convert this to HLA…

But currently, I am playing with some new servos by Lynxmotion(RobotShop), which are full duplex, with RX and TX lines running to each of the servos. So again it would be interesting to have an Analyzer that understands the TX and RX packets known by these servos. into one stream.

If I were going to hack it for my own usage, could maybe try something like, have an HLA over each Serial IO channel , that does sort of as you mentioned, that maybe tries to gather all of the information of each packet into one logical unit. Either by timeout, or knowing a little about the packet formats, like they start with XX XX and or have a length field…

Then I would maybe have an output version which dumps these out with a beginning time stamp, some form of identifier like which channel, and then the Serial data…

then if I could output both of them, I could then manually load both of them into text editor and sort by time stamp…

Again not pretty but might get the job done.

---

<div class="post-metadata">

**Author:** ![timreyes](https://yyz2.discourse-cdn.com/flex030/user_avatar/discuss.saleae.com/timreyes/32/108_2.png) [@timreyes](https://discuss.saleae.com/u/timreyes)\
**Post date:** [March 23, 2021, 8:53pm UTC](https://discuss.saleae.com/t/bi-directional-uart-analyzer-with-basic-packet-decoding-capability/970/5 "2021-03-23T20:53:20Z")

</div>

@martonmiklos Thanks for describing that. I see what you mean now. @KurtE Thanks for jumping in and providing your thoughts as well.

After thinking about this some more, modifying the Async Serial analyzer itself using our Analyzer SDK and adding support for a second channel may be your best bet.  
[https://support.saleae.com/saleae-api-and-sdk/protocol-analyzer-sdk](https://support.saleae.com/saleae-api-and-sdk/protocol-analyzer-sdk)

This method would give you more freedom with timeouts, grouping of packets, and export format.

---

<div class="post-metadata">

**Author:** ![martonmiklos](https://yyz2.discourse-cdn.com/flex030/user_avatar/discuss.saleae.com/martonmiklos/32/411_2.png) [@martonmiklos](https://discuss.saleae.com/u/martonmiklos)\
**Post date:** [March 23, 2021, 9:10pm UTC](https://discuss.saleae.com/t/bi-directional-uart-analyzer-with-basic-packet-decoding-capability/970/6 "2021-03-23T21:10:02Z")

</div>

> After thinking about this some more, modifying the Async Serial analyzer itself using our Analyzer SDK and adding support for a second channel may be your best bet.

Yupp, that was my idea as well, I just wanted to ask around to make sure that I am not replicating something which is already implemented.

---

<div class="post-metadata">

**Author:** ![martonmiklos](https://yyz2.discourse-cdn.com/flex030/user_avatar/discuss.saleae.com/martonmiklos/32/411_2.png) [@martonmiklos](https://discuss.saleae.com/u/martonmiklos)\
**Post date:** [April 20, 2021, 12:55pm UTC](https://discuss.saleae.com/t/bi-directional-uart-analyzer-with-basic-packet-decoding-capability/970/7 "2021-04-20T12:55:05Z")

</div>

In the case if someone would be looking into similar: I have started to work on this here:

> **[martonmiklos/serial-analyzer](https://github.com/martonmiklos/serial-analyzer/tree/dual_serial_packetiser)**
>
> dual\_serial\_packetiser

It is not yet complete (the bubble display broken at the moment), however the CSV export works.

---

<div class="post-metadata">

**Author:** ![timreyes](https://yyz2.discourse-cdn.com/flex030/user_avatar/discuss.saleae.com/timreyes/32/108_2.png) [@timreyes](https://discuss.saleae.com/u/timreyes)\
**Post date:** [April 20, 2021, 8:57pm UTC](https://discuss.saleae.com/t/bi-directional-uart-analyzer-with-basic-packet-decoding-capability/970/8 "2021-04-20T20:57:30Z")

</div>

@martonmiklos Thanks for the update! This is fantastic. I’d love to get this up on our list of protocol analyzers made by the community:  
[https://support.saleae.com/protocol-analyzers/community-supported-protocols](https://support.saleae.com/protocol-analyzers/community-supported-protocols)

Once you’ve completed it, let me know if you’re interested in getting your analyzer listed there.

---

<div class="post-metadata">

**Author:** ![martonmiklos](https://yyz2.discourse-cdn.com/flex030/user_avatar/discuss.saleae.com/martonmiklos/32/411_2.png) [@martonmiklos](https://discuss.saleae.com/u/martonmiklos)\
**Post date:** [May 9, 2021, 9:40pm UTC](https://discuss.saleae.com/t/bi-directional-uart-analyzer-with-basic-packet-decoding-capability/970/9 "2021-05-09T21:40:46Z")

</div>

Well I hacked to a state where it hits the usability level in my use case.

Renamed the repository to make it easier to distinguish and find:

> **[martonmiklos/dual-channel-packetiser-serial-analyzer](https://github.com/martonmiklos/dual-channel-packetiser-serial-analyzer)**
>
> Saleae Asynchronous Serial Analyzer. Contribute to martonmiklos/dual-channel-packetiser-serial-analyzer development by creating an account on GitHub.

---

<div class="post-metadata">

**Author:** ![timreyes](https://yyz2.discourse-cdn.com/flex030/user_avatar/discuss.saleae.com/timreyes/32/108_2.png) [@timreyes](https://discuss.saleae.com/u/timreyes)\
**Post date:** [May 10, 2021, 9:01pm UTC](https://discuss.saleae.com/t/bi-directional-uart-analyzer-with-basic-packet-decoding-capability/970/10 "2021-05-10T21:01:51Z")

</div>

This is great, thanks for sharing it! I went ahead and added it to our Community Supported Protocols list below:  
[https://support.saleae.com/protocol-analyzers/community-supported-protocols](https://support.saleae.com/protocol-analyzers/community-supported-protocols)

---

<div class="post-metadata">

**Author:** ![Oleksii](https://avatars.discourse-cdn.com/v4/letter/o/9de053/32.png) [@Oleksii](https://discuss.saleae.com/u/Oleksii)\
**Post date:** [June 26, 2023, 11:45pm UTC](https://discuss.saleae.com/t/bi-directional-uart-analyzer-with-basic-packet-decoding-capability/970/11 "2023-06-26T23:45:38Z")

</div>

I’ve compiled the library on my Ubuntu 22.04, I use AppImages. I’ve tried to use and I get following error.  
When try to use with Logic 2.4.7:  
 ![Selection_1722](https://canada1.discourse-cdn.com/flex030/uploads/saleae/original/2X/1/16cae0aa71a3e84528eb1a07c6982f1f748523d5.png)

When try to use with Logic 1.2.40:  
 ![Selection_1723](https://canada1.discourse-cdn.com/flex030/uploads/saleae/original/2X/4/4cec17bcddb497d6f6868ef071f882983cd8a10b.png)

I’ve tried to put AppImages and the .so file to root /, set the plugins path to root and run it from there.  
The same error comes, with just root / path to the so file.

Help me please to fix it.

---

<div class="post-metadata">

**Author:** ![Mark](https://avatars.discourse-cdn.com/v4/letter/m/e9c0ed/32.png) [@Mark](https://discuss.saleae.com/u/Mark)\
**Post date:** [June 27, 2023, 7:25am UTC](https://discuss.saleae.com/t/bi-directional-uart-analyzer-with-basic-packet-decoding-capability/970/12 "2023-06-27T07:25:37Z")

</div>

The ‘Concatenator’ HLA analyzer would be what the author asks for (except that it’s per-channel), but I am assuming that was not available in 2021 🙂

---

<div class="post-metadata">

**Author:** ![timreyes](https://yyz2.discourse-cdn.com/flex030/user_avatar/discuss.saleae.com/timreyes/32/108_2.png) [@timreyes](https://discuss.saleae.com/u/timreyes)\
**Post date:** [June 27, 2023, 9:34pm UTC](https://discuss.saleae.com/t/bi-directional-uart-analyzer-with-basic-packet-decoding-capability/970/13 "2023-06-27T21:34:13Z")

</div>

@Oleksii At first glance, I suspect the analyzer might need to be updated to meet the requirements of our new build process. Back in 2022, we sent a message out with instructions on this to the more commonly downloaded community shared analyzers.

I pulled the instructions from another community repository linked below:

> <https://github.com/nezza/ISO7816Analyzer/issues/2>
>
> Hi! I'm a Product Manager at Saleae and we’ve made improvements to our analyzer …build process. Specifically, we cleaned up the build system, and switched to cmake, so there aren't multiple project files anymore. By implementing the changes outlined \[here\](https://github.com/saleae/SampleAnalyzer/#updating-an-existing-analyzer-to-use-cmake--github-actions) you will be able to provide the community automatic builds in addition to a simplified build system. Let us know if you think you can make the changes or if you’d like us to make the changes for you. 
> 
> Additionally, if you would like to update your analyzer so that results appear in Logic 2’s data table you can follow the steps outlined \[here\](https://support.saleae.com/saleae-api-and-sdk/protocol-analyzer-sdk/framev2-hla-support-analyzer-sdk). Note that if you upgrade your analyzer to FrameV2 it will not be backward compatible with Logic 1.
> 
> We really appreciate your time and effort! Please let us know if you have any feedback or questions. Thanks!

You’ll likely need to update the analyzer to the new build process using the instructions above. Let me know if you run into any specific issues with that!
