canCfg - Configure CAN interface

Configure a CAN interface. This command can be used to adjust the speed bit settings of a CAN port. Additionally, it can be used to configure additional CAN ports via USB.

Usage:

- command: canCfg <port> <bitrate> [fd]
  [retry: <retryCount>]
  [id: <usbDeviceID>]
  [path: <usbDevicePath>]
  [interface: <usbDeviceInterface>]
  [with:
    [- tq <tq>]
    [- phaseSeg1 <phaseSeg1>]
    [- phaseSeg2 <phaseSeg2>]
    [- propSeg <progSeg>]
    [- samplePoint <samplePoint>]
    [- sjw <sjw>]
    [- dataBitrate <dataBitrate>]
    [- dataTQ <dataTQ>]
    [- dataPropSeg <dataProgSeg>]
    [- dataPhaseSeg1 <dataPhaseSeg1>]
    [- dataPhaseSeg2 <dataPhaseSeg2>]
    [- dataSamplePoint <dataSamplePoint>]
    [- dataSJW <dataSJW>]]

Argument

Description

port

CAN port name: CAN0, CAN1, CAN2, etc. CAN0 is the PLT’s built-in port; CAN1 and above refer to externally attached USB CAN dongles.

bitrate

Nominal (arbitration-phase) CAN bit rate, in bits per second. Maximum 1000000 (1 Mbit/s) on the built-in CAN0 port.

fd

Added in version pltOS: v2.0

Enable CAN-FD on the port. Only supported on externally attached USB CAN-FD dongles — the built-in CAN0 port does not support CAN-FD and rejects this flag.

retryCount

Optional: Number of times to retry the test step

usbDeviceID

Optional: USB device identifiers: VID:PID.

usbDevicePath

Optional: USB device path: port. .port.

usbDeviceInterface

Optional: USB device interface: interface_number.

with

Additional command parameters, used to fine-tune CAN bit timing beyond the nominal bitrate (and, for CAN-FD, the with: dataBitrate data-phase rate). All fields are optional and apply only to externally attached USB CAN dongles. (optional)

  • tq - Time quantum count

  • phaseSeg1 - PHASE-SEG1 value (1…8)

  • phaseSeg2 - PHASE-SEG2 value (1…8)

  • propSeg - PROP_SEG value (1…8)

  • samplePoint - Sample point, as a fraction of bit time (0.000…0.999)

  • sjw - Synchronization Jump Width (1…4)

  • dataBitrate - CAN-FD data-phase bit rate, in bits per second (1…1000000)

  • dataTQ - Data-phase time quantum count

  • dataPropSeg - Data-phase PROP_SEG value (1…8)

  • dataPhaseSeg1 - Data-phase PHASE-SEG1 value (1…8)

  • dataPhaseSeg2 - Data-phase PHASE-SEG2 value (1…8)

  • dataSamplePoint - Data-phase sample point, as a fraction of bit time (0.000…0.999)

  • dataSJW - Data-phase Synchronization Jump Width (1…4)

External USB CAN dongles can be configured as CAN ports by using the usbDeviceID, usbDevicePath, or usbDeviceInterface fields. The first canCfg step for a given USB port attaches and configures the underlying interface; a later canCfg step for the same port reconfigures it in place.

Note

The built-in CAN0 port, which does not support CAN-FD and is limited to a 1 Mbit/s maximum bit rate, can not be redefined. This means that the usbDeviceID, usbDevicePath, and/or usbDeviceInterface parameters can’t be set on CAN0.

Examples