advanced
hardware
communication
CANopen

Communication Protocols

CANopen and MODBUS communication setup for ASI BAC motor controllers

Levy Fleets Team12 de enero de 202510 min read

Communication Protocols

ASI BAC controllers support multiple communication protocols for configuration, monitoring, and network control.

Available Protocols

ProtocolInterfaceUse Case
CANopenCAN BusNetwork control, multi-device systems
MODBUSSerial (TTL)Simple serial communication
TTL SerialDirectConfiguration, debugging

CANopen Protocol

Overview

CANopen is the primary network protocol for BAC controllers, enabling:

  • Remote motor control
  • Real-time telemetry
  • Multi-device networks
  • Parameter configuration

Critical Timeout Parameters

Three essential parameters ensure reliable operation:

ParameterTypical ValuePurpose
Command Timeout Threshold1000msSingle sample timeout
Average Command Timeout Threshold250ms100-sample average timeout
CAN Sync Loss TimeoutApplication-specificRPDO timing compliance

Critical Warning

Not setting timeout thresholds may result in inability to disable the motor if communication is lost.

Watchdog Counter Implementation

A rolling counter mechanism is required for reliable operation:

You must send a rolling counter on the high byte of Remote state command on a heartbeat within the timeout thresholds.

Remote State Command Format:

ByteContent
High byteRolling counter (0-255)
Low byteState: 0=Off, 1=Idle, 2=Active

Send heartbeat at 100ms intervals with incrementing counter.

Fault Behaviors

Network Communication Timeout (Fault bit 8)

  • Trigger: Communication loss exceeding timeout
  • Behavior: Disables motor until power cycle
  • LED Flash: 2-1 sequence

Communication Loss Braking

Activates only in remote speed mode with serial stream control:

  • Limits braking current to Remote comm loss braking current
  • Duration: 10 seconds maximum

Local Mode Operation

When using throttle input locally, prevent timeout faults by:

  • Sending heartbeat counter above 255 (0x0100 to 0xFF00 range)
  • Maintaining heartbeat within timeout thresholds

PDO Configuration

TPDO (Transmit PDOs)

TPDOContentCOB-ID
TPDO-1Fixed data set 1Base + Node-ID
TPDO-2Fixed data set 2Base + Node-ID

Broadcast timing is configurable per application requirements.

RPDO (Receive PDOs)

Configure RPDO timing to match your network's sync rate to avoid CAN Sync Loss faults.

Remote Control Modes

Speed Mode (Regulator Mode 0)

ParameterDescription
Remote speed command% of rated speed (signed for direction)
Remote speed command in RPMDirect RPM target
Remote state commandSet to 2 (Run) to enable

Torque Mode (Regulator Mode 1)

No speed control - motor spins based on applied current:

ParameterDescription
Remote torque command% of phase current (signed for direction)

Torque with Speed Limiting (Mode 2)

Combines torque and speed parameters:

  • Requires complementary sign alignment
  • Speed limits torque application

Current Limits

Both modes require setting:

ParameterFunction
Remote Maximum Motoring CurrentPhase current limit for driving
Remote Maximum Braking CurrentRegen capacity limit

Regen via Network

To control regen braking via CAN:

  1. Set Regen brake source to "Network"
  2. Configure Remote Maximum Braking Current
  3. Send braking commands via Remote torque command (negative values)

Priority (Firmware 6.014+): When both engine braking and network regen are active, the controller applies whichever commands higher braking torque.

MODBUS Protocol

Overview

MODBUS provides simpler serial communication for basic control and monitoring.

Key Resources

  • Protocol Document: ASI Modbus Protocol Rev 1.22 (PDF)
  • CRC Calculation: Use CRC16 - Modbus specifically

Implementation

Refer to the ASI Modbus Protocol document for:

  • Register mappings
  • Function codes
  • Message formatting
  • Error handling

TTL Serial Communication

Connection

PinFunction
17TTL TX
18TTL RX
GNDSignal ground

Usage

  • Direct connection to BACDoor software
  • Parameter configuration
  • Real-time monitoring
  • Firmware updates

USB Isolator Required

Always use a USB isolator between your computer and the controller to prevent ground loops and protect equipment.

Display Integration

Supported Protocols

ProtocolDisplay Types
CAN-basedKing Meter, Bafang, Wuxing, proprietary
TTL-basedVarious third-party displays

Configuration Steps

  1. Activate Communications configuration vector bit 10 (Enable Ebike)
  2. Select appropriate display protocol
  3. Set assist mode source to display
  4. Configure walk mode signal source
  5. Input wheel diameter and speed sensor parameters

Wiring Options

ConfigurationDescription
CAN + keyoutDisplay controls power
CAN + external switchSeparate power control
TTL + keyoutDisplay controls power
TTL + external switchSeparate power control

Voltage Hazard

The B+ Pin outputs battery voltage. Verify display compatibility before connecting. Incorrect wiring can damage components.

Network Telemetry

Available Data

Real-time parameters accessible via network:

CategoryParameters
VoltageBattery voltage (filtered)
CurrentMotor phase currents
TemperatureController, motor (if sensor connected)
SpeedMotor RPM, vehicle speed
StatusFault/warning registers

Fault/Warning Registers

AddressContent
258Faults (16 conditions)
277Warnings (protective foldbacks)
62, 1964, 1965Flash codes

TPDO Timing

Configure broadcast intervals based on:

  • Network bandwidth
  • Required update rate
  • Number of devices

CAN Bus Hardware

Termination

CAN bus requires 120Ω termination resistors at each end:

  • BAC controllers have configurable internal termination
  • Total bus resistance should measure ~60Ω between CAN-H and CAN-L

Testing

  1. Measure resistance between CAN-H and CAN-L
  2. Expected: ~60Ω with two terminators
  3. Use PEAK CAN dongle with PCAN viewer for traffic analysis

Configuration Checklist

CANopen Setup

1

Set Node ID

Configure unique node ID for each controller on the bus.

2

Configure Timeouts

Set Command Timeout and Average Command Timeout thresholds.

3

Enable Watchdog

Implement rolling counter on Remote state command.

4

Configure PDOs

Set up TPDO/RPDO mappings and timing.

5

Set Control Mode

Choose Speed, Torque, or Torque with Speed Limiting.

6

Configure Current Limits

Set motoring and braking current limits.

7

Test Communication

Verify heartbeat, commands, and telemetry.

MODBUS Setup

  1. Configure baud rate
  2. Set device address
  3. Verify CRC implementation (CRC16-Modbus)
  4. Test register read/write operations

Next Steps