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.

RTOS/MSP432P401R: Using SWI and POSIX together to create an application from examples

Part Number: MSP432P401R

Tool/software: TI-RTOS

Hello Community,

I am trying to get bluetooth notifications on my phone through the Simplelink SDK Explorer. I am following the "simple_application_processor" example (I will list the URL at the bottom of the page).  Inside the example there is a snippet of code that allows notifications to the bluetooth application. I want to modify the code to allow strings to be passed instead of just an increasing number. 

The dillemma that I'm having is that the code example uses POSIX pthread's to do everything. The program that I want to write will use SWI's, Task's and Semaphore's. Is it possible to write from a SWI to a global variable in the main_tirtos.c thread into the simple_application_processor.c thread and update char4 with a corresponding status.

Thank you,

Craig Edwards

static void *AP_notifyTask(void *arg0)
{
    sem_init(&notifySem, 1, 0);

    while(1)
    {
        sem_wait(&notifySem);

        /* Set parameter value of char4. If notifications or indications have
           been enabled, the profile will send them. */
        SimpleProfile_SetParameter(SP_CHAR4_ID, sizeof(char4), &char4);

        /* Increment the value of characteristic 4 every 5 seconds. This way
           notification can be more clearly seen on client */
        char4++;
    }
}



  • Hello Craig,

    The AP_notifyTask is a task created using the POSIX thread/task creation API (pthread_create). As you can see in the body of the task (that you have pasted), the task waits on a Semaphore (notifySem) that is posted by "AP_timerHandler" which is called by the Timer Interrupt.

    So all you are asking for is already being done, except you will have to use a SWI instead of a Timer triggering an Interrupt that posts a Semaphore.

    Let me know if I got your question wrong.

    Thanks,
    Sai

**Attention** This is a public forum