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.

Debugging Illegal Operation

Other Parts Discussed in Thread: TMS320F28335, SYSBIOS

I have an issue where I'm getting an illergal operation (interrupt #19).  The problem appear to be related to my capture port interrupts.  What's strange is that as long as I'm getting interrupts I have no issue, its when I stop getting interrupts that I get the illegal operation. 


By looking at the ROV I can see that my HWI stack is overflowing.  I tried increasing the size of the HWI stack from 4000 to 6000 but this did not help.  Under normal operation the hwiStackPeak does not seem to get much above 300.

I found one issue that may be related.  On my ISR for the capture ports I noticed that I ws getting interupt flasgs set even though I did not have those interupts enabled.  This would cause the interrupt to fire continually.  I addressed this by clearing all the int flags.  This seems to have address this issue but now I'm getting the illegal operations.

Can someone give me some pointers to tracking down the source of the illegal operation?

Ed

System Info:

TMS320F28335

Sys/Bios 6.35.1.29

  • Hi Ed,

    Can you please copy and paste the exact error message output you are seeing?  Or maybe paste a screen shot?

    In ROV, can you run the "scan for errors" option that's under the BIOS module?

    Steve

  • Steve,

    I have attached a screen capture of the console window and 2 ROV windows.

    Thanks

    Ed

     

     

  • I've managed to find the trigger for the fault but it doesn't make a lot of sense.

    In one of my Swi's I have a local variable that I use to do various calculation.  If I don't change this variable the system doesn't crash.  Its got to be affecting something else but I have been unable to detemine what. 

     

    It looks to me like something is caused a bunch of interupts to occur that overflows the Hwi stack.  Is there a way I can examine the Hwi stack to see what calls it has?

    Ed

     

  • Hi Ed,

    Have you read through this and this? I'm not sure if they are totally relevant or not, but it may give you some ideas. Hopefully someone else has seen a similar problem and can help out soon.

    Cheers,

    DJ

  • DJ,

    Thanks for the info.  There is lots of good information here. 

    I did manage to get one more clue as to the source of the issue.  I set a Hardware watch point near the end of the stack and managed to stop the processor before the stack overflows. When I do this and use the ROV to "scan for errors" I now have none.  Also the watchpoint always seems to stop at the same location which appears to be in the memcpy routine.

    The memcpy make sense as the source of the issue except that I don't use memcpy in this section of code although I do use it else where.

    Looking at the disassembly at this location I think I see the issue.

    The first three lines if I read this right are copying a large amount of data to the stack.  The current AR6 value is 0x4DD0 (19924).  XAR7 is pointing to the location in the hardware stack where I set the breakpoint.  XAR5 is also pointing to RAM but I'm not sure exactly what.  It look like its in here but I'm but sure what that means:

    _ti_sysbios_knl_Task_Instance_State_2_stack__A.  I assume this is one of my task stacks but hiow can I tell which one?

    Anyone else see some other clues here that I have misssed?

    Ed

     

     

  • I managed to find the source of the Hwi stack overflow, but it also seems to be a symptom of the root cause.  It was a large memcpy() that causing the stack overflow.  The thing is that the memcpy should never be this large.  I'm using it to copy a structure.  I'm using sizeof() to get the size of the structure so this should never change. 

    I added a size check before I do the memcpy() and this has stopped the stack overflow but I'm still getting the illegal operation.  Only now I have less failure when I "scan for Errors".  (See below)

    If this is now a stack overflow, what else can cause the Illegal operation?

    Ed

  • I found the problem.  I was overwritiing a local buffer which was screwing up the task stack.  This one had me chasing all over the place.  I guess this is a good reminder to be careful when using pointers.

     

    Thanks to DJ and Steven for the help.

    Ed