This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Random values applied to variables - dsp LF2407A

Hi folks !

I'm using a dsp LF2407A to implement vector control of an induction machine. In this application, I have a variable called "mag" to flag that my motor is magnetized. Once this variable gets the value 1, there's no code implemented to change it, i.e., it should be 1 forever. But, randomly, the DSP is changing the value of this variable and messing up my control, leading to damage my motor. When I disconnect my motor and just leave the code running, after some minutes, the dsp applies the value 1 to this variable and everything works correctly.  To figure out the problem, I measured by an oscilloscope the time spent inside the interruption functions and I saw that it's higher than maximum possible time when the misfunction occurs and the variables get random values. Then I commented some pieces of code inside those interruptions and when I measured the time again, I saw that the summation of the time spent to run each piece individually is permissible for my application, but when I get all the pieces together, there's overtime and my variables get wrong and random values. 

I would be pleasured if someone could help me out ...

Thanks and best regards !

Leonardo