How to Build the FreeEMS Firmware to Use With Jaguar

Andy's GM DIS centric hardware design! Also works as a fuel controller for EDIS and distributor applications.
User avatar
DeuceEFI
LQFP144 - On Top Of The Game
Posts: 578
Joined: Thu Feb 25, 2010 3:57 am
Location: Gosport, IN USA
Contact:

How to Build the FreeEMS Firmware to Use With Jaguar

Post by DeuceEFI »

OK, now that the schematics and the PCB are taking shape, I need to start figuring out how to build the freeems-vanilla firmware to use my

Engine is a V-6

Crankshaft RPM sensor (24 evenly spaced windows) on Port T0
Camshaft position sensor (1 tooth trailing edge of waveform is cylinder #1) on Port T1
Injectors are paired on Port T4, T5 and T6
DIS-Bypass needs to be 0v when crankshaft is below 300 RPM and +5v when crankshaft is above 300 RPM - This is currently on Port T3, but we can jumper it over to one of the Port P outputs (ie: Port P0)
DIS-Advance needs to send Pulse Width Modulated 5v signal for timing advance - This is currently on Port T2, but we can jumper it over to one of the Port P outputs (ie: Port P1)

Once I figure out how to build the firmware for this, I can test it with my TA board to make sure it works ok before etching a prototype Jaguar PCB.

I have successfully done a build of FreeEMS-0.2.0-SNAPSHOT code on my Debian 6 machine but I'm not sure which, if any of the files will work for my purposes or which of the source files to modify/use...

Just point me in the right direction :-)
User avatar
Fred
Moderator
Posts: 15431
Joined: Tue Jan 15, 2008 2:31 pm
Location: Home sweet home!
Contact:

Re: How to Build the FreeEMS Firmware to Use With Jaguar

Post by Fred »

Give me a day or two and I'll help you get it sorted out. It will need some custom code for the DIS stuff, but other than that it will probably sync up OK on the same code Sim runs, which is labeled 12and1 due to 12 on crank = 24 on cam. 24 per cycle, right? No, according to the diagram in your source repo, you'll need a new build, which I can add called 3+1 to suit 6 cam pulses. Is the diagram correct? I think it would be better to make some custom code for your application as then we could use both edges to get more accuracy.

You could get RPM readings with a 3+1 build, though. Check out the 12+1 source file in the decoders dir for an example on how to do that.

Fred.
DIYEFI.org - where Open Source means Open Source, and Free means Freedom
FreeEMS.org - the open source engine management system
FreeEMS dev diary and its comments thread and my turbo truck!
n00bs, do NOT PM or email tech questions! Use the forum!
The ever growing list of FreeEMS success stories!
User avatar
DeuceEFI
LQFP144 - On Top Of The Game
Posts: 578
Joined: Thu Feb 25, 2010 3:57 am
Location: Gosport, IN USA
Contact:

Re: How to Build the FreeEMS Firmware to Use With Jaguar

Post by DeuceEFI »

Fred wrote:Give me a day or two and I'll help you get it sorted out. It will need some custom code for the DIS stuff, but other than that it will probably sync up OK on the same code Sim runs, which is labeled 12and1 due to 12 on crank = 24 on cam. 24 per cycle, right? No, according to the diagram in your source repo, you'll need a new build, which I can add called 3+1 to suit 6 cam pulses. Is the diagram correct? I think it would be better to make some custom code for your application as then we could use both edges to get more accuracy.

You could get RPM readings with a 3+1 build, though. Check out the 12+1 source file in the decoders dir for an example on how to do that.

Fred.
It appears I made a small mistake, the waveforms (3x Crank / 1x Cam) that I originally posted were what the DIS module sends to the factory ECM as well as what the MS-2 on my chassis is currently setup for, but I do have a 24x (24 pulses per 360* [1 revolution of the crank]) square wave coming directly off the front RPM sensor on my harmonic balancer.

More Information about my setup:

The 3100/3400 series FWD and 3.4L RWD had this 24x Hall Effect RPM sensor behind the harmonic balancer (at least from 1993-1996, I know this since my front timing cover is from a 1993 Camaro RWD 3.4L V-6 and is mated to a 1996 Oldsmobile FWD 3100 (3.1L) SFI V-6 iron block with Fast-Burn aluminum heads).

