Giter VIP home page Giter VIP logo

abccspianalyzer's Introduction

Anybus CompactCom SPI Protocol Analyzer Plugin

windows_build ubuntu_build macos_build

Copyright © 2015-2022 HMS Industrial Networks, Inc.

THE CODE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. HMS DOES NOT WARRANT THAT THE FUNCTIONS OF THE CODE WILL MEET YOUR REQUIREMENTS, OR THAT THE OPERATION OF THE CODE WILL BE UNINTERRUPTED OR ERROR-FREE, OR THAT DEFECTS IN IT CAN BE CORRECTED.


  1. Description
  2. System Requirements
  3. Precompiled Releases
  4. Compile & Install
  5. Generating Releases
  6. Documentation
  7. Changelog
  8. Licenses

This plugin, in conjunction with the Saleae Logic hardware and software, provides an easy-to-use interface for analyzing bi-directional (full-duplex) Anybus CompactCom (ABCC) SPI protocol communication.

Each field within an SPI packet is added as a multi-layered bubble-text within the Logic software. Basic markup is displayed when zoomed-out, while more detailed information is displayed when zoomed-in.

The decoded results are indexed and searchable within the Logic software; for even more detail, the user can export the message data or process data to a CSV file to be imported into Excel (or similar) for further analysis. For instance, this functionality may reduce the effort required to extract file data transferred from ABCC object messaging, or to plot a waveform extracted from process data using either local timestamp information or the network timestamps (if supported by the network protocol).

Overview of Plugin

  • Saleae Logic Software
    • Recommended Version: 1.2.29
    • Other versions will work so long as Analyzer SDK version 1.1.32 is compatible.
    • NOTE: At this time, Saleae Logic V2 is not supported.
  • Saleae Logic Hardware
    • While any of Saleae Logic hardware offerings is expected to be compatible, it is important to consider sample rate limitations of the Logic hardware and what SPI data rate the ABCC host-module communication is using. The absolute minimum requirement for sufficiently sampling the communication is 2x the frequency of the SPI SCLK. The ABCC is able to work over a wide range of clock rates where the maximum is specified at 20MHz. So to be able to support this would require at a minimum the ability to sample at 40MSamples/second. Keep in mind that these analyzers may reduce sample rate depending on how many channels on the analyzer are active, so it is imperative that the hardware is able to sufficiently sample the SPI bus for the number of channels required.
  • PC running:
    • Windows 7 through Windows 10
      • NOTE: At this time Window 11 has compatibility issues with version 1.2.29. Version 1.2.40 resolves this compatibility issue but Saleae dropped support for the decoded protocols subwindow for this version. An alternative solution for using 1.2.29 on Windows 11 would be to use WSLg and attach the Saleae Logic interface via usbpid.exe. See How-To: Connect USB devices.
    • Ubuntu 12.04.2+
    • Mac OSX 10.7 Lion+
  • USB 2.0 or better
    • Using the Saleae Logic on a dedicated USB controller that matches or exceeds the Logic's supported USB version is recommended for ensuring the best possible sampling performance.

Precompiled plugins and documentation are available here: Plugin Releases

While tagged releases are provided which contain pre-compiled libraries and associated documentation, the user may still opt to compile the libraries for themselves.

After cloning this git repository, the user will need to initialize the submodules command in order to fetch the repositories containing the Logic Analyzer SDK. Two copies are used of the same repo, one pointed at the release/master branch and another pointing at the legacy SDK to support debugging.

Example for cloning the repository and fetching/initializing the submodules:

git clone https://github.com/hms-networks/AbccSpiAnalyzer.git
cd AbccSpiAnalyzer
git submodule update --init --recursive

To compile the project please ensure the additional requirements are met:

DEPENDENCIES: Visual Studio 2019, other versions may also work (project retargeting may be necessary)

NOTE: Express or Community versions of Visual Studio may require additional steps to replace occurrences of #include "afxres.h" with #include "windows.h" or installation of the Visual C++ MFC package (this can be done by modifying the Visual Studio installation and enabling the associated feature).

When compiling the project, please ensure that the correct library is linked for the Windows OS being used. The VS solutions provided are setup with the expectation that the host system will be x64. The solutions are also setup for batch build such that an x64 system can compile all supported build configurations with one request. To access this, right-click the Solution 'AbccSpiAnalyzer' item in the Solution Explorer subwindow to access the context menu and select Batch Build....

