Page 1 of 1

Can you emulate everything?

Posted: Fri Apr 24, 2020 4:18 pm
by joukoy
Idea:
Load bin-file in emulator (easy68k?) and debug it, to find all tuning tables etc.
Emulate all PCM hardware & engine sensors with software.
For example
- crank sensor signal generated with timer, user select rpm
- cam signal derived from crank signal
- Gear selection with number
- Speed sensor signal calculated from crank sensor using gear selection
- Engine temp sensor (analog signal): user selectable number, (or automatic increase to desired number) supplied to emulator, address where AD converter is normally mapped
- etc...

Is this kind of app already available?
Is idea useful or should I forget this?
Is there enough info available about PCM to create this?
Is easy68k compatible with cpu in p01/p59, or is there compatible emulator available?

Re: Can you emulate everything?

Posted: Fri Apr 24, 2020 5:15 pm
by NSFW
That would take a lot of work. Probably not really hard work, but emulating each sensor signal would take some work, and there are quite a few of them.

That said, I'm pretty sure we could get 99% of the value of that using just an M68k emulator plus a .bin file plus a RAM dump from a PCM while it's idling. That is enough to step through almost any section of code.

Consider a 3-bar hack, or a 2-step rev limiter, for example. The code that reads the sensors doesn't need to change. The code that does change is just going to be reading a few values from RAM (manifold pressure, RPM, vehicle speed, clutch and brake flags, etc) and then writing to some other values in RAM (load, spark advance, fuel-cut flag or spark-cut flag, etc).

That's basically how I did all of my Subaru stuff. We were very fortunate on that platform to have a great compiler/emulator/debugger package that the CPU manufacturer gave away for free just to encourage companies to build stuff with their chips. But I don't recall whether I actually used a full RAM dump or just set the values that I cared about.

Re: Can you emulate everything?

Posted: Fri Apr 24, 2020 5:17 pm
by antus
Its possible, but agree quite a job. "Emulate all PCM hardware & engine sensors with software." is one hell of a job, being a closed source propriety system. If you knew enough to be able to do this successfully, you probably wouldn't need to do it anymore.

You certainly can emulate sensors with a kit like a Jim Stim connected to a real PCM. This is a great way to test code modifications with no risk to your engine.

Re: Can you emulate everything?

Posted: Fri Apr 24, 2020 5:23 pm
by joukoy
Thanks, two good answers.
I think, I don't have enough skills or time for this.

Re: Can you emulate everything?

Posted: Fri Apr 24, 2020 5:28 pm
by antus
It seems from here viewtopic.php?f=42&t=6735#p99957 that if you had a real pcm, and a jimstim, you'd be able to read RAM while it was running over OBD. You could test or validate things that way. If you wanted to patch the OS you could probably add a poke routine to shove data in to a running PCM too. There is BDM which is designed for this, but I think because of the real time nature of the code and the hardware, it would not work or would not be useful.