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.

TMS320F28377D: The overflow of array in my program

Part Number: TMS320F28377D


Hi!

As show in the below picture, In my sicarx interrupt sevice function, I use the for loop to assign value to the rdataA[] array. because i used the interrput nest, so this function will be interrupted by other interrupt service function. In the case  the array size may overflow to 254,but the max value is 16.  the rdataA[] array was defined as a global variable. 

Why this array will overflow,how to avoid this case? 

thank you!

  • Hello,
    I am writing to let you know that a C2000 team member has been assigned to this post and should be answering shortly.

    Regards
    Baskaran
  • I am not sure exactly what you are asking... If the program continues to write to the array and increasing the index, it is possible you will overflow the buffer and corrupt other data or code. You need a way to know when to reset the index to the array, or ensure that index does not surpass what you have allocated.

    sal
  • Hi,sal
    Thank you for your answer.
    Yes, If the program continues to write to the array and increasing the index,the array will overflow.
    But the index are increased only in this function.So i don't know why the index will be increased to overflow the array. Infact the index's max value is 16. But sometimes the index will be increased to 254.
    Beacause the array was writed in the sci interrupt service funcition , this service function will be interrupt by other interrupt service function. I don't know if there has anything to do with this case. The rdataA[] array was defined as a global variable, before i write to this array i will reset the array index to 0.
    regards
    shook
  • In my opinion it seems like the issue is that your max index is changing. The max index is rdataA[11] but then inside the loop you are writing to rdataA[11] when you write to the array.

    sal