rnd-ash / ultimate-nag52-fw

Ultimate NAG52 firmware repository
GNU General Public License v3.0
46 stars 21 forks source link

Correctly send min/max/custom torque requests to engine ECU #9

Closed rnd-ash closed 1 year ago

rnd-ash commented 2 years ago

Currently when trying to ask the engine for 'X' amount of torque, we get many different outcomes depending on the users engine!?

I think this is a bug with Daimlers own ECUs, but this is a table of known ECU issues:

Engine Min torque request Max torque request Custom torque request
OM646 OK DTC set DTC set
OM628 DTC set - -
M113 OK OK No response

Stock EGS52 can do this OK, so we should CAN trace stock module and see what parity calculations it is applying to torque requests.

rnd-ash commented 1 year ago

Update from learned data.

Torque request from EGS contains the following fields that have to be filled Source:

Field name Description
MTGL_EGS Torque request toggle bit (Every 40ms)
MMIN_EGS Is min torque request?
MMAX_EGS Is max torque request?
M_EGS Torque request value
DYN1_EGS Active torque control mode
DYN0_AMR_EGS Enable torque request bit
MPAR_EGS Parity bit combining fields MTGL_EGS, MMIN_EGS, MMAX_EGS, M_EGS

Through loads of testing, I finally figured out what seems to keep MOST Engines happy for each mode

MTGL_EGS MMIN_EGS MMAX_EGS M_EGS DYN1_EGS DYN0_AMR_EGS MPAR_EGS
No torque request flipping 0 Parity calc
Minimum torque request flipping X Min torque to make X Parity calc
Maximum torque request flipping X Max torque to make X Parity calc
Exact torque request flipping X Exact torque to make X X Parity calc
rnd-ash commented 1 year ago

Fixed as of d7d49e3d2e672584fba1c881ba4a07cdf311c2a2