Skip to content

Commit

Permalink
Squashed 'opendbc/' changes from a62d5dd84..a57e7ddbd
Browse files Browse the repository at this point in the history
a57e7ddbd CANPacker: Subaru checksum support  (#241)
36c471e59 Fixed signals order and added new signals for subaru global (#221)
7b5a1fcc1 BMW 2008-2013 (#230)
cc09af763 Add RPM signal (#216)
47db9238f Add SWA_01 message detail and CRC support for VW MQB (#236)
c98fe2ab9 Fixed signal unknown1 overlapping the button bits (#239)
572261ee3 Rear Cross Traffic Alert
044730aeb Speed limit signs
87b1a21fb Pedals/gear, gas pedal scale value
ce78044d8 Tracking the steer angle with LKAS signal
7f19ab415 Introduce the new  mazda 3  2019/2020 dbc
e58520619 traffic sign speed limit
00bad5ee7 Speed Auto High Beam Traffic signs
9d080ea42 Nissan leaf (#238)
50fbbe739 nissan x trail cleanup (#237)

git-subtree-dir: opendbc
git-subtree-split: a57e7ddbd72c92241d5d6442da9d47c55e95a8cf
  • Loading branch information
Vehicle Researcher committed Apr 14, 2020
1 parent 72427d8 commit 78e45f5
Show file tree
Hide file tree
Showing 33 changed files with 1,219 additions and 304 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" ;
18 changes: 16 additions & 2 deletions can/common.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,19 @@ 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;
}
Expand Down Expand Up @@ -106,6 +117,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
1 change: 1 addition & 0 deletions can/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
// 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);
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
3 changes: 2 additions & 1 deletion can/common.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ cdef extern from "common_dbc.h":
PEDAL_CHECKSUM,
PEDAL_COUNTER,
VOLKSWAGEN_CHECKSUM,
VOLKSWAGEN_COUNTER
VOLKSWAGEN_COUNTER,
SUBARU_CHECKSUM

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

struct Signal {
Expand Down
2 changes: 2 additions & 0 deletions can/dbc_template.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ 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 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
3 changes: 3 additions & 0 deletions can/packer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,9 @@ uint64_t CANPacker::pack(uint32_t address, const std::vector<SignalPackValue> &s
// The correct fix is unclear but this works for the moment.
unsigned int chksm = volkswagen_crc(address, ReverseBytes(ret), message_lookup[address].size);
ret = set_value(ret, sig, chksm);
} else if (sig.type == SignalType::SUBARU_CHECKSUM) {
unsigned int chksm = subaru_checksum(address, ret, message_lookup[address].size);
ret = set_value(ret, sig, chksm);
} else {
//WARN("CHECKSUM signal type not valid\n");
}
Expand Down
7 changes: 7 additions & 0 deletions can/process_dbc.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ def process(in_fn, out_fn):
checksum_start_bit = 0
counter_start_bit = 0
little_endian = True
elif can_dbc.name.startswith(("subaru_")):
checksum_type = "subaru"
checksum_size = 8
counter_size = None
checksum_start_bit = 0
counter_start_bit = None
little_endian = True
else:
checksum_type = None
checksum_size = None
Expand Down
5 changes: 4 additions & 1 deletion generator/toyota/_toyota_2017.dbc
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,10 @@ BO_ 180 SPEED: 8 XXX

BO_ 353 DSU_SPEED: 8 XXX
SG_ FORWARD_SPEED : 15|16@0- (0.00390625,-30) [0|255] "kph" XXX


BO_ 452 ENGINE_RPM: 8 CGW
SG_ RPM : 7|16@0- (0.78125,0) [0|0] "rpm" SCS

BO_ 466 PCM_CRUISE: 8 XXX
SG_ GAS_RELEASED : 4|1@0+ (1,0) [0|1] "" XXX
SG_ CRUISE_ACTIVE : 5|1@0+ (1,0) [0|1] "" XXX
Expand Down
Loading

0 comments on commit 78e45f5

Please sign in to comment.