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.

TMS320F28388D: Assigning ISR Stack to the main stack and restore it later.

Part Number: TMS320F28388D

Tool/software:

Hello Experts,

This is a related question to TMS320F28388D: Stack memory utilization by FreeRTOS tasks - C2000 microcontrollers forum - C2000Tm︎ microcontrollers - TI E2E support forums.

We are facing same issue, i.e., the firmware is getting reset frequently because we integrated control code generated from Simulink, for inverter. The inverter related functions are getting called from an ISR. 

It is recommended to get these called from ISR instead of a FreeRTOS task, to avoid any latency during context switching.

The thread highlighted above is a year-old thread. Did you sort out the way to reassign the stack of ISR to the main stack and back to ISR stack, once the call is complete?

Thank you.

- Rohit

  • Please let me know if someone is working on this issue.

  • Hi Rohit, 

    Attached is a zip file containing an example FreeRTOS project implementing the same.

    freertos_ex1_c28x_led_blinky.zip

    Please note that commonISR needs 40 bytes of task stack before switching to isrStack. In case of interrupt nesting, only the first interrupt uses the 40 bytes of task stack, the nested interrupts uses the isrStack only. Hence a min of 40 bytes buffer should be included in every task stack.

    Regards,

    Arnav

  • Thanks Arnav. I will try this example and get back to you with result.

  • Hi Arvan,

    I have a few questions about this example:

    • In the commonISR file, the interrupt is disabled to exit the stack space reserved for the ISRs. Where is the interrupt re-enabled after that?

    • If interrupt nesting isn't enabled, I believe you don't need to disable interrupts or check the intNesting variable. Is that correct?

    • Why can't the RTOS tick timer ISR execute on a separate stack (portTICK_ISR)? Is it that different from the portYIELD_FROM_ISR function?

    • And lastly, can I use the interrupt stack to execute the tick hook of FreeRTOS, which is called inside the portTICK_ISR?

    Best Regards, Ramon.