Skip to content

Commit

Permalink
Squashed 'opendbc/' changes from a62d5dd8..4e796e06
Browse files Browse the repository at this point in the history
4e796e06 Fix wrong message sizes in Nissan
fb6c1ee2 Better GEAR signal tracking the gear stick rather than the gear box (#257)
d7a2efbb Raw angle signal data for easy checksum calc, and one less gear bit (#254)
7456061a add checksum check to can parser for subaru
7f3b1774 Chrysler: calculate checksum in can packer/parser (#255)
0c021551 Rename BYTE_ to SET_ME_X (#253)
1efe437c Add values for a static 0xe5 (honda bosch) (#250)
7dffe0bd Create DBC for HRV (#248)
b6939852 Add LFAHDA message to hyundai
a57e7ddb CANPacker: Subaru checksum support  (#241)
36c471e5 Fixed signals order and added new signals for subaru global (#221)
7b5a1fcc BMW 2008-2013 (#230)
cc09af76 Add RPM signal (#216)
47db9238 Add SWA_01 message detail and CRC support for VW MQB (#236)
c98fe2ab Fixed signal unknown1 overlapping the button bits (#239)
572261ee Rear Cross Traffic Alert
044730ae Speed limit signs
87b1a21f Pedals/gear, gas pedal scale value
ce78044d Tracking the steer angle with LKAS signal
7f19ab41 Introduce the new  mazda 3  2019/2020 dbc
e5852061 traffic sign speed limit
00bad5ee Speed Auto High Beam Traffic signs
9d080ea4 Nissan leaf (#238)
50fbbe73 nissan x trail cleanup (#237)

git-subtree-dir: opendbc
git-subtree-split: 4e796e06dd44757bb73042f0ec26fd9b6ddc7142
  • Loading branch information
Vehicle Researcher committed May 9, 2020
1 parent 72427d8 commit bbc02b1
Show file tree
Hide file tree
Showing 45 changed files with 1,798 additions and 317 deletions.
291 changes: 291 additions & 0 deletions bmw_e9x_e8x.dbc
Original file line number Diff line number Diff line change
@@ -0,0 +1,291 @@
VERSION ""


NS_ :
NS_DESC_
CM_
BA_DEF_
BA_
VAL_
CAT_DEF_
CAT_
FILTER
BA_DEF_DEF_
EV_DATA_
ENVVAR_DATA_
SGTYPE_
SGTYPE_VAL_
BA_DEF_SGTYPE_
BA_SGTYPE_
SIG_TYPE_REF_
VAL_TABLE_
SIG_GROUP_
SIG_VALTYPE_
SIGTYPE_VALTYPE_
BO_TX_BU_
BA_DEF_REL_
BA_REL_
BA_DEF_DEF_REL_
BU_SG_REL_
BU_EV_REL_
BU_BO_REL_
SG_MUL_VAL_

BS_:

BU_: XXX EON Vector__XXX


BO_ 170 AccPedal: 8 XXX
SG_ KickDownPressed : 53|1@0+ (1,0) [0|3] "" XXX
SG_ CruisePedalActive : 54|1@0+ (1,0) [0|1] "" XXX
SG_ CruisePedalInactive : 55|1@0+ (1,0) [0|1] "" XXX
SG_ ThrottlelPressed : 50|1@0+ (1,0) [0|1] "" XXX
SG_ AcceleratorPedalPressed : 52|1@0+ (1,0) [0|7] "" XXX
SG_ AcceleratorPedalPercentage : 16|16@1+ (0.01,0) [0|100] "" XXX
SG_ Counter1 : 8|4@1+ (1,0) [0|15] "" XXX
SG_ EngineSpeed : 32|16@1- (1,0) [0|65535] "" XXX
SG_ uknown : 7|8@0- (1,0) [0|65535] "" XXX

BO_ 404 CruiseControl: 4 XXX
SG_ plus1mph_request : 16|1@0+ (1,0) [0|1] "" XXX
SG_ minus1mph_request : 18|1@0+ (1,0) [0|1] "" XXX
SG_ Cancel_request_up_stalk : 23|1@0+ (1,0) [0|1] "" XXX
SG_ Cancel_request_up_or_down_stalk : 20|1@0+ (1,0) [0|1] "" XXX
SG_ Resume_request : 22|1@0+ (1,0) [0|1] "" XXX
SG_ Counter1 : 3|4@0+ (1,0) [0|15] "" XXX
SG_ Counter2 : 11|4@0+ (1,0) [0|15] "" XXX
SG_ notCancel_0xF : 7|4@0+ (1,0) [0|15] "" XXX
SG_ setMe_0xFC : 31|8@0+ (1,0) [0|255] "" XXX
SG_ requests_0xF : 15|4@0+ (1,0) [0|15] "" XXX
SG_ plus5mph_request : 17|1@0+ (1,0) [0|0] "" Vector__XXX
SG_ minus5mph_request : 19|1@0+ (1,0) [0|0] "" Vector__XXX

BO_ 512 CruiseControlStatus: 8 XXX
SG_ CruiseControlInactiveFlag : 12|1@0+ (1,0) [0|1] "" XXX
SG_ CruiseCoontrolActiveFlag : 13|1@0+ (1,0) [0|1] "" XXX
SG_ CruiseControlSetpointSpeed : 7|8@0+ (0.25,0) [0|255] "mph" XXX

BO_ 168 EngineAndBrake: 8 XXX
SG_ Brake_active2 : 62|1@0+ (1,0) [0|1] "" XXX
SG_ BrakePressed : 61|1@0+ (1,0) [0|1] "" XXX
SG_ EngineTorque : 8|16@1- (1,0) [0|65535] "" XXX
SG_ EngineTorqueWoInterv : 24|16@1- (1,0) [0|65535] "" XXX

BO_ 470 SteeringButtons: 2 XXX
SG_ Volume_DOWN : 2|1@0+ (1,0) [0|1] "" XXX
SG_ Volume_UP : 3|1@0+ (1,0) [0|1] "" XXX
SG_ VoiceControl : 8|1@0+ (1,0) [0|1] "" XXX
SG_ Telephone : 0|1@0+ (1,0) [0|1] "" XXX
SG_ Next_up : 5|1@0+ (1,0) [0|1] "" XXX
SG_ Previous_down : 4|1@0+ (1,0) [0|1] "" XXX

BO_ 403 DynamicCruiseControlStatus: 8 XXX
SG_ Counter : 7|8@0+ (1,0) [0|255] "" XXX
SG_ CruiseActive : 43|1@0+ (1,0) [0|1] "" XXX
SG_ CruiseSpeedChangeRequest : 48|1@0+ (1,0) [0|1] "" XXX
SG_ CruiseControlSetpointSpeed : 15|8@0+ (1,-2) [0|255] "mph" XXX

BO_ 201 SteeringWheelAngle_DSC: 8 XXX
SG_ Counter1 : 23|4@0+ (1,0) [0|15] "" XXX
SG_ WeirdCounter : 44|4@1+ (1,0) [0|3] "" XXX
SG_ SteeringPositionComplementLow : 24|11@1- (1,0) [0|1] "" XXX
SG_ SteeringPosition : 0|16@1- (0.0439453125,0) [-600|600] "deg" XXX

BO_ 206 WheelSpeeds: 8 XXX
SG_ Wheel1 : 0|16@1- (0.0643699,0) [0|255] "kph" XXX
SG_ Wheel2 : 16|16@1- (0.0643699,0) [0|255] "kph" XXX
SG_ Wheel4 : 48|16@1- (0.0643699,0) [0|255] "kph" XXX
SG_ Wheel3 : 32|16@1- (0.0643699,0) [0|255] "kph" XXX

BO_ 884 WheelToleranceAdjustment: 8 XXX

BO_ 678 WiperSwitch: 8 XXX
SG_ AutoWipersOn : 0|1@1+ (1,0) [0|3] "" XXX

BO_ 304 TerminalStatus: 8 XXX
SG_ AccOn : 23|1@0+ (1,0) [0|255] "" XXX
SG_ IgnitionOff : 22|1@0+ (1,0) [0|3] "" XXX

BO_ 169 Torque2: 8 XXX

BO_ 184 TorqueTransmisionRequest: 8 XXX

BO_ 196 SteeringWheelAngle: 7 XXX
SG_ SteeringPosition : 0|16@1- (0.0439453125,0) [-600|600] "degree" XXX
SG_ SteeringSpeed : 24|16@1- (0.0439453125,0) [0|255] "degree/s" XXX

BO_ 180 WheelTorqueDriveTrain1: 8 XXX

BO_ 182 DynamicCruiseControlTorqueDemand: 8 XXX

BO_ 186 TransmissionData: 8 XXX

BO_ 191 RequestedWheelTorqueDriveTrainActiveCruiseControl: 8 XXX
SG_ Counter : 11|4@0- (1,0) [0|255] "" XXX
SG_ TorqueReq : 16|11@1+ (1,0) [0|65535] "" XXX

BO_ 414 Status_DSC: 8 XXX

BO_ 416 Speed: 8 XXX
SG_ VehicleSpeed : 0|12@1+ (0.103,0) [0|255] "kph" XXX

BO_ 418 TransimissionData2: 8 XXX

BO_ 690 WheelPressure: 8 XXX

BO_ 691 AccelerationData: 8 XXX

BO_ 408 GearSelectorSwitch: 8 XXX
SG_ Gear : 0|8@1+ (1,0) [0|0] "" Vector__XXX

BO_ 422 Distance: 8 XXX

BO_ 436 InstrumentClusterStatus_KOMBI: 8 XXX

BO_ 464 EngineData: 8 XXX

BO_ 945 TransmissionData3: 8 XXX

BO_ 200 SteeringWheelAngle_slow: 8 XXX
SG_ SteeringPosition : 0|16@1- (0.0439453125,0) [-600|600] "degree" XXX
SG_ SteeringSpeed : 24|16@1- (0.0439453125,0) [-65535|65535] "degree/s" XXX

BO_ 466 TransmissionDataDisplay: 8 XXX

BO_ 437 HeatFlow_LoadMomentClimate: 8 XXX

BO_ 1152 NetworkManagment1: 8 XXX

BO_ 1170 NetworkManagment2: 8 XXX

BO_ 1175 NetworkManagment3: 8 XXX

BO_ 1176 NetworkManagment4: 8 XXX

BO_ 1193 NetworkManagment5: 8 XXX

BO_ 1246 NetworkManagment6: 8 XXX

BO_ 438 HeatFlowEngine: 8 XXX

BO_ 784 AmbientTemperature: 8 XXX

BO_ 821 ElectricFuelPumpStatus: 8 XXX

BO_ 1007 EngineOBD_data: 8 XXX

BO_ 1432 ServicesDKG: 8 XXX

BO_ 309 CrashDisconnectControl: 8 XXX

BO_ 502 TurnSignals: 2 XXX
SG_ TurnSignalIdle : 9|1@0+ (1,0) [0|1] "" XXX
SG_ TurnSignalActive : 8|1@0+ (1,0) [0|1] "" XXX
SG_ RightTurn : 5|1@0+ (1,0) [0|1] "" XXX
SG_ LeftTurn : 4|1@1+ (1,0) [0|1] "" XXX
SG_ HoldActivated : 0|1@1+ (1,0) [0|1] "" XXX

BO_ 514 Dimming: 8 XXX

BO_ 538 LampsCondition: 8 XXX

BO_ 550 RainSensorWiperSpeed: 8 XXX

BO_ 578 ClimateFrontStatus: 8 XXX

BO_ 704 LCD_lighting: 8 XXX

BO_ 758 LightControl: 8 XXX

BO_ 760 Time_Date: 8 XXX

BO_ 762 SeatBeltContact: 8 XXX

BO_ 764 TrunkStatus: 8 XXX

BO_ 797 TirePressureStatus: 8 XXX

BO_ 816 Range_Mileage: 8 XXX

BO_ 823 StatusFuelControl: 8 XXX

BO_ 897 EngineOilLevelStatus: 8 XXX

BO_ 940 Terminal30Eerror: 8 XXX

BO_ 947 PowerManagmentConsumptionControl: 8 XXX

BO_ 948 PowerBatteryVoltage: 8 XXX
SG_ BatteryVoltage : 7|24@0+ (0.001,0) [0|65535] "" XXX

BO_ 958 PowerRunningTime: 8 XXX

BO_ 1408 ServicesKGM: 8 XXX

BO_ 1426 ServicesDME: 8 XXX

BO_ 1449 ServicesDSC: 8 XXX

BO_ 1504 ServicesKOMBI: 8 XXX

BO_ 1522 ServicesKBM: 8 XXX

BO_ 209 Accelerometer: 8 XXX
SG_ LateralAcceleration : 0|16@1- (1,0) [0|7] "" XXX
SG_ LongitudalAcceleration : 32|16@1- (1,0) [0|65535] "" XXX

BO_ 172 WheelTorqueDrivetrain2: 8 XXX

BO_ 128 Unknown80: 5 XXX
SG_ State2 : 24|4@1+ (1,0) [0|15] "" XXX
SG_ State1 : 23|8@0+ (1,0) [0|255] "" XXX
SG_ Counter1 : 31|4@0+ (1,0) [0|15] "" XXX

BO_ 320 Unknown140: 2 XXX
SG_ State : 7|8@0+ (1,0) [0|255] "" XXX

BO_ 212 Unknown_d4: 8 XXX
SG_ State1 : 47|8@0+ (1,0) [0|255] "" XXX
SG_ Counter1 : 55|8@0+ (1,0) [0|255] "" XXX
SG_ Counter2 : 63|8@0+ (1,0) [0|255] "" XXX

BO_ 205 Unknown_cd: 8 XXX
SG_ NEW_SIGNAL_2 : 15|8@0+ (1,0) [0|255] "" XXX
SG_ NEW_SIGNAL_3 : 23|8@0+ (1,0) [0|255] "" XXX
SG_ NEW_SIGNAL_4 : 31|8@0+ (1,0) [0|255] "" XXX
SG_ NEW_SIGNAL_5 : 39|8@0- (1,0) [0|255] "" XXX
SG_ NEW_SIGNAL_6 : 47|8@0+ (1,0) [0|255] "" XXX
SG_ Counter1 : 55|4@0+ (1,0) [0|255] "" XXX
SG_ NEW_SIGNAL_1 : 7|8@0+ (1,0) [0|255] "" XXX
SG_ NEW_SIGNAL_7 : 63|8@0- (1,0) [0|255] "" XXX

BO_ 1577 NEW_MSG_1: 8 XXX




CM_ SG_ 170 ThrottlelPressed "Active when accelerator pedal pressed or cruise control drives";
CM_ SG_ 170 AcceleratorPedalPressed "Active only when driver actually presses the pedal";
CM_ SG_ 170 AcceleratorPedalPercentage "ToDo Factor to be adjusted";
CM_ SG_ 170 EngineSpeed "It's hard to say that is even a rate";
CM_ SG_ 404 plus1mph_request "Appears when +1mph/kph stalk is depressed";
CM_ SG_ 404 minus1mph_request "Appears when -1mph/kph stalk is depressed";
CM_ SG_ 404 Cancel_request_up_stalk "Appears when cancel stalk (up) is depressed";
CM_ SG_ 404 Cancel_request_up_or_down_stalk "Appears when cancel stalk (up or down) is depressed";
CM_ SG_ 404 Resume_request "It appears when resume stalk button is depressed";
CM_ SG_ 404 Counter1 "It accelerates when requests are being sent";
CM_ SG_ 404 Counter2 "It accelerates when requests are being sent";
CM_ SG_ 404 notCancel_0xF "0xF unless cancel is requested then 0x0";
CM_ SG_ 168 Brake_active2 "";
CM_ SG_ 168 BrakePressed "Brake when driver presses the brake";
CM_ SG_ 168 EngineTorque "Engine torque without inertia - combustion torque";
CM_ SG_ 168 EngineTorqueWoInterv "Engine torque without inertia and without shift intervention";
CM_ SG_ 403 CruiseControlSetpointSpeed "Speed target";
CM_ SG_ 408 Gear "This is just provision, needs to be reverse engineered";
CM_ SG_ 502 TurnSignalIdle "Turn signal off";
CM_ SG_ 502 TurnSignalActive "Turn signal on or transitioning";
CM_ SG_ 502 RightTurn "Indicates right blinker or when steering returning right clears left blinker";
CM_ SG_ 502 LeftTurn "Indicates left blinker or when steering returning left clears right blinker";
CM_ SG_ 502 HoldActivated "Spikes down if blinker cleared with timeout or turn. Stays off if blinker cleared with stalk";
VAL_ 408 Gear 1 "D" 2 "S" 3 "N" 4 "R" 5 "P" ;
50 changes: 48 additions & 2 deletions can/common.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,55 @@ unsigned int toyota_checksum(unsigned int address, uint64_t d, int l) {
d >>= 8; // remove checksum

unsigned int s = l;
while (address) { s += address & 0xff; address >>= 8; }
while (d) { s += d & 0xff; d >>= 8; }
while (address) { s += address & 0xFF; address >>= 8; }
while (d) { s += d & 0xFF; d >>= 8; }

return s & 0xFF;
}

unsigned int subaru_checksum(unsigned int address, uint64_t d, int l) {
d >>= ((8-l)*8); // remove padding

unsigned int s = 0;
while (address) { s += address & 0xFF; address >>= 8; }
l -= 1; // checksum is first byte
while (l) { s += d & 0xFF; d >>= 8; l -= 1; }

return s & 0xFF;
}

unsigned int chrysler_checksum(unsigned int address, uint64_t d, int l) {
/* This function does not want the checksum byte in the input data.
jeep chrysler canbus checksum from http://illmatics.com/Remote%20Car%20Hacking.pdf */
uint8_t checksum = 0xFF;
for (int j = 0; j < (l - 1); j++) {
uint8_t shift = 0x80;
uint8_t curr = (d >> 8*j) & 0xFF;
for (int i=0; i<8; i++) {
uint8_t bit_sum = curr & shift;
uint8_t temp_chk = checksum & 0x80U;
if (bit_sum != 0U) {
bit_sum = 0x1C;
if (temp_chk != 0U) {
bit_sum = 1;
}
checksum = checksum << 1;
temp_chk = checksum | 1U;
bit_sum ^= temp_chk;
} else {
if (temp_chk != 0U) {
bit_sum = 0x1D;
}
checksum = checksum << 1;
bit_sum ^= checksum;
}
checksum = bit_sum;
shift = shift >> 1;
}
}
return ~checksum & 0xFF;
}

// Static lookup table for fast computation of CRC8 poly 0x2F, aka 8H2F/AUTOSAR
uint8_t crc8_lut_8h2f[256];

Expand Down Expand Up @@ -106,6 +149,9 @@ unsigned int volkswagen_crc(unsigned int address, uint64_t d, int l) {
case 0x30C: // ACC_02 Automatic Cruise Control
crc ^= (uint8_t[]){0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F}[counter];
break;
case 0x30F: // SWA_01 Lane Change Assist (SpurWechselAssistent)
crc ^= (uint8_t[]){0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C}[counter];
break;
case 0x3C0: // Klemmen_Status_01 ignition and starting status
crc ^= (uint8_t[]){0xC3,0xC3,0xC3,0xC3,0xC3,0xC3,0xC3,0xC3,0xC3,0xC3,0xC3,0xC3,0xC3,0xC3,0xC3,0xC3}[counter];
break;
Expand Down
2 changes: 2 additions & 0 deletions can/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
// Helper functions
unsigned int honda_checksum(unsigned int address, uint64_t d, int l);
unsigned int toyota_checksum(unsigned int address, uint64_t d, int l);
unsigned int subaru_checksum(unsigned int address, uint64_t d, int l);
unsigned int chrysler_checksum(unsigned int address, uint64_t d, int l);
void init_crc_lookup_tables();
unsigned int volkswagen_crc(unsigned int address, uint64_t d, int l);
unsigned int pedal_checksum(uint64_t d, int l);
Expand Down
4 changes: 3 additions & 1 deletion can/common.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ cdef extern from "common_dbc.h":
PEDAL_CHECKSUM,
PEDAL_COUNTER,
VOLKSWAGEN_CHECKSUM,
VOLKSWAGEN_COUNTER
VOLKSWAGEN_COUNTER,
SUBARU_CHECKSUM,
CHRYSLER_CHECKSUM

cdef struct Signal:
const char* name
Expand Down
2 changes: 2 additions & 0 deletions can/common_dbc.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ enum SignalType {
PEDAL_COUNTER,
VOLKSWAGEN_CHECKSUM,
VOLKSWAGEN_COUNTER,
SUBARU_CHECKSUM,
CHRYSLER_CHECKSUM,
};

struct Signal {
Expand Down
4 changes: 4 additions & 0 deletions can/dbc_template.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ const Signal sigs_{{address}}[] = {
.type = SignalType::VOLKSWAGEN_CHECKSUM,
{% elif checksum_type == "volkswagen" and sig.name == "COUNTER" %}
.type = SignalType::VOLKSWAGEN_COUNTER,
{% elif checksum_type == "subaru" and sig.name == "CHECKSUM" %}
.type = SignalType::SUBARU_CHECKSUM,
{% elif checksum_type == "chrysler" and sig.name == "CHECKSUM" %}
.type = SignalType::CHRYSLER_CHECKSUM,
{% elif address in [512, 513] and sig.name == "CHECKSUM_PEDAL" %}
.type = SignalType::PEDAL_CHECKSUM,
{% elif address in [512, 513] and sig.name == "COUNTER_PEDAL" %}
Expand Down
Loading

0 comments on commit bbc02b1

Please sign in to comment.