FrameV2 API

Hello!
I had a Logic clone which i used with Sigrok PulseView. Created my own decoder in one day and looks great!

But to be honest, i was feeling guilty for the clone, so i decided to buy an original Logic :slight_smile:
When i received it, i realized that the new Logic 8 is not compatible with PulseView, so decided to “port” my decoder to the Saleae Logic software. After a painful week ive finish my LLA. Now the step to the HLA so i can show some useful information… but after 2 days of unsuccessful work ive found that its NOT POSSIBLE to create a HLA from a custom LLA. Not even a basic one! The HLA dont even see the frames :tired_face:
In other topic ( Custom protocol implementation - advice - #12 by powell.aaron.2019 )this is partially covered, and some workaround explained, although i could not keep up the work only with this. Hopefully someone can help me.

  1. In order for the HLA can “read” the frames from LLA, they must be FrameV2 class, which is implemented in the “alpha” branch of the SDK. But, FraveV2 is not compiled unless ‘LOGIC2’ is declared.
#ifdef LOGIC2
class FrameV2Data;
class LOGICAPI FrameV2
{
  public:
    FrameV2();
    ~FrameV2();

    void AddString( const char* key, const char* value );
    void AddDouble( const char* key, double value );
    void AddInteger( const char* key, S64 value );
    void AddBoolean( const char* key, bool value );
    void AddByte( const char* key, U8 value );
    void AddByteArray( const char* key, const U8* data, U64 length );

    FrameV2Data* mInternals;
};
#endif

Ive tried defining LOGIC2 in my code, but looks this makes no change and FrameV2 is no being compiled.
How can I enable de compilation of v2 frames?

  1. Once I have v2 frames available, would be needed some documentation in order to be able to use them. If not, at least some direction or small advice would be much appreciated.

Hope someone can help me on how to compile the FrameV2, and a little advice on how to use it :grin:

Happy to help! Sorry we haven’t updated the documentation yet, it’s been a very busy few weeks.

What example did you use when you started developing your LLA?

For new development I strongly recommend starting with one of our existing LLAs, for example the i2c-analyzer:

That link goes to the “alpha” branch. We’ll want to get that merged once we update our documentation.

A few main points:

  1. We use cmake for all of our analyzers to keep them consistent and to make cross-platform building easy.
  2. If you look in the CMakeLists.txt file, we call “add_definitions( -DLOGIC2 )”. This sets the LOGIC2 preprocessor definition for everything that is compiled.
  3. The “cmake/ExternalAnalyzerSDK.cmake” file is the same between all of our analyzers. Inside it downloads the “alpha” branch of the analyzer SDK, which you need to use FrameV2.

If you’re not using CMake, and are just developing locally, using Visual Studio or something similar (not CMake) then you have 3 easy options to get that define working:

  1. you can delete the #ifdef LOGIC2 / #endif from the header files. (if you plan to share your LLA on github, don’t do this)
  2. you can add #define LOGIC2 at the very top of every file that includes one of the saleae headers, above the include statement.
  3. you can open the target settings in visual studio, go to the preprocessor definitions, and add LOGIC2 there. This is basically what CMake does for us.

If you are using CMake, “add_definitions( -DLOGIC2 )” will work, but target_compile_definitions is the more modern CMake command for this.

Lastly, if you post your source on github, we would be happy to take a look for you.

I started to build my analyzer from the SampleAnalyzer you suggest on your documentation.
I did declare LOGIC2 on the preprocessor settings, but then I get an error message “LINK : fatal error LNK1181: can not open Analyzer64.lib”

Ok, once i manage to solve that, when I AddFrameV2, do I need to CommitResults()? Is needed to ReportProgress?

Thanks for your help!

@compras Let me check with our software team. Unfortunately, since FrameV2 documentation is not officially released yet, we’re not able to provide extensive support for it at the moment. We’ve unfortunately been quite booked with other tasks at the moment, I’ll let you know once I’ve had a chance to meet with the team here!

Found! In the linker options it was looking for Analyzer64.lib, while in the alpha version you renamed this to Analyzer.lib
Changed that and now seems to be working!
I will reformulate my LLA to pass V2 frames, and the HLA to show the correct data.

Two more questions:

Is it possible to have multiple frames one on top of the other like in the first picture of this post?
Ive read that i could do this by creating one HLA for each “row” i want. But would be much better to just have one HLA with all the rows :slight_smile:

Once i use AddByte, AddString, AddInteger, etc in the LLA to add data to the v2 frame, how do i “extract” this data in the HLA?

Thanks

Hi @compras,

One thing I should have said right away, the SampleAnalyzer is actually kinda old, and not the best starting place for using the analyzer SDK.
We need to update it to use cmake, and to use the latest version of the AnalyzerSdk.

For one, that would remove the need to rename the Analyzer.lib file. You will need to target a recent version of the Analyzer SDK to get access to the frameV2 functions. If you’re already able to call the FrameV2 functions, then you have it.

Is it possible to have multiple frames one on top of the other like in the first picture of this post?
Ive read that i could do this by creating one HLA for each “row” i want. But would be much better to just have one HLA with all the rows

We designed the API with non-overlapping frames in mind, but this is a great suggestion! Could you add a bit of background to what you would like to use this for to our ideas tracking site here, and vote for the feature?

Once i use AddByte, AddString, AddInteger, etc in the LLA to add data to the v2 frame, how do i “extract” this data in the HLA?

In your HLA, the decode function you write will be called once for each FrameV2 you produce in your LLA.
You can access everything you need like this:
frame.type
frame.data[“yourKey”]
frame.start_time
self.temp_frame.end_time

You can add as many keys as you need from C++, and they will all be accessible in the “frame.data” dictionary.

Each time decode is called, you can decide to create none, one, or more than one new HLA frame. When you create frames, you just need to keep them in sequential order in time, and not overlap.

I recommend taking a look at our documentation here:

Let us know if you have any more questions!

Ok, just voted and added background for the multiple rows of frames. Hopefully will be implemented :slight_smile:

Regarding the old SDK… well, i just followed the documentation available. Didnt realized that it was outdated until I finish my LLA and noticed that didnt work :confounded:

Thanks for the information about the v2 frames, I will try to make the final LLA and HLA during xmas holidays.