Cross-compile for GNU/Linux Operating Systems

Also included in the repository is a simple batch file that can be used to quickly build both the Windows and GNU/Linux libraries via the use of Windows 10 WSL (Windows Subsystem for Linux). Cross-compiling for GNU/Linux requires the same set of dependencies documented below for GNU/Linux.

Custom Visual Studio Projects

If there is a need to create a new Visual Studio project, ensure the linker is configured to include the correct library:

  • If using Win64, specify ./sdk/release/Analyzer64.lib in the linker input.
    • The configuration manager has this setup as x64.
  • If using Win32, specify ./sdk/release/Analyzer.lib in the linker input.
    • The configuration manager has this setup as Win32.

Once compiled, a file called AbccSpiAnalyzer.dll or AbccSpiAnalyzer64.dll in the either ./plugins/Win32/ or ./plugins/Win64 folder, respectively. Copy this DLL to the user's Saleae Logic software installation in the "Analyzers" folder:

  • Example: C:\Program Files\Saleae LLC\Analyzers\AbccSpiAnalyzer.dll

The analyzer is now ready to be used and can be found in the same way that other protocol analyzers are added to the Logic software.

  • To compile simply run the build_analyzer.py python script. This script will compile the appropriate shared object library based on the host system.

DEPENDENCIES: Python, G++

ADDITIONAL DEPENDENCY: Depending on the system it may also be required to install g++-multilib in order for the python build script to complete without error. This is so a 64-bit system can cross-compile for 32-bit machines.

Once compiled, a file called AbccSpiAnalyzer.so or AbccSpiAnalyzer64.so will reside in the either ./plugins/Linux/ or ./plugins/Linux64 folder, respectively. Copy this shared object to the user's Saleae Logic software installation in the "Analyzers" folder.

  • To compile simply run the build_analyzer.py python script.

DEPENDENCIES: Python, G++

Once compiled, a dynamic library called AbccSpiAnalyzer.dylib will reside in the ./plugins/OSX/ folder. Copy this dynamic object to the user's Saleae Logic software installation in the "Analyzers" folder.

This section is not typically applicable for most users, but is documented here for completeness. The python script make_release.py will generate the ZIP file used for releases. However to use this without error a user must collect the compiled library files for each platform. On a Windows 64-bit host with Ubuntu bash on Windows using WSL (Windows Subsystem for Linux), it is possible to generate all required library files with the exception to macOS using cross_compile.bat. Obtaining the macOS dynamic library is a separate manual step, transferring the dylib from the macOS build host to the Windows host.

Windows:

py.exe -3 -m pip install -r py_requirements.txt
py.exe -3 ./make_release.py

macOS/Linux:

python3 -m pip install -r py_requirements.txt
python3 ./make_release.py

For complete details regarding this plugin's functionality please consult the Wiki found within this repository or Quick Start Guide included in this repository's documentation folder. The Wiki is expected to contain more up-to-date details on the plugin's functionality in reference to the master branch whereas the PDF document will typically be updated when a new tagged release is made and is provided as part of the tagged release's downloadable assets.

For details on the Logic SDK's API please refer to the Saleae's Protocol Analyzer SDK page.

Please see CHANGELOG.md provided within this repository for details on the changelog history.

Please see LICENSE.md provided within this repository for details on the software licensing.

abccspianalyzer's People

Contributors

joca-hms avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

abccspianalyzer's Issues

Add option for specifying network type

Objects such as the network configuration object have network specific instances. Without having a guaranteed way of determining the network type these instances cannot be reliably interpreted. A dropdown option that allows the users to switch from "unspecified" network to a specific network such as EtherCAT, EtherNet/IP, ProfiNet, etc. would make this possible.

Support message segmentation

Add support for (indication of) message segmentation for the subset of objects/cmds that support this mechanism. This includes:

  • Write_Assembly_Data (0x10) (Asm Object)
  • Receive (0x15) (Socket Interface Object)
  • Receive_Form (0x16) (Socket Interface Object)
  • Send (0x17) (Socket Interface Object)
  • Send_To (0x18) (Socket Interface Object)
  • Set_Configuration_Data (0x11) (EIP Host Object)
  • Get_Configuration_Data (0x13) (EIP Host Object)