The FWD engines have a 7x VR sensor that only goes to the DIS Ignition Module to supply it with RPM and Cylinder #1 reference so that it can take care of the firing order, all we supply is the amount of timing advance/retard based on the 0-5v PWM signal.

I added a new Crank-Cam-DIS-Waveforms.png file to the docs directory in my repository showing the signals and removed the other .png as the information from that one is also in the new file.
Just let me know if we can use the 24x or if I should continue down the path of using the 3x signal that is generated by the DIS module. In either case I think we would still want the 1x Cam position sensor input so that the firmware can tell when cylinder #1 is at TDC.

I know from the factory training manuals that I have for the GM Ignition Systems, that the 24x (with no #1 cylinder indicator) is only used to supply the factory ECM with precision RPM information at low RPMs for sequential injection at idle through cruise (roughly 2200 RPM) where it uses the 1x Cam position sensor to sync cylinder #1 TDC and that the factory ECM uses the 3x signal for engine speeds higher than 2200 RPM and it changes over to a semi-sequential injection method (just as FreeEMS-vanilla is capable of today :-) using Port T for V-6 / V-8 engines).
User avatar
Fred
Moderator
Posts: 15431
Joined: Tue Jan 15, 2008 2:31 pm
Location: Home sweet home!
Contact:

Re: How to Build the FreeEMS Firmware to Use With Jaguar

Post by Fred »

You can use either 24 or 6 + the single pulse on the cam, I'd go 6 for lower interrupt load considering you'll not be dong ignition with it.

However, if the 7 tooth wheel is on the crank, how does it know which end of the cycle it's at? Or can it vary between one start to the next?

You keep talking about a PWM output to the DIS unit. Is it really PWM or is it a timed pulse of a certain width that the DIS interprets much like EDIS? If it's really PWM in that the timing of the edges doesn't matter, then we should shuffle your pins a bit again. If not, I think it's misleading to call it PWM. I mean, you could call a dwell PWM too, or injection duty PWM, but you don't, because the timing matters, not just the duty. If it needs to be timed the code will be simpler with the 6 tooth setup too.

If you were doing ignition timing directly then you'd want to use the crank wheel(s) to gain better accuracy under dynamic conditions such as cranking and free revving.

Did you draw that diagram or did it come from some good source or where? The alignment of the edges worries me a little (though not much). I'd be very interested in a LA trace from the output of the max attached to those inputs.

I need to add a special logger mode to the firmware for exactly this purpose too.

Fred.
DIYEFI.org - where Open Source means Open Source, and Free means Freedom
FreeEMS.org - the open source engine management system
FreeEMS dev diary and its comments thread and my turbo truck!
n00bs, do NOT PM or email tech questions! Use the forum!
The ever growing list of FreeEMS success stories!
User avatar
Fred
Moderator
Posts: 15431
Joined: Tue Jan 15, 2008 2:31 pm
Location: Home sweet home!
Contact:

Re: How to Build the FreeEMS Firmware to Use With Jaguar

Post by Fred »

It's officially on my TODO now :-)

http://issues.freeems.org/view.php?id=518
DIYEFI.org - where Open Source means Open Source, and Free means Freedom
FreeEMS.org - the open source engine management system
FreeEMS dev diary and its comments thread and my turbo truck!
n00bs, do NOT PM or email tech questions! Use the forum!
The ever growing list of FreeEMS success stories!
User avatar
DeuceEFI
LQFP144 - On Top Of The Game
Posts: 578
Joined: Thu Feb 25, 2010 3:57 am
Location: Gosport, IN USA
Contact:

Re: How to Build the FreeEMS Firmware to Use With Jaguar

Post by DeuceEFI »

Fred wrote:You can use either 24 or 6 + the single pulse on the cam, I'd go 6 for lower interrupt load considering you'll not be dong ignition with it.
Ok, the 6x signal is what the MS is using as the TACH input currently and what the factory ECU uses as well for RPMs greater than 2500 RPM for the same reason and I'm good with that, just wanted to give you the whole picture of what the engine has available in the factory configuration.
Fred wrote:However, if the 7 tooth wheel is on the crank, how does it know which end of the cycle it's at? Or can it vary between one start to the next?
Ok, more in depth and clearly stated information is needed from me to you :-)

