Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 7 Next »

We are using WaveSculptor22 for motor controller, see TritiumWaveSculptor22_Manual.pdf (tritiumcharging.com) for docs.

Motivation

The motor controllers (MC) are a third-party board with a custom CAN communication protocol. The MC must send and receive messages to the driver controls (DC), however because the MC protocol is strict and thorough it requires abstraction from the rest of the system. The motor controller interface (MCI) handles this abstraction.

Components

Moter Controller (MC)

MCI must transmit to MC every 250ms or else the MC will shut down. This will be a periodic (200ms) task.

MCI will receive updates on measurements of voltage and current, these will be transmitted to DC.

(Try to see if it’s possible to use can.h to control two can controllers simultaneously, if not, use mcp2515 needs to be migrated to fwxv)

Driver Controls (DC)

MCI will receive can msgs from DC requesting to set the car’s drive state. MCI then sends the message to MC.

MCI will transmit voltage and current updates to the main CAN line.

Can

There are two can lines, one communicates only to MC referred to as MC-CAN, the other communicate to the rest of the car referred to as CAN.

Task

  1. CAN rx, MC-CAN rx

  2. process msgs sent by CAN rx, update any states

  3. process msgs sent by MC-CAN, update any states

  4. build messages for MC-CAN and CAN

  5. CAN tx, MC-CAN tx

Can Messages

WaveSculptor’s broadcast messages can be found TritiumWaveSculptor22_Manual.pdf (tritiumcharging.com) section 18.4

18.4.2: Status: Error Flags uses bits 1-8 instead of 0-7,
this was parsed incorrectly on firmware_xiv

WaveScultpor drive command message can be found in section 18.2

Drive commands to the MCI:

id: 
data:
  state (off, drive, reverse, cruise): 

MCI status messages, groups by motor controller:

id: 
target:
data:
// these are updated every 200ms
  velocity: uint8_t (m/s)
  rpm: int16_t (-32,766 - 32,767)
  bus_voltage_v: uint16_t
  bus_current_a: uint16_t
  mc_limit_bitset: uint8_t
  mc_error_bitset: uint8_t

// these are updated every second
  motor_temp_c: int8_t ?
  heatsink_temp_c: int8_t ?
  dsp_temp_c: int8_t ?

FSM

There will be fsm to make sure state transitions are valid, valid transitions are

FSM starts in the off state

  • No labels