Improve data export functionality

Currently frames are always offloaded as 64-bit values regardless of the actual size. This functionality should be updated to export the exact size of the frame

Incorrect handling in exported message/process data results

SPI fragments or extra clocking after a complete packet results in missing new line in the resulting output.

This behavior can be seen when running the current simulation implementation and exporting the message data or process data to a CSV file

Add check for de-assertion of chipselect after a complete packet has been received

When using 4-wire SPI the chipselect should be used to acquire packet level synchronization. This means the SPI should be controlled in the following way:

  • Assert chipselect
  • Send SPI packet
  • Deassert chipselect

The protocol analyzer could help with detecting invalid behavior where the host attempts to send multiple packets in one strobe of the chipselect.

Last SPI packet may not be committed to results

This issue is related to a past issue where the last SPI frame was not being committed to the results. The issue being reported here is just one level higher in the reporting of results logic.

To reproduce, create an explicit request from the ABCC network interface (object message command) and have the host break on receipt. Capturing this event on the logic analyzer and exporting the results to a CSV file will show that the command is missing from the exported results even though the bubble text displays all the correct information.

Add support for reading UTF-16-BOM log files

It is not uncommon for a user to save a log file in Windows and end up with a file using UTF-16-BOM. Currently, the the log file simulation logic appears to have an issue with such files. Instead of forcing a user to re-encode the file, it is more user friendly to support this other common encoding.

Improve the usage of "Error Markers"

Error marking is nice to have as a quick visual indicator of an important event. Currently error markers are not prioritized over normal markers and have a tendency to be masked from visibility when multiple markers are in close proximity. Once, or if, this is behavior is changed consider expanding on the usage of error markers to capture a variety of error events (SPI physical level, ABCC SPI protocol level, ABCC messaging level)

Jitter monitoring

Consider adding basic detection of jitter, signal-integrity, or baud rate settings issues. The state of MOSI/MISO could be analyzed for change-of-state. If state changes in the +/-20% window of the sample edge of the clock signal, then produce a notification. Consider making this window adjustable.

Multi-instance plugin

Does the plugin handle multiple instances running simultaneously? If not add support for this to help in gateway applications.

Update analyzer to automatically build binaries using github actions

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 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. 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!

Add base datatype information to lookup info to filter display radix option

Certain data may be purely numeric (integer) and it may not be desirable to ever display this data as an ASCII character/string. Such and example is the "message size" of an ABCC message. It should be possible to add a base datatype field to each lookup entry to indicate if it is suppose to be displayed strictly as "integer" or if it may be appropriate to display as ASCII.

Improve 3-wire transaction alignment

Improve 3-wire transaction alignment by including an inter-packet gap parameter. Without this, bad captures are likely in this mode if the beginning of the capture takes place in the middle of a transaction. That said the user can use the built-in feature "Re-run starting at timing marker..." option.

Improve support for log file encoding for log file simulation

Currently, log files encoded as UTF16-BOM or UTF8-BOM will not be read correctly by the simulation logic. Since these are commonly encountered encoding formats, basic support should be added to avoid confusing situations for users where the tool does not produce an indication of an incompatible file format and simply runs the standard (non-log file) simulation.

Decoded result for "clocking alert" does not link to a frame in bubble text

The decoded result message below does not link to a bubble text frame:
"!CLOCKING: Unexpected ABCC SPI Clocking Behavior"

The intended behavior is that clicking on this decoded result will navigate to the bubble text frame containing the following detailed string:
"CLOCKING: (ABCC SPI Clocking. The analyzer expects one transaction per 'Active Enable' phase.)"

Add support for exception information data

It should be possible to detect a message directed towards the Network Object's "Exception Information". When the host requests this information ({object=1, instance=1, attribute=6} or the network specific exception attribute) it would be nice to enumerate the message data with the relevant "string name".

The analyzer's logical state will be incorrect in certain cases where the enable toggles without clocking any data

This issue can be worked around by placing a marker and decoding past the problematic glitch.

This main issue has been identified as being a problem in the analyzer's GetByte method. This routine currently only attempts to move past an "empty transaction" via one call to AdvanceToActiveEnableEdgeWithCorrectClockPolarity(). The issue is that this assumes everything will be OK past this point and does not attempt to re-apply the same logical check after advancing in the Logic bitstream.

