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.

TMS320F28075: Local variable corrupted in an ISR

Part Number: TMS320F28075


Dear Champs,

I am asking this for a customer.

If the user declare a local variable in an ISR, is it possible the variable is corrected after many ISR running  for some time?

in case

1) All the ISR are running without nested ISR

2) All the ISR are running with nested ISR, where the ISR can be interrupted by other ISR

Is it better that he uses a static variable in the ISR or a global variable outside the ISR rather than a local variable in the ISR in this case?

What’s your suggestion?

Wayne

  • Using static would be a matter of wanting to maintain the value of a variable across consecutive runs of the ISR where if it were local it would be reinitialized every time. As long as there's adequate stack allocated, there shouldn't be any issue with making it a local variable.

    If it's being corrupted by a bad pointer or a stack overflow, you're going to have bigger problems than just a single local variable. Is the customer actually seeing an issue of corruption they need help debugging or was this just a theoretical question?

    Whitney

  • Dear Whitney,

    Thank you for your information.

    We are debugging an issue and thought this might be related.

    Wayne