MEVD17.2 emulation in development

Twisted Tuning

Lieutenant
Platinum Vendor
Oct 25, 2016
980
907
0
New York
www.twistedtuning.com
Ride
N54 and N55 Cars
The sheer complexity of the program code in these ECUs is really, really hard.

this is something i don't think people realize when asking for stuff to happen lol. not only is the normal code and logic complex. but while trying to adapt or add or change things that wasn't there (if its not already there) you have to make the change and adaption play nice with the rest of the code. So often times it requires changing more than whats needed to adapt something so it doesn't error stuff out or break logic or code somewhere else.

This is not like using INPA to swap a cluster or DME or code an injector people, lol. Software used for doing that is mainly already written to do so. Its not a simple single or couple value changes. this type of stuff is breaking down into the base code. layers below the top layer of what end users see happening.
 
Last edited:

Twisted Tuning

Lieutenant
Platinum Vendor
Oct 25, 2016
980
907
0
New York
www.twistedtuning.com
Ride
N54 and N55 Cars
Of topic for instance. The car is this video is a 2004 Mazda 6 that came with a 3.0L V6. its one of my other shop cars. This car runs a Denso ECU for controlling the engine. This car however was not meant to be turbo. Its twin turbo with nitrous.

I did a lot of custom codework on this car on my own. Because its the only one of its kind literally. So i wanted Anti-lag. it took me three months alone, jjust to re-write enough code and have it do what i want it to do without breaking any of the other needed logic. This is just ONE simple feature for an ECU seemingly less complex than the ones in these N55 vehicles.

So 3 months of work, and i lost track of the total hours and i wind up with this (never seen on that platform)

 
Last edited:

Sbrach

Corporal
Oct 2, 2017
224
175
0
Ride
N55 DCT E82
I think Omar was asking what aspects in particular would be difficult, not doubting that it would be difficult. Don't worry, this isn't e90 post and people are going to ask when a new feature is going to be released every 10 seconds.
 

Twisted Tuning

Lieutenant
Platinum Vendor
Oct 25, 2016
980
907
0
New York
www.twistedtuning.com
Ride
N54 and N55 Cars
@Twisted Tuning i understand what you are trying to say but not everyone is clueless ... as sbrach said , would just like to understand what aspect of it is difficult. outside of that most of us in this forum are familiar with how complex the logic and coding in the dme could be


yes, I may have misunderstood what you were asking. My bad on that. But at least now a post is there for anyone who doesn't have the understanding you guys do, haha.
 
  • Funny
Reactions: Omar@VaderSolutions

LamboLover