The 7X crank (VR) sensor feeds an input into the DIS ignition module. The 7X signal consists of 6 equally spaced pulses every 60 crank degrees, with an extra sync pulse 10 degrees after cylinder #1/4 TDC. The DIS ignition module uses this sync pulse to determine crank position. On a GM factory DIS setup, the ECM never knows the actual crank position, and it doesn't need to in order to control the timing advance. The DIS module handles all of the cylinder firing order issues (much like Ford EDIS). We don't need to use the 7x signal since the DIS ignition module deals with the weird pattern automatically.

The DIS ignition module then sends a reference (TACH) signal (6x 0-5vdc square-wave) to the GM ECM. This reference signal consists of a square-wave pattern with 3 pulses per engine revolution (6 pulses per complete firing order cycle). The GM ECM uses this to determine engine speed, and as a timing reference to send the EST pulse back to the DIS module to control spark advance. The ECM advances or retards the EST pulse in relation to the reference pulses to change the spark advance.

The advance signal needs to be generated by the FreeEMS firmware from the reference (TACH) signal by modifying its duty cycle (pulse width). Larger duty cycles mean less advance, as the spark is delayed by a larger amount.

On the Sequential Fuel Injection (SFI) engines such as mine, GM added a 24X crank sensor (12 pulses per revolution/24 pulses per complete firing order cycle), and a 1X cam sensor. The 24x signal is 24 equally spaced pulses every 15 crank degrees. The GM ECM uses the 24X signal for high resolution fuel injection control at low rpm, and the 1X cam signal is used as a TDC reference pulse to determine crank position. To go with sequential injection in the future I think we would need to use the 24X signal as the primary trigger (for precision, but we can use the 6x, and the 1X signal as the secondary (home/cylinder#1 TDC) trigger.

But for now, I think we should stick with the 6x TACH signal plus the 1x Cam (cylinder#1 TDC) pulses for the input to the CPU for the FreeEMS firmware to process since this would involve less interrupt overhead.
Fred wrote:You keep talking about a PWM output to the DIS unit. Is it really PWM or is it a timed pulse of a certain width that the DIS interprets much like EDIS? If it's really PWM in that the timing of the edges doesn't matter, then we should shuffle your pins a bit again. If not, I think it's misleading to call it PWM. I mean, you could call a dwell PWM too, or injection duty PWM, but you don't, because the timing matters, not just the duty. If it needs to be timed the code will be simpler with the 6 tooth setup too.
That was entirely my fault :oops: with terminology, it is really a timed pulse of a certain width just like EDIS uses... See the explanation above :-)
Fred wrote:If you were doing ignition timing directly then you'd want to use the crank wheel(s) to gain better accuracy under dynamic conditions such as cranking and free revving.
Yeah, the factory only uses the 24x signal for cranking to about 2500 RPM, for everything else they use the 6x signal from the DIS ignition module.
Fred wrote:Did you draw that diagram or did it come from some good source or where? The alignment of the edges worries me a little (though not much). I'd be very interested in a LA trace from the output of the max attached to those inputs.
The Crank-Cam-DIS waveform graph is one I made in GiMP based on the original graph that I found in the "GM ASEP/BSEP ASE-8 Engine Performance Module 9 - Ignition Systems" manual (SWB_a8_m09_Final.pdf) from 2003. I added the 24x signal... The original graph is the one that was originally in my repository... The previous "Module 8 - Ignition Systems Triggering" (SWB_a8_m08_Final.pdf), also from 2003, contained similar information with more emphasis on the triggering mechanism. You should be able to download both of those PDFs by searching the Internet for them.

The alignment is not 100% accurate, I haven't scoped them while the engine is running, but I can later on in the week, at least I think I can with xoscope :-)
Fred wrote:I need to add a special logger mode to the firmware for exactly this purpose too.
Cool, well not actually because it creates more work, but being able to log would be helpful.
User avatar
Fred
Moderator
Posts: 15431
Joined: Tue Jan 15, 2008 2:31 pm
Location: Home sweet home!
Contact:

Re: How to Build the FreeEMS Firmware to Use With Jaguar

Post by Fred »

OK, so you actually have 5 signals to choose from!

I'll take the time to refute a few things above a bit later, but for now one thing is now missing in my mind:

How is this EST timed pulse used by the DIS unit? What exactly are the characteristics of it that matter and precisely what do they do?

Fred.
DIYEFI.org - where Open Source means Open Source, and Free means Freedom
FreeEMS.org - the open source engine management system
FreeEMS dev diary and its comments thread and my turbo truck!
n00bs, do NOT PM or email tech questions! Use the forum!
The ever growing list of FreeEMS success stories!
User avatar
DeuceEFI
LQFP144 - On Top Of The Game
Posts: 578
Joined: Thu Feb 25, 2010 3:57 am
Location: Gosport, IN USA
Contact:

Re: How to Build the FreeEMS Firmware to Use With Jaguar

Post by DeuceEFI »

Fred wrote:OK, so you actually have 5 signals to choose from!
No, I only have the 24x crank sensor, the 1x cam sensor and the 3x TACH signal that is generated by the DIS unit. The 7x VR sensor is only used by the DIS to control the firing order and the DIS unit uses this waveform to generate this 3x TACH signal. I my confusion of information in my previous posts about the sensors and the DIS system there was mention by me of a 6x signal that does NOT exist. So I only have 3 signals to choose from for our purposes.
Fred wrote:I'll take the time to refute a few things above a bit later, but for now one thing is now missing in my mind:

How is this EST timed pulse used by the DIS unit? What exactly are the characteristics of it that matter and precisely what do they do?
Here is a little more information about how the DIS module works:

The GM DIS/HEI system uses a "next cylinder" advance calculation method. That is, you get the square wave (3x TACH signal) out of the module at 10° BTDC which is used for cranking/starting and Limp Home Mode. To advance the timing the ECM waits until the NEXT cylinder to fire to provide an altered signal (EST or advance signal) to the coil.

Reference (3x TACH signal) pulses come into ECM at 10° BTDC from the GM DIS/HEI module. At each reference (TACH) pulse, the period between it and the previous reference pulse needs to be calculated. The difference is used (with a time interpolation technique) to set up the timing pulse for the next ignition event. Specifically, the reference period needs to be added to the time of the current pulse, a calculated amount subtracted for the advance, another amount subtracted for the dwell to determine the rise time.

The GM DIS/HEI module fires on the 'trailing edge' of the advance signal. The advance signal needs to be generated by the ECM from the TACH signal by modifying its duty cycle (pulse width). Larger duty cycles mean less advance, as the spark is delayed by a larger amount.

The timing of the trailing edge determines the amount of advance: a longer pulse width means a more delayed, 'retarded' spark, while a shorter pulse width means an earlier 'advanced' spark.
User avatar
Fred
Moderator
Posts: 15431
Joined: Tue Jan 15, 2008 2:31 pm
Location: Home sweet home!
Contact:

Re: How to Build the FreeEMS Firmware to Use With Jaguar

Post by Fred »

Please stop telling me speculated, or even known, implementation details from the GM ECM side of the equation. All I care about is what the signal is used for and which parameters it must follow.

It sounds like you're saying that the EST output is a normal ignition output and that, like normal, a spark is fired at the end of the pulse. The only difference being that the DIS module distributes this signal to the correct coil. If only the trailing edge matters, why do you say shorter/longer, why not fixed and timed? I'm not saying it's the best approach, I'm just pointing out a hole in the information thus far. Does the beginning of the pulse determine which cylinder to send it to, and if so, when are the tolerances for "correct" for that. If not, then what?

This must be the later type of DIS system, right? The earlier type did the timing for you based on your provided information.

Re the number of signals available, we'll consider cutting wires included in available, just not for DIS support. So what I understand from your latest post is that the 360 on/off cam pulse does NOT come from the DIS box, but instead comes from the cam directly (whether directly is through a filter in the DIS box or not). IE, it's not generated from within the DIS box, though it may pass through it and you may need to be connected to it to receive the signal (without cutting). As best I can currently tell, that makes the total available four:
  1. Crank 6+1/7 tooth patterned wheel - connected to DIS box, only.
  2. Crank 12/24 tooth even wheel - connected to ECM
  3. Cam 360 on/off pattern - connected to ECM
  4. DIS 3/6 pulse even pattern - connected to ECM
Signals that control the DIS box:
  • Bypass which allows it to do dumb fixed timing based on the exact angles of the 6+1 wheel which fly past and which it passes on to the ECM also in a dumb/simple way.
  • EST which controls the timing directly through a logic gate of some sort
What I need to know is about the other end of the EST pulse, and nothing more about what the GM ECM is purported to do :-)

I think we're getting closer! :-)

Fred.
DIYEFI.org - where Open Source means Open Source, and Free means Freedom
FreeEMS.org - the open source engine management system
FreeEMS dev diary and its comments thread and my turbo truck!
n00bs, do NOT PM or email tech questions! Use the forum!
The ever growing list of FreeEMS success stories!
User avatar
DeuceEFI
LQFP144 - On Top Of The Game
Posts: 578
Joined: Thu Feb 25, 2010 3:57 am
Location: Gosport, IN USA
Contact:

Re: How to Build the FreeEMS Firmware to Use With Jaguar

Post by DeuceEFI »

Fred wrote:Please stop telling me speculated, or even known, implementation details from the GM ECM side of the equation. All I care about is what the signal is used for and which parameters it must follow.
Sorry, I wasn't sure what information you needed... I will try to answer your questions, read on below... :-)
Fred wrote:It sounds like you're saying that the EST output is a normal ignition output and that, like normal, a spark is fired at the end of the pulse. The only difference being that the DIS module distributes this signal to the correct coil. If only the trailing edge matters, why do you say shorter/longer, why not fixed and timed?
The EST output pulse is based on the TACH input pulse as the standard for 10 degrees BTDC, ie: if we mimic the TACH input as the EST output the DIS coil packs would fire each plug in turn at 10 degrees BTDC. You may be correct in saying fixed and timed.
Fred wrote:I'm not saying it's the best approach, I'm just pointing out a hole in the information thus far. Does the beginning of the pulse determine which cylinder to send it to, and if so, when are the tolerances for "correct" for that. If not, then what?
The DIS module takes care of the firing order, we just need to vary the EST output square-wave to change the amount of advance.
Fred wrote:This must be the later type of DIS system, right? The earlier type did the timing for you based on your provided information.
Nope, this is the same DIS system (or HEI system) that has been used on GM products since the mid 1980's. They used the same system for about 20 years. I have probably typed enough to thoroughly confuse both you and me on this subject.
Fred wrote:Re the number of signals available, we'll consider cutting wires included in available, just not for DIS support. So what I understand from your latest post is that the 360 on/off cam pulse does NOT come from the DIS box, but instead comes from the cam directly (whether directly is through a filter in the DIS box or not). IE, it's not generated from within the DIS box, though it may pass through it and you may need to be connected to it to receive the signal (without cutting).
Correct, the Cam on/off pulse has nothing to do with the DIS module, it was only an input for the ECM to control sequential fuel injection, not ignition. Right now the Cam and Crankshaft sensors are not even connected to the MS-2 box, they aren't required for ignition timing at all.
Fred wrote:As best I can currently tell, that makes the total available four:
  1. Crank 6+1/7 tooth patterned wheel - connected to DIS box, only.
  2. Crank 12/24 tooth even wheel - connected to ECM
  3. Cam 360 on/off pattern - connected to ECM
  4. DIS 3/6 pulse even pattern - connected to ECM
Correct.
Fred wrote:Signals that control the DIS box:
  • Bypass which allows it to do dumb fixed timing based on the exact angles of the 6+1 wheel which fly past and which it passes on to the ECM also in a dumb/simple way.
  • EST which controls the timing directly through a logic gate of some sort
Correct, the 6+1 wheel only allows the DIS module to pinpoint where TDC is for cylinders 1 and 4 (they are paired together on the same coil pack), so that it knows in what order to fire the coils.
If the Bypass input is floating or at ground potential, the DIS module fires the coils at 10 degrees BTDC in limp home mode.

You probably already have the code to calculate the EST pulse and send it out one of the Port T outputs :-)
Fred wrote:What I need to know is about the other end of the EST pulse, and nothing more about what the GM ECM is purported to do :-)
I should probably just scope the TACH and EST pulses and post that for you, as they say a picture is worth a thousand words...
Hopefully xoscope will work since they are both 5v signals, I will try to get them for you tomorrow evening. :-)
Fred wrote:I think we're getting closer! :-)
Bear with me and I will get the correct information to you in a manner that makes sense :-)
Post Reply