dual spark mode rpm - megatune
Read the manual to see if your question is answered there before posting. If you have questions about MS1/Extra or MS2/Extra or other non-B&G code configuration or tuning, please post them at http://www.msextra.com The full forum rules are here: Forum Rules, be sure to read them all regularly.
dual spark mode rpm - megatune
Re: dual spark mode rpm - megatune
Re: dual spark mode rpm - megatune
I will try to provide the pertinent information as to what I am doing.
Attached find a photo of logic analyzer output decoding a GM 7 tooth reluctor wheel with "signature" tooth as described in your manual.
First trace processed reluctor output - second trace logic to be input to opto+ - third trace logic to be input to vrin2.
Note the bright signal in the reluctor output is the double 10 degree separated tooth (poor photo technique). Also included is a photo of the AVR 2313 based board with reluctor processing chip NCV1124 .
I have designed and built this to drive a wasted spark system for a four cylinder GM Ecotec engine. Also thought the hardware addition might be useful to others - the software could be modified to provide dual spark outputs in many custom sitiuations.
I am attaching the msq file. I hope we can solve the problem.
Michael
- Attachments
-
- megasquirt200810041329.msq
- msq file
- (25.13 KiB) Downloaded 30 times
-
- crankconv.jpg
- Crank Decode Hdwr
- (140.88 KiB) Downloaded 17 times
-
- logicanaoutput.jpg
- Logic View
- (143.1 KiB) Downloaded 23 times
Re: dual spark mode rpm - megatune
If the signals in traces 2 and 3 are offset by 180 deg, then in each trace the pulses are 360 deg apart. This means you are getting a combined total of 4 pulses per 720 crank deg. From this I assume you have 2 wasted spark coils. I will have to check this on the bench when I get a chance and see what rpm I get.
Re: dual spark mode rpm - megatune
Re: dual spark mode rpm - megatune
The software must be waiting until the count stated in your code below is satisified (I believe it wants 2 inputs/rev from at least the first input). Since I only provide one - twice the time would elapse thus half the RPM.
It is difficult to interpret others' code - please forgive if I misread.
Please also note that it will be easy for me to convert to a (six tooth - one missing) format thus avoiding the dual spark complications. I went this way initially since it is intuitively pleasing to me.
// Just received new input pulse - 1/ cyl / 2 crank revs (1 for 2 stroke).
// In wheel decode mode will throw out pulses to achieve this.
if(TFLG1 & 0x01) {
// interrupt from 1st IC sensor
TFLG1 = 0x01; // clear IC interrupt flag
ICint = 0;
if((inpram.DualSpkOptn == 1) || (inpram.DualSpkOptn == 6))
OCint = 0;
tcIC = *pTIC[0];
TCICus = (tcIC/3)<<1;
if(pulse_no == 0) { // 1st input pulse
pulse_no++;
OCint = 0;
ICt_overflow[0] = 0;
ICtt_ovflo = 0;
t_in3[0] = TCICus;
dt2[0] = 0;
dt3[0] = 0; // time difference between pulses, us
outpc.dt3 = dt3[0]; // for HP calculations
dtpred = dt3[0]; // predicted time difference for next pulse
tddtpred = 0;
t2dddts = 0;
ign_state[0] = 0;
missed_pulse[0] = 0;
xtra_pulse[0] = 0;
mask_teeth = 0;
nsynch = 0;
//----------------------------------------------------------------------------------------------------
if(inpram.no_skip_pulses > 2)
no_chk_pulses = inpram.no_skip_pulses;
else
no_chk_pulses = 2; // ??? MA
if((inpram.DualSpkOptn == 1) || (inpram.DualSpkOptn == 6))
no_chk_pulses++; // else have to use pulse_no[ICint] //no_chk_pulses 2 + 1 ??? MA
goto IC_RET;
//-------------------------------------------------------------------------------------------------------
}
}
else if((inpram.DualSpkOptn == 1) || (inpram.DualSpkOptn == 6)) {
// interrupt from 2nd IC sensor (Dual Spark mode)
TFLG1 = ICintmask[1]; // clear IC2 interrupt flag
ICint = 1;
OCint = 1;
tcIC = *pTIC[1];
TCICus = (tcIC/3)<<1;
// wait til synch on 1st IC
if(!synch) {
ICt_overflow[1] = 0;
t_in3[1] = TCICus;
dt2[1] = 0;
dt3[1] = dt3[0];
ign_state[1] = 0;
missed_pulse[1] = 0;
xtra_pulse[1] = 0;
goto IC_RET;
}
}
else {
// interrupt from 2nd IC sensor (cam/crnk_sync)
ICint = 1;
cam_sync = 1;
goto IC_RET;
}
if(synch != END_SYNCH) {
ICtt_ovflo = 0;
}
else { // synched
// if synched in wheel decode - process pulses
Re: dual spark mode rpm - megatune
if(inpram.DualSpkOptn == 1) {
// crank signal
if(inpram.EngStroke == 0) // 4 stroke
if(inpram.no_cyl == 2) // 2 cyl
Rpm_Coeff = 120000000;
else // 4 cyl
Rpm_Coeff = 240000000; // crank signal
else // 2 stroke
Rpm_Coeff = 120000000;
}
else {
// cam signal (4 stroke)
Rpm_Coeff = 240000000;
}
Rpm_Coeff /= inpram.no_cyl;
For your case (DualSpk =1, 4 stroke, 4 cyl) Rpm_Coeff = 240000000 / 4 = 60000000.
Later in TimerIn ISR:
rpm = (unsigned int)(Rpm_Coeff / dt3[ICint]);
where dt3 holds the time difference (in usec) between pulses with ICint being the input channel. THere is no skipping of pulses, that is done only at the very start and after 2 pulses are thrown out, all others are used.
Is it possible the scaling in the MT ini file was changed ? If you fiddle with the cranking rpm it will cause the processor to come out of cranking mode which you can see in MT. So if you set this rpm to say 200, then if the processor is seeing 267 it will come out of cranking mode; if it is seeing 134 it will stay in cranking.
Re: dual spark mode rpm - megatune
I was having problems with cranking mode as you suggested.
Thankyou. I am looking forward to continuing adventures with microsquirt.