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 4 Next »

Purpose (from IV):

A power distribution board is necessary to supply power to the various subsystems in the vehicle, including other microcontrollers. This board performs distribution, startup, shutdown and emergency shutdown as required in regulations. In addition to supporting powering the boards, it also powers components directly, such as the horn, camera and others.

The current electrical system design requires two instances of Power Distribution boards, a front PD and a rear PD. In MSXIV, the same firmware was flashed to both boards, with a startup condition used to determine which configuration was to be processed.

Essentially, power distribution has a set of outputs which it can turn on or off based on the state of the system. These outputs include:

Driver Lights and Indicators:

  • Right/left signal lights (located on front, side and rear of the car)

  • Hazard lights (same as those used for right/left)

  • BPS Fault strobe (Front PD only)

    • Part of driver display, if BPS fault occurs must pulse at 60-120hz

  • Horn (Front PD only)

  • Daytime running lights (Front PD only)

  • Brake lights (Rear PD only)

  • Cameras/Displays

  • Fans for driver ventilation

MCU Power - powers our boards:

Front PD:

  • Centre Console

  • Pedal

  • Steering

Rear PD

  • BMS

  • MCI

  • Solar Sense

Updated Output list (Jul 4, 2023)

typedef enum {
  // Outputs for power distribution
  // Dual LS per pair 
  FRONT_OUTPUT_CENTRE_CONSOLE = 0,
  REAR_OUTPUT_SOLAR_SENSE,
  FRONT_OUTPUT_PEDAL,
  FRONT_OUTPUT_STEERING,
  FRONT_OUTPUT_LEFT_FRONT_TURN_LIGHT,
  FRONT_OUTPUT_RIGHT_FRONT_TURN_LIGHT,
  FRONT_OUTPUT_DAYTIME_RUNNING_LIGHTS,
  REAR_OUTPUT_BRAKE_LIGHT,
  REAR_OUTPUT_BPS_STROBE_LIGHT,
  REAR_OUTPUT_FAN_1,

  // Dual LS per each, 3x spares
  REAR_OUTPUT_BMS,
  REAR_OUTPUT_MCI,
  FRONT_OUTPUT_CAMERA_DISPLAY, 

  NUM_OUTPUTS,
} Output;

SW Components:

Modules

  • Master Task

  • Lights FSM task

  • Power Sequence FSM task

  • Gpio Output controller/configs

  • Periodic Current read (TBD)

  • BPS_watcher

Master Task

Responsible for handling:

  • CAN functionality

  • FSM Cycles

  • Horn (Front PD only) - Triggered on Horn event over can from steering*

  • Brake lights (Rear PD only) - Triggered on brake event from pedal*

*NOTE: Brake and horn could be moved to power FSM, but makes sense to have them in main loop as they will always need to work, and this will make them extra responsive

Lights FSM

The lights FSM is responsible for handling the indicator light functionality for the turn signals, hazard lights and the fault indicators. Its inputs are steering events, received in CAN messages from the steering board, as well as BPS fault indicators. It has the following state diagram:

Transition events:

  • Left signal event (OFF/ON)

    • Triggered by left turn indicator on steering

  • Right Signal event (OFF/ON)

    • Triggered by Right turn indicator on steering

  • Hazard Event (OFF/ON)

    • Triggered by hazard button on steering

  • BPS Fault Event

    • Triggered by receiving a BPS_HEARTBEAT message with fault condition

    • Triggered if we don’t receive BPS Heartbeat after a predetermined amount of time (Comms failure)

States:

  • Init State

    • FSM is initialized into this state, and it it the default state of operation

    • It does not transition unless it received a steering event or a fault event

  • Left Signal

    • Periodically toggle left signal output light

  • Right Signal

    • Periodically toggle right signal output light

  • Hazard

    • Periodically toggle both right and left signal output lights

  • BPS Fault

    • Strobe BPS fault indicator

    • Trigger Hazard lights (toggle both right/left signals lights)

    • Signal power sequence FSM to begin shutdown

Power Sequence FSM

The Power Sequence FSM is responsible for handling what gets power in different power states of the car. Based on inputs from the rest of the system, and state changes from power select, it will alter the source of power and be responsible for turning on and off different boards as needed. It receives as inputs CAN messages which indicate power events

State Diagram:

Transition events (Received over CAN from Center Console):

  • Power Main Driver BMS

    • First iteration of power on, only key indicators enabled

    • May be removed, as we no longer have a driver display

  • Power Main Everything on

    • Turn on all boards, enable the system

  • Power Aux Everything on

    • On BPS fault, we need to switch from main power to aux power

    • Enable only necessary systems

  • Power Everything Off

  • BPS Fault Event

    • Triggered by receiving a BPS_HEARTBEAT message with fault condition

    • Triggered if we don’t receive BPS Heartbeat after a predetermined amount of time (Comms failure)

States:

  • Init State

    • Only Centre console and pedal are on

  • Driver Controls

    • Turns on all displays

    • TBD - May be able to remove

    • Activated if power pressed w/o brake

  • Power Main Everything on

    • Powers on all systems (boards, cameras, Daytime running lights (Front PD only))

  • Main Operation

    • State of normal operation. Will execute output function every iteration as long as no other state change has occurred

    • Responsible for

      • Fan Control - front and rear PD

      • Checking for state change

