Skip to main content

Can Class

Package: GHIElectronics.Endpoint.Core
Namespace: GHIElectronics.Endpoint.Core

The CAN ports bundled with EPM815. Use with .NET IoT's CanRaw (Iot.Device.SocketCan, which the GHIElectronics.Endpoint.Devices.Can package brings). Can.Initialize connects the port's pins, sets its bitrate and starts it; then use CanRaw as usual. Each constant is the port's name for CanRaw, fixed by the firmware. A port that goes bus-off after too many errors restarts by itself after 100 ms.

public static class Can

Methods​

Initialize(string port, int bitrate)​

public static void Initialize(string port, int bitrate)

Connects the port's pins, sets its bitrate and starts it

ParameterTypeDescription
portstringCan1 or Can2
bitrateintBits per second, up to 1,000,000; all devices on the bus must use the same

UnInitialize(string port)​

public static void UnInitialize(string port)

Stops the port and gives its pins back, as they were before Initialize

Fields​

Can1​

public const string Can1 = "can0"

FDCAN1: PD1 (TX), PD0 (RX)

Can2​

public const string Can2 = "can1"

FDCAN2: PB13 (TX), PB12 (RX)

MaxBitrate​

public const int MaxBitrate = 1000000

The highest bitrate (1 Mbit/s)