IsoTp.CANBus.Net
1.0.7
dotnet add package IsoTp.CANBus.Net --version 1.0.7
NuGet\Install-Package IsoTp.CANBus.Net -Version 1.0.7
<PackageReference Include="IsoTp.CANBus.Net" Version="1.0.7" />
<PackageVersion Include="IsoTp.CANBus.Net" Version="1.0.7" />
<PackageReference Include="IsoTp.CANBus.Net" />
paket add IsoTp.CANBus.Net --version 1.0.7
#r "nuget: IsoTp.CANBus.Net, 1.0.7"
#:package IsoTp.CANBus.Net@1.0.7
#addin nuget:?package=IsoTp.CANBus.Net&version=1.0.7
#tool nuget:?package=IsoTp.CANBus.Net&version=1.0.7
IsoTp.CANBus.Net
A professional .NET implementation of the ISO 15765-2 (ISO-TP) protocol. This library provides a robust transport layer for automotive diagnostic standards like UDS (ISO 14229) over CAN Bus.
Features
- Segmentation: Automatically breaks down large messages into multiple CAN frames.
- Flow Control: Manages transmission pace using SEPARATION_TIME_MIN and BLOCK_SIZE.
- Reassembly: Reconstructs multiple incoming CAN frames back into a single diagnostic message.
- Flexible Driver: Easily integrates with any CAN hardware (Vector, PEAK-System, USB-CAN, etc.) via a simple callback mechanism.
Installation
dotnet add package IsoTp.CANBus.Net
Quick Start
1. Initialize CAN Driver
The ICanDriver acts as a bridge between this library and your hardware.
using IsoTp.CANBus.Net;
var canDriver = new ICanDriver();
// Link your hardware-specific send method here
canDriver.SendCanMessage = (id, data, length) => {
// Call your CAN hardware API (e.g., PCAN, Vector, socketcan, etc.)
// YourHardware.Write(id, data);
};
To receive messages, you must invoke the hardware bridge.
// Inside your hardware receive loop
public void OnCanFrameArrived(uint id, byte[] data)
{
// Important: This triggers the ISO-TP reassembly logic
canDriver.InvokeReceive(id, data);
}
2. Configure ISO-TP Parameters
Define the addressing scheme. Flow control settings (STmin, BS) have sensible defaults.
// Example for a different ECU (e.g., Transmission Control Module)
// These IDs are just examples; use the ones specific to your project.
uint myRequestID = 0x712; // Example: Physical Request ID
uint myResponseID = 0x71A; // Example: Physical Response ID
uint myFunctionID = 0x7DF; // Example: Functional Broadcast ID (Optional)
// Initialize with your custom IDs
var tpParams = new IsoTpParams(myRequestID, myResponseID, myFunctionID);
// Optional: Override defaults if needed
// tpParams.SEPARATION_TIME_MIN = 10; // 10 ms
// tpParams.BLOCK_SIZE = 8; // 8 frames per block
3. Setup Processor and Listen for Messages
The IsoTpProcessor handles all the complex logic of the protocol.
var processor = new IsoTpProcessor(tpParams, canDriver);
// Subscribe to reassembled messages
processor.OnMessageReceived += (id, data) => {
Console.WriteLine($"Received full message from ID {id:X}: {BitConverter.ToString(data)}");
};
4. Sending Data
To send a large diagnostic request, the processor will handle the segmentation automatically.
byte[] requestData = new byte[] { 0x22, 0xF1, 0x90 };
processor.SendData(requestData);
// When hardware receives a frame, push it into the driver
// canDriver.InvokeReceive(0x7E8, new byte[] { ... });
Key Parameters Explained
| Parameter | ISO-TP Term | Unit | Description |
|---|---|---|---|
SEPARATION_TIME_MIN |
STmin | Milliseconds | The minimum time wait between two Consecutive Frames (CF). Helps prevent overloading the receiver. |
BLOCK_SIZE |
BS | Frames | The number of Consecutive Frames (CF) allowed to be sent in a single block before waiting for a Flow Control confirm. |
Note: Setting
BLOCK_SIZE = 0means the sender can transmit all remaining frames without waiting for further Flow Control.
License
Licensed under the MIT License.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.