Some interrupts are lost while using several attachinterrupt function

I am using Arduino DUE for controlling two stepper motors. For position reading of each motor I am using optical encoders(1000 CPR) with two pins (pin A and B) which are connected to digital pins and I am reading them via interrupts.
When I am driving only one stepper motor or driving both of them but with the same velocity the encoders give me correct position and everything works excellent.But when I am driving 2 motors simultaneously with different speeds, some offset errors are being appeared in encoder positions (5 degrees offset during the 5 fully revisions). It seems like that conflict appears between the interrupts and some of them are being lost. Could you help me please to find out the solution.

Hi.
I am using Arduino DUE for controlling two stepper motors. For position reading of each motor I am using optical encoders(1000 CPR) with two pins (pin A and B) which are connected to digital pins and I am reading them via interrupts.
When I am driving only one stepper motor or driving both of them but with the same velocity the encoders give me correct position and everything works excellent.But when I am driving 2 motors simultaneously with different speeds, some offset errors are being appeared in encoder positions (5 degrees offset during the 5 fully revisions). It seems like that conflict appears between the interrupts and some of them are being lost. Could you help me please to find out the solution.

Could you help me please to find out the solution.

Without being able to see any part of the project or any of the code? How exactly would I help you find the problem if you hide the whole thing from me?

It would be very hard to figure out what you’ve done wrong without being able to see your code and your setup. You’ve obviously made a mistake somewhere but it’s impossible to see from here. Post your code and your wiring diagram and maybe someone can help.

@Shaljdav, stop cross-posting.

Please read and follow the instructions in the "How to use this forum" post.

With quadrature encoders, CPR and RPM are essential data.

My first lesson in interrupts: once triggered, first action is disable all interrupts. Last action is reset them again.

If not done, the interrupts might interrupt themselves (or paralel ones) or get qued up. Both cases are not good.

Did you consider migrating the interrupting part to two indepent measuring ATTinies? This seemed to work for me (not 100% sure) in monitoring 3 streams of pulses.

BikerMark:
If not done, the interrupts might interrupt themselves.

That's not how interrupts work on an ARM uc. A specific interruption won't interrupt itself but will be queud. A new interruption is executed if no interruption with a higher priority is running or no other interruption with a higher priority than the new interruption is pending.

Post your code!

I have not seen your code but it appears you have some blocking code, I deduce this from the problem appears when the second motor is added with a different speed. As for the interrupts I use them to set flags and process in the main loop, hence the blocking of additional interrupts is minimized. This keeps my interrupt time to a minimum.
Good Luck & Have Fun!
Gil