Corporal
Apr 6, 2017
238
242
0
Ride
Everything
Perhaps the bits I find most difficult right now will feel mundane once solved, but apart from reverse engineering the code which is easier because there is more information available for German ECUs than the Japanese ECUs I did for 10 years (you'll find quite a bit of my code in many Evos and GT-R for things like speed density, map switching, realtime tuning, faster datalogging, increased limits, alternative boost control etc), but more difficult because the German stuff is far more complicated, the biggest challenge has been automation of patching to allow increases in features/complexity, reduction in bugs, make it maintainable.

For example, some BMW ECUs use three different methods to access 3d maps, depending on their inheritance from N54 models, Bosch, or for some unknown reason, a new BMW method that is worse than the other two. Just trying to work out where the code is that uses a 3d map can be really difficult, and of course if you want to make that map realtime and flex fuel, you not only have to understand it, but then alter it, and automate that alteration to do it on any scale whilst covering all the side effects and edge cases.

Once that was solved, I had to find some PC software to run it all... that had numerous boring setbacks and disappointments, for example, buying rights to source and distribution for a package that should have almost "just worked" back in April, but finding that it took 40 seconds to do something my own code did in 3 seconds and for which the author didn't want to acknowledge a problem as they inhabited a world of simulation instead of real hardware.

Then it all needed protecting, which has cross fertilised the N54 MHD work.

So this year I've learned: C, C#, IDA Python, Win32 API, J2534, CCP to get to where this now is.

With the future of MHD F series looking very bright indeed, it seems that my niche modifications that were never going to justify the effort on just the E series N55 could reach a wider audience.
 

Omar@VaderSolutions

Lieutenant
Premium Vendor
Oct 19, 2016
535
409
25
NY & AZ
vadersolution.com
Ride
N54 135i & N54 335i
Perhaps the bits I find most difficult right now will feel mundane once solved, but apart from reverse engineering the code which is easier because there is more information available for German ECUs than the Japanese ECUs I did for 10 years (you'll find quite a bit of my code in many Evos and GT-R for things like speed density, map switching, realtime tuning, faster datalogging, increased limits, alternative boost control etc), but more difficult because the German stuff is far more complicated, the biggest challenge has been automation of patching to allow increases in features/complexity, reduction in bugs, make it maintainable.

For example, some BMW ECUs use three different methods to access 3d maps, depending on their inheritance from N54 models, Bosch, or for some unknown reason, a new BMW method that is worse than the other two. Just trying to work out where the code is that uses a 3d map can be really difficult, and of course if you want to make that map realtime and flex fuel, you not only have to understand it, but then alter it, and automate that alteration to do it on any scale whilst covering all the side effects and edge cases.

Once that was solved, I had to find some PC software to run it all... that had numerous boring setbacks and disappointments, for example, buying rights to source and distribution for a package that should have almost "just worked" back in April, but finding that it took 40 seconds to do something my own code did in 3 seconds and for which the author didn't want to acknowledge a problem as they inhabited a world of simulation instead of real hardware.

Then it all needed protecting, which has cross fertilised the N54 MHD work.

So this year I've learned: C, C#, IDA Python, Win32 API, J2534, CCP to get to where this now is.

With the future of MHD F series looking very bright indeed, it seems that my niche modifications that were never going to justify the effort on just the E series N55 could reach a wider audience.
i really appreciate the explanation on the "struggle" ... an eye opener for sure, shows how smart people can really be to figure stuff out like this.
 

LamboLover

Corporal
Apr 6, 2017
238
242
0
Ride
Everything
I'm not bragging in saying this, but out of a number of IQ tests we did at medical school to attempt to correlate MRI brain volume with IQ, my minimum score was 130 because that was the maximum score possible with that technique. There was no correlation by the way, and training made a massive difference to IQ results so I don't hold much faith in them, but even with those scores, this is more difficult than anything else I've done.

Wrapping your head around the disassembly of a large structure in C and extracting some useful meaning to a tuner makes those tests seem like kindergarten.
 
  • Informative
Reactions: Omar@VaderSolutions

doublespaces

Administrator
Oct 18, 2016
9,303
4,332
0
AZ
Ride
2009 E93 335i
Perhaps the bits I find most difficult right now will feel mundane once solved, but apart from reverse engineering the code which is easier because there is more information available for German ECUs than the Japanese ECUs I did for 10 years (you'll find quite a bit of my code in many Evos and GT-R for things like speed density, map switching, realtime tuning, faster datalogging, increased limits, alternative boost control etc), but more difficult because the German stuff is far more complicated, the biggest challenge has been automation of patching to allow increases in features/complexity, reduction in bugs, make it maintainable.

For example, some BMW ECUs use three different methods to access 3d maps, depending on their inheritance from N54 models, Bosch, or for some unknown reason, a new BMW method that is worse than the other two. Just trying to work out where the code is that uses a 3d map can be really difficult, and of course if you want to make that map realtime and flex fuel, you not only have to understand it, but then alter it, and automate that alteration to do it on any scale whilst covering all the side effects and edge cases.

Once that was solved, I had to find some PC software to run it all... that had numerous boring setbacks and disappointments, for example, buying rights to source and distribution for a package that should have almost "just worked" back in April, but finding that it took 40 seconds to do something my own code did in 3 seconds and for which the author didn't want to acknowledge a problem as they inhabited a world of simulation instead of real hardware.

Then it all needed protecting, which has cross fertilised the N54 MHD work.

So this year I've learned: C, C#, IDA Python, Win32 API, J2534, CCP to get to where this now is.

With the future of MHD F series looking very bright indeed, it seems that my niche modifications that were never going to justify the effort on just the E series N55 could reach a wider audience.

If you learned C# you may as well pick up a Java book if you haven't. When I was building my BMW flashing app back in the day I was porting C# to code I could use in Eclipse for Android, wasn't too hard even for someone new to both languages. Once a coder always a coder :D

Disassembly however.. that is a different level of understanding, makes your basic code pusher like me feel inferior. I did crack winrar's registration nag once though...lol. Sadly, having IDA installed on my computer doesn't make me good at RE :(
 

LamboLover

Corporal
Apr 6, 2017
238
242
0
Ride
Everything
You will drive me mad learning another! I've been learning just the required to suit the projects I'm working with. C# motivator was actually Android and being a quick way to test concepts in Windows. We all have our skills, I know I suit disassembly and embedded stuff more than this new fangled OOP stuff ;)

What was your BMW flasher?
 

doublespaces

Administrator
Oct 18, 2016
9,303
4,332
0
AZ
Ride
2009 E93 335i
I don't really have any pictures of it anymore, but I had ported the BIN read out before I stopped since my bench was not functioning and I did not have an N54 at the time since I flipped my car. Here is probably the only screenshot I have of any of the work I did on it. Just a simple port of the PC BMW Flasher (that got renamed later to the bb flash). This was a very early screengrab of the interface:

mYwWQTXIX48tACsxcQzVaVux-rROP978uNoKI9pxoto.png


Here was the code/application I was porting from. Notice, there is no BB branding on it, because BB had nothing to do with that program, they just slapped their name on it at the end because none of the other five people or so wanted to be associated with it. Then he pranced around southern California pretending to be an open source flashing god.
6BEgYm8.png
 
  • Like
Reactions: LamboLover

Sbrach

Corporal
Oct 2, 2017
224
175
0
Ride
N55 DCT E82
Have you dug in to the lambda adaption logic at all?

There was a recent discussion regarding post cat lambda sensors being used to calibrate the pre cat sensor on one of the Facebook groups. I think it is fairly common knowledge that the post cat sensor can affect fuel trim but I don't know to what extent. Specifically I'm curious how the adaption works on modified cars with a different distance between sensors and often without a cat between sensors as well as what the effects are if the post cat sensor is removed and the associated DTCs disabled. On my car I am currently running the post cat sensor in a non-oem location and with a 90* spacer. With the DTCs for slow response disabled this is enough to fool cat efficiency and allows the monitor to reach Ready. I'm curious if adaption only takes place during steady state, I would think if it does than my setup would look pretty similar to the OEM setup to the DME.
 

LamboLover

Corporal
Apr 6, 2017
238
242
0
Ride
Everything
Not dug into adaption much, but, they use a neural network for it! It looks utterly bonkers. No wonder a BMW six cylinder twin turbo with direct injection (eg S55) has no free RAM left when an Audi eight cylinder twin turbo with direct injection and similar specific output using the same TC1797 CPU has lots left.
 

Sbrach

Corporal
Oct 2, 2017
224
175
0
Ride
N55 DCT E82
Well that pretty much means I won't understand it even if you do end up digging in and explaining it. :tearsofjoy:

Back to my original plan of adding a 3rd bung for an external wideband so I can log and verify the pre-cat readings periodically.

Thanks.
 
  • Agree
Reactions: Omar@VaderSolutions

LamboLover

Corporal
Apr 6, 2017
238
242
0
Ride
Everything
That is one of my biggest concerns about this sort of technique of "AI" in engineering or medicine. If a human does something you can at least ask them to explain their logic, but a self learning system appears to be a black box that is difficult to peak inside but which you deploy when it can identify cats on a surf board better than humans.
 

Jake@MHD

Major
Platinum Vendor
Nov 7, 2016
1,593
2,060
0
Philly
With the future of MHD F series looking very bright indeed, it seems that my niche modifications that were never going to justify the effort on just the E series N55 could reach a wider audience.

I told you it would :)

Then he pranced around southern California pretending to be an open source flashing god.

Hahahahaha.

Back to my original plan of adding a 3rd bung for an external wideband so I can log and verify the pre-cat readings periodically.

I recommend everyone that goes beyond a few basic bolt-ons should install an external wideband, it's definitely a smart investment!