Skip to main content

Twai Nodes

The TWAI (CAN) driver enables communication over the CAN bus, supporting message transmission, reception, filtering, and error handling.

Config Nodes​

Can twai config​

Config for can twai tx, rx pins

Inputs

  • Transmit pin : TWAI transmit (TX) pin is used to send CAN messages. It must be connected to the TX line of the CAN transceiver.
  • Receive pin : TWAI receive (RX) pin is used to receive CAN messages. It must be connected to the RX line of the CAN transceiver.
  • Can bus channel no. : Identifier for the CAN bus controller. Used to distinguish multiple CAN controllers in a system.
  • Operating mode : Sets the TWAI (CAN) operating mode. 'Normal' allows full communication, 'No Ack Require' sends messages without expecting an acknowledgment, and 'Listen Only' monitors the bus without sending data.

Proc Nodes​

can twai driver install​

Install TWAI driver.

Inputs

  • Can twai config : Defines the TWAI (CAN) driver configuration, including filter settings, timing parameters, and mode selection.
  • Clkout io : Specifies the GPIO pin used for the TWAI clock output signal.
  • Bus off io : Defines the GPIO pin to indicate a bus-off condition in the TWAI module.
  • Tx queue len : Specifies the length of the TX message queue in the TWAI driver.
  • Rx queue len : Specifies the length of the RX message queue in the TWAI driver.
  • Alerts enabled : Enables specific TWAI alerts. 'TWAI_ALERT_ALL' activates all alert conditions.
  • Clkout divider : Sets the clock output divider to control the frequency of the TWAI clock output.

can twai start​

Start the TWAI driver.

Inputs

  • Can twai config : Defines the TWAI (CAN) driver configuration, including settings for filters, timing parameters, and operating mode.

can twai stop​

Stop the TWAI driverr.

Inputs

  • Can twai config : Defines the TWAI (CAN) driver configuration, including settings for filters, timing parameters, and operating mode.

can twai driver uninstall​

Uninstall the TWAI driver.

Inputs

  • Can twai config : Defines the TWAI (CAN) driver configuration, including settings for filters, timing parameters, and operating mode.

can twai transmit​

To transmit the sensor data.

Inputs

  • Can twai config : Defines the TWAI (CAN) driver configuration, including settings for filters, timing parameters, and operating mode.
  • Identifier : CAN message identifier (Standard: 11-bit, Extended: 29-bit).
  • Tx buff : Data buffer for the CAN message payload (0-8 bytes for Classic CAN, 0-64 bytes for CAN FD).
  • Frame format : Data buffer for the CAN message payload (0-8 bytes for Classic CAN, 0-64 bytes for CAN FD).
  • Remote frame : Data buffer for the CAN message payload (0-8 bytes for Classic CAN, 0-64 bytes for CAN FD).
  • Single shot transmission : Determines whether the CAN frame should be retransmitted on error (Normal Transmission) or sent only once (Single Shot Transmission).
  • Self reception request : Allows the device to receive its own transmitted CAN frames (Self Reception) or disables this feature (Normal Transmission).
  • Dlc non comp : Defines whether the Data Length Code (DLC) follows ISO CAN specifications (≤ 8 bytes) or allows non-ISO compliant messages (> 8 bytes).

can twai receive​

To receive the data of the twai device.

Inputs

  • Can twai config : Defines the TWAI (CAN) driver configuration, including settings for filters, timing parameters, and operating mode.

can twai read alerts​

Read TWAI driver alerts.

Inputs

  • Can twai config : Defines the TWAI (CAN) driver configuration, including settings for filters, timing parameters, and operating mode.
  • Ticks to wait : Defines the number of RTOS ticks to wait before the function times out. A value of 0 means no waiting, while a nonzero value allows the function to block for the specified number of ticks.

can twai reconfigure alerts​

Reconfigure which alerts are enabled.

Inputs

  • Can twai config : Defines the TWAI (CAN) driver configuration, including settings for filters, timing parameters, and operating mode.
  • Alerts enabled : Bitwise OR of alert flags that should be enabled. Example: 0x800 (BUS_OFF) | 0x400 (RX_QUEUE_FULL).

can twai get status​

Get current status information.

Inputs

  • Can twai config : Defines the TWAI (CAN) driver configuration, including settings for filters, timing parameters, and operating mode.

can twai initiate recovery​

Start the bus recovery process.

Inputs

  • Can twai config : Defines the TWAI (CAN) driver configuration, including settings for filters, timing parameters, and operating mode.

can twai clear transmit queue​

Clear the transmit queue.

Inputs

  • Can twai config : Defines the TWAI (CAN) driver configuration, including settings for filters, timing parameters, and operating mode.

can twai clear receive queue​

Clear the receive queue.

Inputs

  • Can twai config : Defines the TWAI (CAN) driver configuration, including settings for filters, timing parameters, and operating mode.

Event Nodes​

on can twai receive​

An Event Producer Node when receive the data on twai device. It will receive the indetifier, frame format(which contain a 29-bit ID and an 11-bit ID) and remote frame.

Inputs

  • Can twai config : Defines the TWAI (CAN) driver configuration, including settings for filters, timing parameters, and operating mode.