Skip to content

Firmware Brake (EV)

Austin J. Morlan edited this page Nov 20, 2017 · 1 revision

Brake (EV)

The brake firmware is responsible for reading values from the brake pedal sensor, sending reports on its state, and receiving brake commands and fault reports from the control CAN. When the brake firmware receives a brake command message, it will then output the commanded high and low spoof signals onto its connection to the ECU, sending it brake requests. Receiving a fault report will cause the brake module to disable.

Faults

There are three possible fault states:

  • Sensor disconnect
    • The firmware will periodically check the sensors to ensure none of them read a value of zero (an indication that they have become disconnected)
    • If a sensor is detected to be disconnected, control will be disabled and a fault report will be published
  • Command timeout
    • The firmware will monitor the time between receiving commands and ensure there is a steady connection to a higher level application
    • If it is determined that commands are no longer being received, control will be disabled and a fault report will be published
  • Operator override
    • The firmware will monitor for a manual actuation of the brake pedal by a human operator in the event of an emergency override of OSCC control
    • If an operator override is detected, control will be disabled and a fault report will be published

All modules listen for the fault report message and disable themselves if learning of a fault in a different module.

Commands and Reports

  • Receives brake commands from the API
  • Receives fault reports from other modules
  • Sends brake reports with current state information
  • Sends fault reports on fault event

Brake Enable

ID: 0x50

Note: Brake reports should be checked after sending brake enable command to ensure that the module received the command and enabled properly.

Type Size (bytes) Description
uint8_t 2 OSCC Magic Number
Identifies CAN frame as coming from OSCC.
Byte 0 should be 0x05.
Byte 1 should be 0xCC.
uint8_t 6 Reserved

Brake Disable

ID: 0x51

Note: Brake reports should be checked after sending brake disable command to ensure that the module received the command and disabled properly.

Type Size (bytes) Description
uint8_t 2 OSCC Magic Number
Identifies CAN frame as coming from OSCC.
Byte 0 should be 0x05.
Byte 1 should be 0xCC.
uint8_t 6 Reserved

Brake Command

ID: 0x60

Note: Limit the rate at which you send commands onto the CAN bus to prevent overloading the bus and the processors on the modules. A rate of around 20Hz should be sufficient.

Type Size (bytes) Description
uint8_t 2 OSCC Magic Number
Identifies CAN frame as coming from OSCC.
Byte 0 should be 0x05.
Byte 1 should be 0xCC.
uint16_t 2 Spoof Value Low
Value to be sent on the low spoof signal to the DAC.
Voltage converted to a 12-bit step value.
uint16_t 2 Spoof Value High
Value to be sent on the high spoof signal to the DAC.
Voltage converted to a 12-bit step value.
uint8_t 2 Reserved

Brake Report

ID: 0x61

Transmit Rate: 20ms

Type Size (bytes) Description
uint8_t 2 OSCC Magic Number
Identifies CAN frame as coming from OSCC.
Byte 0 should be 0x05.
Byte 1 should be 0xCC.
uint8_t 1 Enabled Status
Zero value means disabled (commands are ignored).
Non-zero value means enabled (commands are sent to vehicle).
uint8_t 1 Operator Override
Zero value means there has been no operator override.
Non-zero value means an operator has physically overridden the system.
uint8_t 1 DTCs
Bitfield of DTCs present in the module.
uint8_t 3 Reserved

Fault Report

ID: 0x99

Transmit Rate: as needed

Type Size (bytes) Description
uint8_t 2 OSCC Magic Number
Identifies CAN frame as coming from OSCC.
Byte 0 should be 0x05.
Byte 1 should be 0xCC.
uint32_t 4 Fault Origin ID
Enum value equaling FAULT_ORIGIN_BRAKE.
uint8_t 2 Reserved

DTCs

Bit Position DTC Description
0 Invalid Sensor Value
The firmware has detected that one of the sensors has become disconnected.

Build Instructions

Follow the README build instructions, then run:

make brake

To upload to the Arduino:

make brake-upload