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.

Sempahore signaling inside a UART Interrupt

Other Parts Discussed in Thread: CC3200

I am having some issues with the TI RTOS in the CC3200 program that we are making...

Background:
- We are using the TI Environment (CC Studio) Version: 6.0.1.00040
- Using the TI Compiler version 5.1.9 in all the projects.
- Using the TI-RTOS support (not the Non-OS, and not the FreeRTOS).
- Started with the WLAN_Station demo software.

Project Goals:
- Take streaming serial port data via DMA and turn around and send it out thru WiFi to the connected PC.
- The WiFi is connected via sockets, and this part of the application works...

Program summary:
- Consists of two tasks created by Main.
- Controlled by two semaphores also created in the Main before the RTOS is started (before OSI_Start).
- Semaphores are globals.

Issue:
Program starts, and the sockets are connected. All is good. Then the Ethernet / Wifi task suspends waiting for data.
When I issue the Semaphore Signal from the Interrupt caused by the UART the system sets a "Stack error" and exits...
The call looks like below:
// Flag the Semaphore...
returnValue = osi_SyncObjSignalFromISR(&g_WaitForBuffer1Full);


Things tried:
If I call this function from inside a different task (test) task, that is not an interrupt, but a peer task, then we can go all day without issue.
This leads me to believe there is some magic about signaling a Semaphore in the interrupt from hardware (I think it is actually a software interrupt call back.).


So any help about what is wrong?

  • To verify what you suspect and since your issue is unlikely specific to the SimpleLink drivers, I'd recommend you raise this issue at the TI-RTOS forum, they will know what is going on - http://e2e.ti.com/support/embedded/bios/default.aspx

    Glenn.
  • Hi,

    Can you please post the error log from the CCS console when you hit the stack error?

    Also, Can you check from the ROV (Tools -> RTOS Object Viewer) the status of the task that is waiting on the Semaphore?

    Thanks & Regards,

    Prathyusha Teja.I

  • The FIFO was not enabled for the UART and the DMA was set to use the FIFO interface. As such, the Interrupts were not stop and this generated a stack fault..
  • Hi Craig,

    Is this issue resolved now ?

    Thanks and Regards,
    Praveen
  • Issue resolved.
    Thanks. - Craig
  • All,
    The issue I was having was using the osi_(fuctions) in the program. When I was using the osi_registerInterrupt for my callback function, the function would be called but when the osi_SempaphorePost was sent, then a stack fault occurred.

    The resolution was to go into the TI_RTOS_Config project and configure the interrupt as a HWI in the RTOS, and remove the OSI register statements. Once I did this, then all was well...

    I also generated the Semaphores in the TI_RTOS_Config for good measure, but this was not required.

    -Craig
  • Hi, Craig:
    I have the same issue and I am a new User for TI RTOS. Can you guide me how to configure the interrupt as a HWI in the RTOS?
    Thanks
    Josdsar
  • Josdar,

    I was using TI_RTOS.

    So do the following:

    1) Make sure your project has the #define for the TI_RTOS set.   See Project Properties ->   ARM Compoiler -> Predefined Symbols  Add "USE_TIRTOS"

    2) Go into the App.cfg file on the TI_RTOS_CONFIG project part of the project and enable the HWI.

    3)  Define your semaphores in the TI_RTOS_CONFIG as well, use the same names as your program, and let TI_RTOS define them.  You may need to keep a file with the extern statements to the Semaphores has scope.

    4)  In the task, program to enable the HWI, I used the following statement.

    // Enable my ISR from the RTOS Config -> myUARTISR is handle.
    callReturn = Hwi_enableInterrupt(INT_UARTA1);

    In my novice view, the Semaphore does not have scope in the HWI when it is called, or something like that, because you get a stack fault when invoked.   So you have to make sure you do everything the TI_RTOS way for this.   I could not get the osi_InterruptRegister commands to work so I did it this other way.

    Good luck.

    -Craig

    The problem I was seeing was because the software allows you to use no RTOS and RTOS, so sometimes you can mix commands.   Without