Error when compiling

Hi, I'm getting errors when compiling it. How can I fix this?

$ sudo python build_analyzer.py
Running on Darwin
g++ -I"./sdk/release/include" -O3 -w -c -fpic -std=c++11 -o "./plugins/OSX/AbccSpiAnalyzerLookup.o" "source/AbccSpiAnalyzerLookup.cpp"
source/AbccSpiAnalyzerLookup.cpp:16:10: fatal error: 'AnalyzerHelpers.h' file not found
#include "AnalyzerHelpers.h"
^~~~~~~~~~~~~~~~~~~
1 error generated.
g++ -I"./sdk/debug/include" -O0 -w -c -fpic -g -std=c++11 -m32 -o "./plugins/OSX/Debug/AbccSpiAnalyzerLookup.o" "source/AbccSpiAnalyzerLookup.cpp" -D _DEBUG
source/AbccSpiAnalyzerLookup.cpp:16:10: fatal error: 'AnalyzerHelpers.h' file not found
#include "AnalyzerHelpers.h"
^~~~~~~~~~~~~~~~~~~
1 error generated.
g++ -I"./sdk/release/include" -O3 -w -c -fpic -std=c++11 -o "./plugins/OSX/AbccSpiAnalyzer.o" "source/AbccSpiAnalyzer.cpp"
In file included from source/AbccSpiAnalyzer.cpp:14:
source/AbccSpiAnalyzer.h:17:10: fatal error: 'Analyzer.h' file not found
#include "Analyzer.h"
^~~~~~~~~~~~
1 error generated.
g++ -I"./sdk/debug/include" -O0 -w -c -fpic -g -std=c++11 -m32 -o "./plugins/OSX/Debug/AbccSpiAnalyzer.o" "source/AbccSpiAnalyzer.cpp" -D _DEBUG
In file included from source/AbccSpiAnalyzer.cpp:14:
source/AbccSpiAnalyzer.h:17:10: fatal error: 'Analyzer.h' file not found
#include "Analyzer.h"
^~~~~~~~~~~~
1 error generated.
g++ -I"./sdk/release/include" -O3 -w -c -fpic -std=c++11 -o "./plugins/OSX/AbccSpiSimulationDataGenerator.o" "source/AbccSpiSimulationDataGenerator.cpp"
In file included from source/AbccSpiSimulationDataGenerator.cpp:16:
source/AbccSpiSimulationDataGenerator.h:15:10: fatal error: 'AnalyzerHelpers.h' file not found
#include <AnalyzerHelpers.h>
^~~~~~~~~~~~~~~~~~~
1 error generated.
g++ -I"./sdk/debug/include" -O0 -w -c -fpic -g -std=c++11 -m32 -o "./plugins/OSX/Debug/AbccSpiSimulationDataGenerator.o" "source/AbccSpiSimulationDataGenerator.cpp" -D _DEBUG
In file included from source/AbccSpiSimulationDataGenerator.cpp:16:
source/AbccSpiSimulationDataGenerator.h:15:10: fatal error: 'AnalyzerHelpers.h' file not found
#include <AnalyzerHelpers.h>
^~~~~~~~~~~~~~~~~~~
1 error generated.
g++ -I"./sdk/release/include" -O3 -w -c -fpic -std=c++11 -o "./plugins/OSX/AbccCrc.o" "source/AbccCrc.cpp"
source/AbccCrc.cpp:12:10: fatal error: 'Analyzer.h' file not found
#include "Analyzer.h"
^~~~~~~~~~~~
1 error generated.
g++ -I"./sdk/debug/include" -O0 -w -c -fpic -g -std=c++11 -m32 -o "./plugins/OSX/Debug/AbccCrc.o" "source/AbccCrc.cpp" -D _DEBUG
source/AbccCrc.cpp:12:10: fatal error: 'Analyzer.h' file not found
#include "Analyzer.h"
^~~~~~~~~~~~
1 error generated.
g++ -I"./sdk/release/include" -O3 -w -c -fpic -std=c++11 -o "./plugins/OSX/AbccSpiAnalyzerSettings.o" "source/AbccSpiAnalyzerSettings.cpp"
In file included from source/AbccSpiAnalyzerSettings.cpp:23:
source/AbccSpiAnalyzerSettings.h:15:10: fatal error: 'AnalyzerSettings.h' file not found
#include <AnalyzerSettings.h>
^~~~~~~~~~~~~~~~~~~~
1 error generated.
g++ -I"./sdk/debug/include" -O0 -w -c -fpic -g -std=c++11 -m32 -o "./plugins/OSX/Debug/AbccSpiAnalyzerSettings.o" "source/AbccSpiAnalyzerSettings.cpp" -D _DEBUG
In file included from source/AbccSpiAnalyzerSettings.cpp:23:
source/AbccSpiAnalyzerSettings.h:15:10: fatal error: 'AnalyzerSettings.h' file not found
#include <AnalyzerSettings.h>
^~~~~~~~~~~~~~~~~~~~
1 error generated.
g++ -I"./sdk/release/include" -O3 -w -c -fpic -std=c++11 -o "./plugins/OSX/AbccSpiAnalyzerResults.o" "source/AbccSpiAnalyzerResults.cpp"
In file included from source/AbccSpiAnalyzerResults.cpp:17:
source/AbccSpiAnalyzerResults.h:15:10: fatal error: 'AnalyzerResults.h' file not found
#include "AnalyzerResults.h"
^~~~~~~~~~~~~~~~~~~
1 error generated.
g++ -I"./sdk/debug/include" -O0 -w -c -fpic -g -std=c++11 -m32 -o "./plugins/OSX/Debug/AbccSpiAnalyzerResults.o" "source/AbccSpiAnalyzerResults.cpp" -D _DEBUG
In file included from source/AbccSpiAnalyzerResults.cpp:17:
source/AbccSpiAnalyzerResults.h:15:10: fatal error: 'AnalyzerResults.h' file not found
#include "AnalyzerResults.h"
^~~~~~~~~~~~~~~~~~~
1 error generated.
g++ -L"./sdk/release/lib" -lAnalyzer -dynamiclib -o "./plugins/OSX/libAbccSpiAnalyzer.dylib" "./plugins/OSX/AbccSpiAnalyzerLookup.o" "./plugins/OSX/AbccSpiAnalyzer.o" "./plugins/OSX/AbccSpiSimulationDataGenerator.o" "./plugins/OSX/AbccCrc.o" "./plugins/OSX/AbccSpiAnalyzerSettings.o" "./plugins/OSX/AbccSpiAnalyzerResults.o"
clang: error: no such file or directory: './plugins/OSX/AbccSpiAnalyzerLookup.o'
clang: error: no such file or directory: './plugins/OSX/AbccSpiAnalyzer.o'
clang: error: no such file or directory: './plugins/OSX/AbccSpiSimulationDataGenerator.o'
clang: error: no such file or directory: './plugins/OSX/AbccCrc.o'
clang: error: no such file or directory: './plugins/OSX/AbccSpiAnalyzerSettings.o'
clang: error: no such file or directory: './plugins/OSX/AbccSpiAnalyzerResults.o'
g++ -L"./sdk/debug/lib" -lAnalyzer -dynamiclib -m32 -o "./plugins/OSX/Debug/libAbccSpiAnalyzer.dylib" "./plugins/OSX/Debug/AbccSpiAnalyzerLookup.o" "./plugins/OSX/Debug/AbccSpiAnalyzer.o" "./plugins/OSX/Debug/AbccSpiSimulationDataGenerator.o" "./plugins/OSX/Debug/AbccCrc.o" "./plugins/OSX/Debug/AbccSpiAnalyzerSettings.o" "./plugins/OSX/Debug/AbccSpiAnalyzerResults.o"
clang: error: no such file or directory: './plugins/OSX/Debug/AbccSpiAnalyzerLookup.o'
clang: error: no such file or directory: './plugins/OSX/Debug/AbccSpiAnalyzer.o'
clang: error: no such file or directory: './plugins/OSX/Debug/AbccSpiSimulationDataGenerator.o'
clang: error: no such file or directory: './plugins/OSX/Debug/AbccCrc.o'
clang: error: no such file or directory: './plugins/OSX/Debug/AbccSpiAnalyzerSettings.o'
clang: error: no such file or directory: './plugins/OSX/Debug/AbccSpiAnalyzerResults.o'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.