Skip to content

colakfat/CAN-Analyzer-Pro

Repository files navigation

CAN Analyzer Pro

Languages: Türkçe · English

A multi-adapter CAN bus analysis and transmission application developed for Vestel PCB test systems. It is a Windows desktop (WinForms) program that can listen to and send messages over different CAN hardware from a single interface.

  • Platform: .NET Framework 4.8, Windows (WinForms)
  • Architecture: AnyCPU (Prefer32Bit=false → runs 64-bit on x64 Windows)
  • Version: V1.0.0

CanBus

CAN Analyzer Pro

Table of contents


Features

  • Multi-adapter support: Vector XL, PEAK USB, Kvaser CAN and UT146 (serial/COM) from one interface. Adapters are used through a common routing layer (AdapterKind).
  • CAN Monitor: Received (Rx) and transmitted (Tx) messages are shown live in a table. Columns:
    • Time, ID, Name, Type (Rx/Tx), DLC, Data, Cycle(ms), Count
    • Messages are grouped into a single row per ID; the counter and period (Cycle) update automatically.
  • Filter / naming:
    • Add an ID + name to the list so meaningful names appear in the monitor's "Name" column.
    • Unchecking an item hides its name; re-checking restores it.
    • The filter list can be saved/loaded as a .flt file.
  • Message transmission (Tx):
    • One-shot send of the selected row.
    • When Active is checked, periodic transmission at the entered period (threadpool-based timer + high-resolution Windows timer for stable timing).
    • When an ID is entered, the Data field is auto-filled with 00 00 00 00 00 00 00 00.
    • Sent messages appear in the monitor as Tx.
  • Export: The monitor contents can be saved as CSV.
  • Statistics: Total messages, messages per second (fps), unique ID count, and connection uptime.

Supported hardware

Adapter Interface Driver / library Notes
Vector XL Vector XL Driver vxlapi_NET.dll (+ vxlapi.dll / vxlapi64.dll) The channel must be assigned to an application in Vector Hardware Config.
PEAK USB PCAN-Basic PCANBasic.NET.dll + PCANBasic.dll (x86/x64) The proper native DLL is selected based on process bitness.
Kvaser CAN Kvaser CANlib canlibCLSNET.dll (x64) + native canlib32.dll driver x64 only; the app must run 64-bit (see Architecture notes).
UT146 Serial (USB→UART) System.IO.Ports (COM) CAN2UART converter; identity is verified with the FFFFFFFFFC command. CAN bit rate is 500 kbit in firmware.

Requirements

  • Windows (10/11), .NET Framework 4.8
  • The driver of the adapter you want to use must be installed:
    • Vector: Vector Driver Setup + Vector Hardware Config
    • PEAK: PEAK-System drivers (PCAN-USB)
    • Kvaser: Kvaser Drivers for Windows (installs native canlib32.dll)
    • UT146: USB-Serial (CH340 / CP210x, etc.) COM driver
  • To build: Visual Studio 2022 (MSBuild) and NuGet packages (referenced under packages/).

Build

Open Can_Analyzer_Pro.csproj in Visual Studio and build. From the command line:

& "C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\MSBuild.exe" `
  "Can_Analyzer_Pro.csproj" /t:Build /p:Configuration=Debug

Output: bin\Debug\Can_Analyzer_Pro.exe. The relevant native DLLs (vxlapi, PCANBasic x86/x64, canlibCLSNET) are copied to the output folder during build.

Important: The project is configured as AnyCPU + Prefer32Bit=false, so it runs 64-bit on x64 Windows. Because Kvaser (canlibCLSNET.dll) is x64 only, this setting is required.


Usage

  1. Select device: Pick the adapter from the top list (Vector XL / PEAK USB / Kvaser CAN / UT146).
  2. Select channel: Click "Refresh" to list channels.
    • Vector/PEAK/Kvaser → hardware channels.
    • UT146 → only the connected COM ports (e.g. COM50).
  3. Select baud rate and click Connect.
  4. Monitoring: Incoming messages appear in the CAN Monitor table.
  5. Naming: Add an ID + name in the filter section; it appears in the "Name" column. You can save it as .flt.
  6. Transmission: Enter ID/Data/Period in the Tx table.
    • Send → one-shot.
    • Active → periodic transmission.
  7. Save: Export the monitor contents as CSV.

Project structure

Can_Analyzer_Pro/
├─ Form1.cs / Form1.Designer.cs   # Main UI + adapter routing, monitor, filter, Tx logic
├─ Vector XL/
│  ├─ VectorManager.cs            # Active Vector driver (vxlapi_NET)
│  └─ VectorXLManager.cs          # (Disabled / reference — commented out)
├─ Peak USB/
│  └─ PeakUsbManager.cs           # PCAN-Basic wrapper
├─ Kvaser USB/
│  └─ KvaserCanManager.cs         # canlibCLSNET wrapper
├─ UT146/
│  └─ UT146CanManager.cs          # Serial (COM) CAN2UART driver
├─ libs/                          # vxlapi*.dll, PCANBasic (x86/x64), canlibCLSNET.dll ...
└─ packages/                      # NuGet dependencies

Each manager exposes a similar public surface: isConnected, lastError, channel listing, Connect, Disconnect, message sending, and an incoming-message event. Form1 funnels these events into a common HandleCanMessage(...) method.


Architecture notes

  • Common message handling: All adapters' incoming/outgoing messages go through HandleCanMessage(...) into the same monitor/statistics path.
  • Consistent Cycle(ms): Cycle is computed from a single application monotonic clock (Stopwatch) instead of device timestamps. This prevents the different clock bases of adapters/Rx-Tx paths from mixing, avoiding incorrect (very large) Cycle values.
  • Tx visibility:
    • PEAK/Kvaser: the transmitted frame comes back as Rx via hardware echo (PCAN echo frames / Kvaser TXACK).
    • Vector/UT146: since no hardware echo is delivered, the transmitted frame is added to the monitor manually as "Tx".
  • Stable periodic transmission: System.Threading.Timer (off the UI thread) + timeBeginPeriod(1) for ~1 ms resolution; an Interlocked guard prevents overlap.

Troubleshooting

Kvaser: "driver error / Access denied" or device not listed

  • The Kvaser drivers must be installed (native canlib32.dll).
  • canlibCLSNET.dll is x64; the app must run 64-bit. The project is set with Prefer32Bit=false. Make sure the platform is AnyCPU in VS.

Vector: no channels found

  • The channel must be assigned to an application in Vector Hardware Config (application name: CAN Analyzer Pro V1.0.0).

UT146: "Cannot read COM port list / Access is denied"

  • Channel listing also works via SerialPort.GetPortNames() instead of the admin-requiring WMI, so the exe lists ports even as a normal user.
  • If you get "access denied" while connecting, the port is open in another program (test software, terminal) or a second instance of the app. Serial ports are exclusive — close the other program.

Vector: sent messages don't appear in the monitor

  • In the current version Vector Tx is added to the monitor manually; if the issue persists, check the Send return value and that the channel is opened with init access.

This application was developed to monitor line traffic and send test messages at CAN-based PCB test stations.

About

Professional Multi-Vendor CAN Bus Analysis Software for Automotive and Embedded Systems

Topics

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors

Languages