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.

Stack overflow

Other Parts Discussed in Thread: TMS320C5515

Hi ALL,

      I am using TMS320c5515 EVM REVB board and using .TCF file to configure the UART INTERRUPT i.e HWI_INT6. Hardware dispatcher is enabled and interrupt masks are none.The uart_isr is called within a task. When the code is run, the processor halts at  HWI_dispatcher after executing the ISR for the first time. But again when I click on the run button the control goes further. Can anybody please guide me with, what the problem would be?

    And when auto-flow control is enabled during UART_initialization the ISR is executed only once and when autoflow control is disabled the ISR is executed based on the number of bytes we transfer.

     Also stack overflow has occurred ( monitored using ROV -> KNL) at the second time when the control comes to ISR. Can anybody please tell me how to overcome the stack overflow in TMS320c5515 EVM?

    The bios version I am using is 5_41_13_42.

Regards,

Taranum

  • Taranum,

    If the stack that is overflowing is the ISR stack then this needs to be increased.  This can be done in your .tcf file.  Do you know which stack is overflowing and what your current current stack size is?

    Something like the following:  MEM.STACKSIZE = 1024;

    As far as the ISR.  I don't quite understand what the problem is?  When you say "uart_isr is called within a task", do you mean the isr happens while your task is executing?  When an ISR happens, if you've created it with a HWI, it will go through the HWI_dispatcher.  The dispatcher is the function that will evenutally call your ISR so it doesn't make sense to me that you say "When the code is run, the processor halts at  HWI_dispatcher after executing the ISR for the first time".  Did the ISR get executed before the HWI_dispatcher?

    Judah

  • Hi Judah,

           It is the system stack which is overflowing. The current stack size is 1024. 

    Regarding the ISR, yes the ISR happens when the task is executing. And about this sentence  "When the code is run, the processor halts at  HWI_dispatcher after executing the ISR for the first time" what I meant was, the exiting from ISR is also handled by the dispatcher. So when the ISR is executed once the control stops at some point in the HWI_dispatcher as in the attached document and further when explicitly run the ISR will be executed again. And then further at some point it says symbol not available and gives the error as shown below,

     Can't Run Target CPU:
    Error 0x00000020/-1141
    Error during: Execution,
    Processor communication timeout.
    It is recommended to RESET EMULATOR. This will disconnect each target,  
    perform an emulation reset, and then reconnect each target.
    Power cycle the target board before continuing.

    Can you please help me out with this?

    Regards,

    Taranum

    Dispatch error.docx
  • Hi Judah,

          The stack overflow problem I have resolved by the increasing its size, with that the disconnect issue is resolved. Now the  only problem where i have got stuck is, the execution stops at HWI_dispatcher, the same point as attached in the document earlier. For the control to go further we will have to explicitly click the run option. Please help me out with it.

    Regards,

    Taranum

  • Taranum,

    I don't know why it would halt in the HWI_dispatcher.  This should not happen if there is valid code which it looks valid to me from your screen shot.  They only time I see a CPU stop executing is if code got corrupted and it doesn't understand what it thinks is an instruction.  This looks to be the case in the last screen shot of your document but not for the HWI_dispatcher function.  Could you just double check to make sure that HWI_dispatcher did not get corrupted by puttting that address in a memory window after you have loaded the code and make sure it never changes.

    Maybe there's an emulator problem here?  Is there an option to "run free", could you try that out if there is an option?

    Judah

  • Hi Judah,

              I checked by putting the value in the memory window, the value is getting changed at 0x04928 as attached in the document. And now I am again facing the system stack overflow problem as earlier, though I have increased the stack size to 2048. I again tried increasing the stack size and checked but again stack overflow is still occurring. And free run is working, i.e the execution is not halting at HWI_dispatcher. So how do I solve this problem?

    Regards,

    Taranum

           

    Dispatch error1.docx
  • Taranum,

    Is this a flat memory system or does it have separate code and data space?  Looks to me like it has separate code and data space so the same address for code and data is really different physical memories...not the same physical memory.  That is perfectly fine if that is the case.  Tell me if that is not the case.

    For the stack overflow, it looks to me like something is writing to the top of the stack...Its not a true stack overflow but it is a problem because nobody should be writing to the top of the stack.  Can you put a probe point at that address to see who is writing to the top of the stack.  Is address 0x4160.

    Judah

  • Hi Judah,

          Sorry I did not work on that code in the past days, so could not reply back to your post.

    Yes it has separate code space and data space. System stack size I had to still further more increase to 3000(MADUs) and also there was a problem in configuring the power management register for UART. Also the clock had to be configured for the RF module. When done all this the code worked fine. It is not halting at Dispatcher now. Thank you for your guidance. Can you please provide me any link or pdf where I can understand stack related things more in depth?

    Regards,

    Taranum