# Hla spi

**URL:** <https://discuss.saleae.com/t/hla-spi/1329>\
**Category:** Extensions\
**Created:** [December 23, 2021, 4:08pm UTC](https://discuss.saleae.com/t/hla-spi/1329 "2021-12-23T16:08:03Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![maurosmartins](https://avatars.discourse-cdn.com/v4/letter/m/59ef9b/32.png) [@maurosmartins](https://discuss.saleae.com/u/maurosmartins)\
**Post date:** [December 23, 2021, 4:08pm UTC](https://discuss.saleae.com/t/hla-spi/1329/1 "2021-12-23T16:08:03Z")

</div>

Hello all,

I’m trying to write a custom HLA for TFT displays using SPI as the LLA. I’ve already managed to identify some commands sent to the display. Nevertheless I don’t know how to check the status of the line “Data/Command” that is not part of SPI. Any guides on this regard?

on a different topic, following this tutorial: [High-Level Analyzer (HLA) Extensions - Saleae Support](https://support.saleae.com/extensions/high-level-analyzer-quickstart#understanding-the-input-frames)  
I see a different output on the analyzer bubbles text than expected.

With the following code:

result\_types = {  
‘match’: {  
‘format’: ‘{{data.command}}’  
}  
}

```
                    return AnalyzerFrame('match', frame.start_time, frame.end_time, {"command": COMMANDS[ch]} )

```

I expected only the command name, for example “MADCTL”:  
but I get “match(command=MADCTL)”

is it possible to get the expected output?

looking forward your reply,  
Best regards, Mauro.

---

<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:** [December 28, 2021, 3:59am UTC](https://discuss.saleae.com/t/hla-spi/1329/2 "2021-12-28T03:59:22Z")

</div>

@maurosmartins Sorry for the late reply! We’re just returning from the holidays now. For your question below:

> Nevertheless I don’t know how to check the status of the line “Data/Command” that is not part of SPI. Any guides on this regard?

Can you let me know a little more about the “Data/Command” line? Our HLAs are limited to working with the frames that the underlying LLA produces. It unfortunately doesn’t have the ability to check the status of channels that are not attached to the LLA.

For your question on the analyzer bubble text output, I’ll review it with the team here and will follow up with you.

---

<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:** [December 28, 2021, 1:25pm UTC](https://discuss.saleae.com/t/hla-spi/1329/3 "2021-12-28T13:25:14Z")

</div>

Sorry for jumping in here.

There are lots of SPI based displays like: ILI9341, ILI9488, ST7735, ST7789, … That use a D/C pin as part of their communications, that use this pin like logically an SPI 9 bit communications, where the pin (or 9th bit) signifies if the byte is a command or data bytes associated with the pin. For example from the ILI9341 manual:

 ![image](https://canada1.discourse-cdn.com/flex030/uploads/saleae/original/1X/f97bdeacdd2f679ced6b2abcc4b0a15c29bccbd8.png)

---

<div class="post-metadata">

**Author:** ![maurosmartins](https://avatars.discourse-cdn.com/v4/letter/m/59ef9b/32.png) [@maurosmartins](https://discuss.saleae.com/u/maurosmartins)\
**Post date:** [December 28, 2021, 6:46pm UTC](https://discuss.saleae.com/t/hla-spi/1329/4 "2021-12-28T18:46:25Z")

</div>

Hello @timreyes,

thank you for your reply, I’ll be waiting for the comments on the analyzer bubble.

regarding previous question, as @KurtE explained (thank you), the “Data/Command” line is an extra line that tells the display if current information on SPI is Data or a command. Can’t the raw status of all channels be checked when running the “decode” function?

looking forward your reply,  
Best regards, Mauro.

---

<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:** [December 29, 2021, 8:44pm UTC](https://discuss.saleae.com/t/hla-spi/1329/5 "2021-12-29T20:44:43Z")

</div>

@KurtE Thanks for jumping in! The image helped a ton. It makes sense now.

@maurosmartins To my best knowledge, the raw status of any channel cannot be checked by HLAs. In addition to your other question about the analyzer bubble, I’m going to double check this with the team here to see if they know of a workaround.

Apologies in advance as I most likely won’t be able to review this with the team until early next week due to the New Year holidays coming up. I’ll follow up again once I’ve had a chance to discuss this with them.

---

<div class="post-metadata">

**Author:** ![markgarrison](https://yyz2.discourse-cdn.com/flex030/user_avatar/discuss.saleae.com/markgarrison/32/23_2.png) [@markgarrison](https://discuss.saleae.com/u/markgarrison)\
**Post date:** [January 4, 2022, 12:50am UTC](https://discuss.saleae.com/t/hla-spi/1329/6 "2022-01-04T00:50:38Z")

</div>

We don’t have a way to read the raw digital states in the python HLA API at this time.

This is something we want to fix! If you have a moment, we would appreciate if you add your interested to the feature suggestion here: [High-level analyzer: combine data from multiple sources - Logic 2 - Ideas and Feature Requests - Saleae](https://ideas.saleae.com/b/feature-requests/high-level-analyzer-combine-data-from-multiple-sources/). Any use case information you can add in the comments would be great too.

In the meantime, you would need to modify the C++ SPI analyzer to include the extra channel, and to indicate the channel state in the FrameV2 object that’s passed up into the HLA.

We’re in the process of making the C++ FrameV2 API public right now, however it can be used to day simply by looking at the existing SPI analyzer source code, which is already using the new API feature: [GitHub - saleae/spi-analyzer at alpha](https://github.com/saleae/spi-analyzer/tree/alpha)

Unfortunately, this is a good bit more complicated than just adding a few extra lines of code to your python HLA. We’re focused on analog features at the moment, and unfortunately won’t be back on extension development for a while. (Our SW team is 3 developers)

---

<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:** [January 4, 2022, 12:48pm UTC](https://discuss.saleae.com/t/hla-spi/1329/7 "2022-01-04T12:48:13Z")

</div>

> [@markgarrison](#):
>
> In the meantime, you would need to modify the C++ SPI analyzer to include the extra channel, and to indicate the channel state in the FrameV2 object that’s passed up into the HLA.

Sounds like an interesting approach, which I have thought of wanting for awhile, who knows maybe at some point will take a look. Wonder how common it is for devices to use this… As I mentioned earlier have seen it on many displays.

---

<div class="post-metadata">

**Author:** ![xylopyrographer](https://avatars.discourse-cdn.com/v4/letter/x/74df32/32.png) [@xylopyrographer](https://discuss.saleae.com/u/xylopyrographer)\
**Post date:** [February 9, 2022, 7:51am UTC](https://discuss.saleae.com/t/hla-spi/1329/8 "2022-02-09T07:51:20Z")

</div>

New user to Saleae. First use case is exactly what’s being described here. Analyzing SPI communications for TFT LCD and e-paper displays.

In addition to the MISO, MOSI, CS and CLK signals, most displays also use D/C and RST (reset) lines for control. E-paper displays also output a BSY (busy) signal when they are updating the contents of the display (shouldn’t try to access the display when it’s busy).

Being able to separate out commands and data in the trace and data tables would be a very good add, either by extending the existing SPI analyzer or creating a “Displays” extension on top of it that would qualify the data.

Right now I’ve kind of faked it by defining the DC line as the MISO signal so it shows up in the the data table, but it’s be nice to be able to include any other signal as part of the SPI group and send that directly to the table.

Thanks.

---

<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:** [February 10, 2022, 1:52am UTC](https://discuss.saleae.com/t/hla-spi/1329/9 "2022-02-10T01:52:58Z")

</div>

@xylopyrographer Since you brought up your workaround of defining the DC line as a MISO signal, I’m now wondering if it may be possible to simply add 2x SPI analyzers while configuring both to take a look at the DC line as the EN line. One SPI analyzers would be configured with an active low EN, and the other configured as an active high EN like in the image below.

 ![Screen Shot 2022-02-09 at 7.49.24 PM](https://canada1.discourse-cdn.com/flex030/uploads/saleae/original/1X/ce3d4d0a5c60930f2f9bb94b0e9aea834e051a02.png)

Channel 3 is acting as the DC line in this case. This would allow separating out the data and command signals in 2 separate rows above the waveform as well.

I could be missing a pretty critical detail here though, but if this works, it could be way simpler than having to add a DC line to our SPI analyzer by using our protocol analyzer SDK.

---

<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:** [February 10, 2022, 3:02pm UTC](https://discuss.saleae.com/t/hla-spi/1329/10 "2022-02-10T15:02:37Z")

</div>

Actually I am playing with a hacked up version of your SPI analyzer to add the DC… Have it building and running, but, issue restoring settings and minor issue of crashing the analyzer… 😉

I have the wip up at: [https://github.com/KurtE/spi-analyzer/tree/SPIEx](https://github.com/KurtE/spi-analyzer/tree/SPIEx)

But will hopefully debug some.

Running into some questions to self like:

How to hold the DC state in a frame:

```auto
class LOGICAPI Frame
{
  public:
    Frame();
    Frame( const Frame& frame );
    ~Frame();

    S64 mStartingSampleInclusive;
    S64 mEndingSampleInclusive;
    U64 mData1;
    U64 mData2;
    U8 mType;
    U8 mFlags;

    bool HasFlag( U8 flag );
};

```

You stores miso and mosi in data1 and data2.

So question to self or others:  
a) Can I store it as a bit in mFlags (That is what I am trying now),  
b) store as lets say high bit in data1 or 2… and punt on handling 64 bit transfers working with DC… But I never do that anyway so…

Also is there a way to run this under debugger these days? Running on Windows 10.

---

<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:** [February 10, 2022, 7:23pm UTC](https://discuss.saleae.com/t/hla-spi/1329/11 "2022-02-10T19:23:28Z")

</div>

Working a little better now… May change the results for DC, but…

 ![image](https://canada1.discourse-cdn.com/flex030/uploads/saleae/original/1X/37d70984d686df8e878470f5f18d4b53ede613b8.png)

Again it is up in my SPIEx branch…

I encoded the data in mData2…

Now maybe need to learn enough of the HLA stuff to try…

---

<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:** [February 10, 2022, 8:17pm UTC](https://discuss.saleae.com/t/hla-spi/1329/12 "2022-02-10T20:17:07Z")

</div>

Hey @KurtE, we haven’t documented nor fully verified the ability to debug custom analyzers on Logic 2. We only have this documented for the older Logic 1.1.18 software, which unfortunately can’t be used with our Gen2 hardware (Logic 4, Logic 8, Logic Pro 8, and Logic Pro 16).  
[https://support.saleae.com/saleae-api-and-sdk/protocol-analyzer-sdk/debug](https://support.saleae.com/saleae-api-and-sdk/protocol-analyzer-sdk/debug)

However, a community user seems to have found some success with getting debugging working on Logic 2. Their forum post on this topic can be found below:

> [@Debugging analyzers using Visual Studio 2019 and Logic 2](https://discuss.saleae.com/t/debugging-analyzers-using-visual-studio-2019-and-logic-2/1100):
>
> It appears the Logic 2 software is capable of supporting custom analyzer debugging using Visual Studio 2019. The [Debug - Analyzer SDK](https://support.saleae.com/saleae-api-and-sdk/protocol-analyzer-sdk/debug) help topic mentions using the stand-alone “Debug-Legacy-1.1.14” software. There were problems with this, including this legacy version used a different format for the saved capture files, so you can’t load captures produced by any of the other versions. Additionally, you cannot take new captures with this software (unless you have a really old Gen 1 logic device),…

---

<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:** [February 10, 2022, 8:55pm UTC](https://discuss.saleae.com/t/hla-spi/1329/13 "2022-02-10T20:55:20Z")

</div>

Thankd @timreyes

Yes I remember debugging the Dynamixel stuff earlier on the old IDE (real old).

As you can see in my previous post, I fixed the fault and save/restore setting…

Now to see if I can hack up partial HLA and talk to it…

Need to look at docs to see what constraints…

---

<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:** [February 10, 2022, 9:46pm UTC](https://discuss.saleae.com/t/hla-spi/1329/14 "2022-02-10T21:46:36Z")

</div>

Opps, looks like I started from Master branch… Probably need to work from alpha…

Will see how hard to migrate over…

---

<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:** [February 11, 2022, 1:52am UTC](https://discuss.saleae.com/t/hla-spi/1329/15 "2022-02-11T01:52:43Z")

</div>

put up new branch: alpha\_spiex

 ![image](https://canada1.discourse-cdn.com/flex030/uploads/saleae/original/1X/d5551fa97030c177ad7d26b5e509a19fe74c392b.png)

This one at least talks to the spi transaction framer. So I know that it talks somee to HLA

---

<div class="post-metadata">

**Author:** ![xylopyrographer](https://avatars.discourse-cdn.com/v4/letter/x/74df32/32.png) [@xylopyrographer](https://discuss.saleae.com/u/xylopyrographer)\
**Post date:** [February 11, 2022, 6:18pm UTC](https://discuss.saleae.com/t/hla-spi/1329/16 "2022-02-11T18:18:19Z")

</div>

Ah! Clever. 👍 Let me play around with that and see how it goes. Thanks.

---

<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:** [February 11, 2022, 7:39pm UTC](https://discuss.saleae.com/t/hla-spi/1329/17 "2022-02-11T19:39:13Z")

</div>

I started playing around with maybe an ILI9341 example HLA using my SPIEx code…

It is coming along sort of, but python is not a language I have done anything in, other than try to get rid of Ros Python code a few years ago 😉

So I am stumbling along:

 ![image](https://canada1.discourse-cdn.com/flex030/uploads/saleae/original/1X/447a6826d0c68e38979e3b1598a449f4a02be730.png)  
But making some progress… If the DC is 0 I try to look it up in a table… The table also has an indication of why data might follow, more simple in 1 or 2 byte chunks from MOSI or MISO…

As you can see in picture it is showing that the command is the CASET, which the table shows 2 bytes for entries.

And it then shows the range for columns is 0 319…  
But I am not sure if I should be displaying 319…

I have hacked in there:

```auto
            elif self.last_from == 2: # mosi 2 bytes
                if self.data_packet_count == 0:
                    self.frame_start_time = frame.start_time
                    self.data_packet_count = 1
                    self.data_packet_value = mosi[0]
                else:
                    self.data_packet_count = 0
                    self.data_packet_value = (self.data_packet_value * 256) + mosi[0]
                    frame_data["command"] = self.data_packet_value
                    frame_type = "result_packet"

```

But if I click on the 3 dot it shows that I should be outputting HEX… so question is do I  
need to encode the values: to a hex string, and where do I in the Python code get what the  
user wants the output format to be?

Also side comments. I started the python code in one directory… Can I move it to another directory? If so How do I update the list?

Also side question, If I look at some published HLAs, they may mention to customize it, clone the project… And then click the local button… Not sure how to do that…

Back to playing

---

<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:** [February 12, 2022, 5:10pm UTC](https://discuss.saleae.com/t/hla-spi/1329/18 "2022-02-12T17:10:06Z")

</div>

Quick update:  
The extended SPI code is currently up in my fork/branch

> **[GitHub - KurtE/spi-analyzer at alpah\_spiex](https://github.com/kurte/spi-analyzer/tree/alpah_spiex)**
>
> alpah\_spiex

Wondering at times if it should just be incorporated into SPI…

The ILI9341 experiment code is up at:

> **[GitHub - KurtE/Saleae\_ILI9341\_HLA: ILI9341 HLA using my SpiEx low level analyzer](https://github.com/KurtE/Saleae_ILI9341_HLA)**
>
> ILI9341 HLA using my SpiEx low level analyzer. Contribute to KurtE/Saleae\_ILI9341\_HLA development by creating an account on GitHub.

 ![image](https://canada1.discourse-cdn.com/flex030/uploads/saleae/original/1X/980813d2753e8b201fb22856b7f44078c8236553.png)

---

<div class="post-metadata">

**Author:** ![P.Jaquiery](https://yyz2.discourse-cdn.com/flex030/user_avatar/discuss.saleae.com/p.jaquiery/32/289_2.png) [@P.Jaquiery](https://discuss.saleae.com/u/P.Jaquiery)\
**Post date:** [February 13, 2022, 8:53pm UTC](https://discuss.saleae.com/t/hla-spi/1329/19 "2022-02-13T20:53:27Z")

</div>

> [@KurtE](#):
>
> and where do I in the Python code get what the  
> user wants the output format to be?

If you mean “How do I manage user options” you may be interested in [User settings for measurement extensions - #8 by timreyes](https://discuss.saleae.com/t/user-settings-for-measurement-extensions/1291/8) - I have the same issue. My “Burst Stats” extension has two “user” parameters at the top of the Python source.

---

<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:** [February 13, 2022, 9:14pm UTC](https://discuss.saleae.com/t/hla-spi/1329/20 "2022-02-13T21:14:48Z")

</div>

Thanks, I was able to roll my own as you can see in:

 ![image](https://canada1.discourse-cdn.com/flex030/uploads/saleae/original/1X/55fbcc6ba27a3f0fc4e88888e7004f6439723ec8.png)

Edit: where you can see my: option default, which is sort of a kludge, but for caset ans paset it shows in decimal, but others show in hex…

I guess my question in this case was if you look at the context menu for the Extension you see:

 ![image](https://canada1.discourse-cdn.com/flex030/uploads/saleae/original/1X/1354dfbf68364dc0862fa26257b3d9d2ce7858ab.png)

And was wondering if this setting was available to the python extension

[Next page](https://discuss.saleae.com/t/hla-spi/1329.md?page=2)
