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 8 Current »

The purpose of lights control boards is to receive instructions from the driver controls board through a CAN message and take action accordingly. There are two lights boards on the car. One board is located at the front and one at the back. The boards will use the same software. Thus, software needs to determine which board it's being operated on. The responsibilities of each board is as follows: 

Front Board:

Front board controls the following peripherals:

  1. High Beams: Tesla headlights
  2. Low Beams:
  3. Left/Right Turn Indicators (Signals): Signals on the Tesla headlights.
  4. Side Left/Right Turn Indicators (Signals): Signal lights on the sides of the car
  5. Daytime Running Lights: These lights are on as long as the car is turned on.
  6. Horn

Rear Board:

As for the rear board:

  1. Brake Lights: There's a centre brake light, and a pair of brake lights on each side.
  2. Strobe Light: Blink the strobe light in case of emergency.
  3. Left/Right Turn Indicators (Signals): Inside of each pair of brake lights, is the signals.

Functional Block Diagram: 

Modules:

  1. lights_can: 
    1. Receive can messages
    2. Raise events. 
    3. Has information about the type of board (Front or Rear).
    4. Sends sync message (only rear board).
  2. main: This module only contains a main loop where it gets the raised events from lights_can and passes them to the next three modules: strobe, simple_peripherals, and signals_fsm. Every module checks if it owns the event that is passed to it and processes it. If the event is not related to the module, the module ignores it.
  3. simple_peripherals: Used for all the peripherals which have a simple on, or off state. These peripherals are: horn, high/low beams, and brake lights.
  4. strobe: Uses a blinker object to blink the strobe light.
  5. signals_fsm: Contains the FSM of the signals. Every often calls send_sync from lights_can to sync the two boards. Uses blinker for blinking the signals. 
  6. blinker: Basically handles all the overhead related to using soft timers.
  7. lights_gpio: 
    1. Is the only module that knows about all the addresses.
    2. Can be thought of the only part where the boards actually take action?!
    3. strobesignals_fsm, and simple_peripherals all call its lights_gpio_set() function to change the state of the lights.

Front Board GPIO Ports:

LightAddressType
Side Right IndicatorPB12
Side Left IndicatorPB14
HornPB11
Right TurnPB10
Left TurnPA9
Right Low BeamPB2
Left Low BeamPA8
Right High BeamPB1
Left High BeamPB15
Right DRL (Daytime Running Light)PB0
Left DRL PA10
Front (if it's on)PB13
CAN RX

CAN TX

Rear Board GPIO Ports:

LightAddressType
Centre BrakePB14
Strobe LightPB11
Right Rear BrakePB1
Right Rear Outer BrakePB2
Right Rear TurnPB10
Right Rear Outer TurnPB0

Left Rear Brake

PB15
Left Rear Outer BrakePA8
Left Rear TurnPA9
Left Rear Outer TurnPA10
Back (if it's off)PB13

CAN RX



CAN TX

Challenges:

DescriptionSolution
How to detect whether it's the front board or the rear board?There will possibly be a gpio address that we'll be able to read from.
How to sync both the front and the back board when blinking? The timer on both boards will not be identical so some communication needs to happen between the boards to make sure they're both blinking at the same time.Implementation of this solution should be a module that's independent from the rest of the program. 
e.g: The state machine logic for signals and hazard should simply make function calls and not worry about keeping the boards in sync. 
One board probably will need to send a can message to the other board, and both boards will reset their timers. This doesn't have to happen too frequently, probably every couple seconds.
Need to know which ones are active high/low
DRL vs low beam? (what's the difference? where does the message come from?)

Do I have to turn DRL on whenever my board turns on? 


Do we have event for Reversing? 
Each peripheral is active high/low? 



  • No labels