General Master task format:

MasterTask() {
  init_fsm(lights);
  init_fsm(power_sequence);
  
  while(true) {
    run_can_rx_cycle();
    update_horn();
    update_brake_lights;
    run_lights_cycle();
    run_power_sequence_cycle();
    run_can_tx_cycle(); 
  }
}

Broadcaster

Module to broadcast relevant information from power distribution to the rest of the system

 MSXIV Design Notes (Ignore unless you’re mitchell):

Module Seperation:

  • bps_watcher - Watches for the BPS_HEARTBEAT to make sure that no fault has occured

  • can_rx_event_mapper_config - Standard configurations for can_rx_event_mapper

  • can_rx_event_mapper - Maps CAN messages to power distribution events

  • current_measurement_config - Standard configurations for current_measurement

  • current_measurement - Periodically reads current from load switches and exposes global storage

  • front_uv_detector - Checks if undervoltage cutoff has occurred on front PD and sends a CAN message -Own board in MSXV

  • main - Initializes all other modules

  • output_config - Standard configurations for output

  • output - General-purpose module for manipulating the outputs that power distribution controls

  • pd_fan_ctrl - Control fans for front and rear power distro via ADT7476A

  • pd_gpio_config - Standard configurations for pd_gpio

  • pd_gpio - Receive events and set the PCA9539R GPIO pin states as specified

  • publish_data_config - Standard configurations for publish_data

  • publish_data - Publishes current measurements over CAN as generated by current_measurement

  • rear_strobe_blinker - Blinks the strobe light, controlled by PD_STROBE_EVENT

Main Functionality

  • BPS Watcher

    • Need to have timeout for BPS Heartbeat message

    • Unpack CAN, check for error - If a fault has occurred, we need to enter the Fault state, and go to aux power

  • Can Rx Events

    • Will be receiving messages in the main loop/parse inputs in FSM

    • Needs to act on messages and execute functionality

  • Current Measurement

    • Periodically read from load switches/analog inputs, act based on this

  • Output

    • Abstraction over all outputs that are connected to PD

    • Items can be turned off/on, and some provide current draw measurements

  • Fan Control

    • Drive fans based on potentiometers/thermistors

  • PD Gpio

    • Writes Gpio states based on received events

  • Publish Data

    • Puts necessary messages on CAN BUS

  • Rear Strobe Blinker

CAN Rx messages

Front:

  • MESSAGE_LIGHTS

    • EE_LIGHT_TYPE_DRL

    • EE_LIGHT_TYPE_SIGNAL_RIGHT

    • EE_LIGHT_TYPE_SIGNAL_LEFT

    • EE_LIGHT_TYPE_SIGNAL_HAZARD

  • POWER_ON_MAIN_SEQUENCE

    • EE_POWER_MAIN_SEQUENCE_TURN_ON_DRIVER_BMS

    • PD_POWER_MAIN_SEQUENCE_EVENT_TURN_ON_EVERYTHING

  • POWER_ON_AUX_SEQUENCE

    • EE_POWER_AUX_SEQUENCE_TURN_ON_EVERYTHING

  • SYSTEM_CAN_MESSAGE_POWER_OFF_SEQUENCE

    • EE_POWER_OFF_SEQUENCE_TURN_OFF_EVERYTHING

Rear:

  • MESSAGE_LIGHTS

    • EE_LIGHT_TYPE_BRAKES

    • EE_LIGHT_TYPE_STROBE

    • EE_LIGHT_TYPE_SIGNAL_RIGHT

    • EE_LIGHT_TYPE_SIGNAL_LEFT

    • EE_LIGHT_TYPE_SIGNAL_HAZARD

  • POWER_ON_MAIN_SEQUENCE

    • EE_POWER_MAIN_SEQUENCE_TURN_ON_DRIVER_BMS

    • PD_POWER_MAIN_SEQUENCE_EVENT_TURN_ON_EVERYTHING

  • POWER_ON_AUX_SEQUENCE

    • EE_POWER_AUX_SEQUENCE_TURN_ON_EVERYTHING

  • SYSTEM_CAN_MESSAGE_POWER_OFF_SEQUENCE

    • EE_POWER_OFF_SEQUENCE_TURN_OFF_EVERYTHING

PD Events to outputs:

GPIO:

DRIVER_DISPLAY
STEERING,
CENTRE_CONSOLE,
DRL,
PEDAL,
HORN,
BRAKE_LIGHT,
STROBE,
SIGNAL_LEFT,
SIGNAL_RIGHT,
SIGNAL_HAZARD,
NUM_PD_GPIO_EVENTS,

Rear Strobe Blinker:

STROBE

Lights FSM

SIGNAL_LEFT
SIGNAL_RIGHT
SIGNAL_HAZARD

SYNC_EVENT_LIGHTS

Power Main sequence (also handled by gpio

MAIN_TURN_ON_DRIVER_DISPLAY_BMS
MAIN_TURN_ON_EVERYTHING
AUX_TURN_ON_EVERYTHING
POWER_OFF_TURN_OFF_EVERYTHING

ICs:

  • BTS7040

Front Power Distribution Powers:

  • Steering

  • Centre Console

  • Pedal

  • Front Lights

  • Dashboard Indicator

  • Horn

  • Driver Fans

  • No labels