# CAN IDs

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This document describes the messages used to transport sensor and actuator information over the ConceptCar CAN Bus. All information regarding the CAN Messages such as IDs, data width, payload and semantics are defined in this document.

## CAN bus operation

• The CAN bus is operated in CAN 2.0A mode. No component is expected to put 2.0B messages on the bus.
• The Speed is 1MBit/s highspeed.
• The bit timing is 75%.

## Data format

To establish a convenient and simple way of data interchange between different components on different platforms communicating over the bus, there is a unique data format for interchange here. All data passed over the CAN bus must be packed into a 4 Byte CAN message whose contents are interpreted as one 4 Byte unsigned integer variable. The byte order inside each of these CAN messages is as usual on the CAN bus: lowest byte first.

As an example, the value 0x12345678 is sent over the bus 0x78, 0x56, 0x34, 0x12.

If the value can't be directly evaluated, a linear marshaling function has to be defined here. Other marshaling functions than linear ones are not allowed.

## CAN IDs and Description

In this section the CAN IDs used by the concept car are defined and a brief description of them is given. Later on the semantics of each message is defined.

Table 1: CAN ID Definition
CAN ID Identifier Description
0x08 CANid_WheelSpeedFL Wheel speed average
0x09 CANid_WheelSpeedFR Wheel speed average
0x0a CANid_WheelSpeedRL Wheel speed average
0x0b CANid_WheelSpeedRR Wheel speed average
0x0d CANid_Voltage Board supply voltage
0x0e CANid_ResetCounter Reset logger counter
0x10 CANid_Inertial_X Inertial System acceleration X axis
0x11 CANid_Inertial_Y Inertial System acceleration Y axis
0x12 CANid_Inertial_Yaw Inertial System yaw rate
0x20 CANid_SelectJumper Select between original or generated
0x22 CANid_Steering PWM signal for steering (transmitter signal)
0x25 CANid_Throttle PWM signal for throttle (transmitter signal)
0x32 CANid_Steering_new PWM signal for steering (generated)
0x35 CANid_Throttle_new PWM signal for throttle (generated)
0x400 CANid_ErrorController Controller error 5 (Table 5)
0x402 CANid_EmergencyKey Emergency key pressed (Table 6)

## Semantics of CAN Messages

In this section the semantics of each CAN Message is described. Some of the messages have special quality descriptors attached to them, which are also described here. The first important definition about the CAN Messages is their size. All of the CAN Messages going over the ConceptCar CAN Bus are 32bit long. While this is not unchangeable, it is necessary to change the code to allow messages bigger than 32bits.

#### CANid_WheelSpeedXX

Information about wheel speed coming from the wheel speed sensors. The wheel speed is calculated using the time interval between two measures done by the speed sensor. Messages informing the vehicle speed are sent every 20ms. If no measurement is accomplished during the 20ms time slot, no speed information is available. For this reason the semantic of the messages and measurements are defined. A quality descriptor is inserted into the message to describe the quality of the information provided by the message payload, so listeners of this messages can decide what to do with the information. The speed is calculated using the average of measures obtained within the 20ms time slot. When several readings occur during the time slot, the value 2 is said to have a high quality. If the time between measures take longer than 20ms, the quality of the information is decayed and follows Equation 1.

$f(x)=\frac{1}{x^2+1}$

This equation maps four time slots to a value between the interval ]0; 1] that can be used to determine the quality of the information being sent over the CAN bus. The variable x represents the time slot in which the computation is currently being made. For instance, if no measurements were accomplished during the last 3 time slots, the quality descriptor will have the value mapped to the value yielded by f(3). Using only discrete values to map the evaluation of Equation 1 to a quality level allows the decay of quality based on the number of cycles (time slots) where there was no reading from the speed sensor. The semantics of the Wheel Speed CAN messages is as follows. The message consists of a 32bit payload. Values are given in meters per second (m/s). The two MSBs (Most Significant Bits) are used for determining the message quality level. These two bits allow four levels of quality: High, Medium-high, Medium-low and Low quality. Table 2 shows the mapping of quality information to bit values.

