Hello PRJ,
I appreciate your comment, and i know its the way to implement. However its not possible with my skillset. I would love to do it correctly, but i dont even understand where the KWP Stack starts. Even with the A2L its not possible for me to locate the exact function where the KWP Messages are being processed. If you would point me into the right direction, i would really appreciate that. My current goal is to find a way of "unlocking" the flash, so i can modify any code/maps on the fly.
Okay well, this is a good example of the
XY problem.
You can not write to the flash when the ECU is running.
That's not how flash memory works.
First of all, Flash memory works based on pages. You can only erase an entire page.
Furthermore, while you are programming/erasing the flash, the majority of microcontrollers do not allow executing from it.
So no, you can't just magically send a write command to the flash. While the ECU is running.
The only way is to redirect the flash reads to RAM (and then write RAM), this can be done on code level e.g. Bosch MEDC17 or it can be done on processor level (Overlay functionality).
On MED9 it was done by adding extra hardware (ETK) and remapping the SDA (iirc) accesses there.
If you want to do it without extra hardware, then you have very limited RAM to work with, so you can't just remap the whole calibration area.
It means for every single map and/or parameter that you want to alter that way you need to write extra code to do so.
There is something older called "verstellsystem", which has conveniently placed intercept points in many functions that allow to alter the basic outputs of the ECU at given operating points.
E.g. a flat offset to injection time, or timing or a fixed WGDC.
These can be used on a dyno - you can monitor the current ECU operating conditions and feed a constant custom overlay over the current parameters.
Does not work if you make very fast and sudden changes in operating conditions, but works well enough to tune in steady state or on pulls with a relatively low ramp rate.