Go Down

Topic: Due Interrupt Unstable (Read 973 times) previous topic - next topic

kombi90

Hello Everyone!

I've a Problem with the Interrupts of the Arduino Due. I try to establish a EFI for my old Motorcycle.

but the Interrupts act a bit weak and i don't know why.

At the Intterupt functions i write a digitalpin to High, after a few Microseconds i want to write it LOW. but it seems the Due sometimes Forgot to Write the Pins. The Interrupt occurs on the falling edge.

Here is the Important part of my Code:

Code: [Select]


attachInterrupt(digitalPinToInterrupt(Pin_KW_Sensor), Kurbeltrieb_Ign, RISING); //occurs when engine is at Max spark advance Point
attachInterrupt(digitalPinToInterrupt(Pin_KW2_Sensor), Kurbeltrieb_OT, FALLING); //occurs when engine is at dead top center

void loop() {
currentLoopTime = micros(); // Write the Time : unsigned Int
Planer.execute();

if (currentLoopTime >= Injectiontime && Injector_Status == 1) { //Injection Finished
digitalWrite(Pin_Injector, LOW);
Injector_Status = 0;
}

if (currentLoopTime >= Ignitiontime && Ignition_Status == 1) { //Ignition Finished
digitalWrite(Pin_Ignition, LOW);
Ignition_Status = 0;
}


Compute_Betriebspunkt(); //do some Bilinear Interpolation of VE and AFR

}



void Kurbeltrieb_Ign() { //Interrupt 1 Engine is at maximum spark advantage Point
Ignition_Status = 1;
digitalWrite(Pin_Ignition, HIGH);

Timestamp_Ign = micros();
Ignitiontime = Timestamp_Ign + t_ignition(Alpha_Ign, Drehzahl); // Calc Time to Ign.

if (Benzinpumpe_Status == 0) { //Benzinpumpe einschalten
digitalWrite(Pin_Benzinpumpe, HIGH);
Benzinpumpe_Status = 1;
}
Setback = 0; // for further calc
}


void Kurbeltrieb_OT() { //Interrupt 2 Engine is at Dead Top Center
Injector_Status = 1;
digitalWrite(Pin_Injector, HIGH);

Last_Timestamp_Inj = Timestamp_Inj;
Timestamp_Inj = micros();
Delta_Timestamp_Inj = Timestamp_Inj - Last_Timestamp_Inj;
Injectiontime = Timestamp_Inj + t_inject(Drossel_Klappe, Drehzahl); // Calc Injector Open time

Drehzahl = 60000000.0000 / Delta_Timestamp_Inj; // calc Engine Speed

}



I tryed to figure the problem with my Oscilloscope. The Bottom, blue Line is the Interrupt Input signal and act stable.

the Upper Yellow line is "Pin_Injector" , it twiches around roughly more or less 2 seconds.. once the Due forgot to turn the Pin on, another time it forgot to turn it Off..

greetings from Germany
and thank you in advance!

ard_newbie

#1
Dec 01, 2017, 10:49 am Last Edit: Dec 01, 2017, 11:00 am by ard_newbie
Do you have pull down résistors on each interrupt pin ?

what is the frequency interrupt functions should be called ?


BTW, post all your code, very often the issue is somewhere inside the non posted part of code...

Go Up