Table 2: Quality-Bit Mapping
Quality level Bit setting
High 00
Medium-high 01
Medium-low 10
Low 11

The issue of mapping the value yielded by equation 1 to a quality level is addressed by the component responsible for the speed measurements and the requirements imposed by the system.

#### CAN Board Voltage Message

The Board Voltage can be used to determine the battery level of the ConceptCar. If low voltages are detected this information can be used to stop the car or to gracefully degrade the configuration actually being executed. For example, less important sensors can be turned off. The CAN Message carrying the board voltage also uses 32bits as payload where the two MSBs are quality descriptors as defined for the Wheel Speed Sensors in section CANid WheelSpeedXX and depicted by Equation 1 and Table 2. The value contained in the CAN Board Voltage messages are obtained through the evaluation of Equation 2.

$U=x\times\frac{3.7}{1024}\times 5V$

#### CAN Reset Counter Message

This message resets the logger indexing counter. If this message is present on the CAN Bus, the logger counter will be reset. The contents of the message are not considered in order to reset the counter. Later specification can be defined for use of the reset message contents.

#### CAN Inertial Sensor Messages

The inertial sensors interface with the sensor boards directly through a digital communication channel. The digital channel allows a digital value to be directly delivered to the sensor board without the need for further D2A (Digital to Analog) conversions. Since the readings are already provided by the sensors in digital format. It is not necessary to treat these values and the sensor boards can directly send the values over CAN.

#### CAN Select Jumper Message

The select jumper messages inform the ConceptCar system to switch between generate PWM signals to the original signals coming from the Radio Transmitter handled by the driver, or vice versa. The message must contain the ID of the PWM source to which the car should switch to. The IDs are described in Table 3.

Table 3: Select Jumper Source IDs
ID Description
0x1 Original PWM Signals (From Transmitter)
0x2 Generated PWM Signals (From Car)

#### CAN PWM Signal Messages

PWM signals control the Servo-Motors of the vehicle. There are two sources of PWM signals used in the ConceptCar. One of them are the signals coming from the RC Transmitter. These signals can go directly to the car's steering and throttle units. The other source of signals are the signals generated by the car's circuitry. The generated signals can be used to adjust driving behavior, such as compen sating for a slipping wheel when the RC Transmitter is setting the Throttle to full. The PWM signals are unfortunately not quite accurate. For this reason some measures must be taken in order to allow a certain flexibility during PWM signal interpretation. The interpretation is done by the board responsible for generating a CAN message with the signal data. The CAN messages use 29bit data payload, 1bit orientation payload and 2bits quality description payload. Table 4 describes the message format. The quality levels are the same as the ones described in Table 2 in section CANid_WheelSpeedXX. Based on the message quality listener modules can decide what to do with the information.

Table 4: PWM CAN Message format
Quality Orientation Value
31-30 29 28-0

#### CAN Controller Error Messages

The ConceptCar Controller might experience problems when decoding PWM signals. This happens because PWM signals are not discreetly defined. Sometimes the signal gets out of range and the controller issues an error. An error message assumes one of the values described in table 5 and components that listen to these messages can take action upon the error signaled by the message.

Table 5: Controller Error Messages
ID Identifier Description
0x1 ErrorType_PulseOutOfBounds Indicates too short or too long PWM pulses
0x2 ErrorType_PWMFrequency Indicates a wrong PWM frequency
0x4 ErrorType_NoSignal Indicates lack of signal (low is longer than 18ms)
0x8 ErrorType_ActorEnteredError -

#### CAN Emergency Key Messages

The ConceptCar is equipped with a emergency (panic) remote control. This remote control has 3 buttons that can be used for different functions. One of the current uses is to hit the brakes of the car if the button is pressed. This allows the driver to stop the car if it gets uncontrollable or if the car's system behaves in unexpected ways. Table 6 gives the description of the CAN Message contents generated when at least one of the three available buttons is pressed.

Table 6: Emergency Key Mapping
Button Bits
1 0x01(001)
2 0x02(010)
3 0x04(100)