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.

CC3220MODA: Issue to run blocking task on pin interrupt

Part Number: CC3220MODA

Hello Ti team

I am working on CC3220MODA chip and portableNative example project.

My application design is to put the system in sleep mode and only wake up on gpio interrupt and do some blocking execution and go back to sleep mode.

Following things I tried:

1. System waking up on GPIO interrupt but after wake up if I run some blocking operation (playing audio file or SPI operation) from ISR callback then it is not working (I am agree with this results).

2. After receiving GPIO callback it should wake up "consoleThread" thread so that I can run the blocking operation from this thread instead of callback function but "consoleThread" is not wake up to execute blocking operation.

Following is my questions:

- How I can create the run time thread from callback function?

- After executing the blocking operation from run time created thread how I can kill it?

Any help will be appreciated.

Thanks

Raj

  • There are different methods to synchronize between interrupt and thread contexts.

    You can use one thread that will wait for semaphore / mutex or a message queue - check the SDK for examples. Such thread can be created once at boot time with code that looks like the following:

    while(1) {
    
       - Wait on Mutex/Sem/MQ ;
    
       - Do something
    
    }
    
    

    If you want to create a thread and exit from it  - it can be done but it is less efficient.

    When you create the thread use the "detached" flag (see below and look for this in the SDK examples), so the the thread resources will get freed when it calls pthread_exit().

    int detachState = PTHREAD_CREATE_DETACHED;
    retc = pthread_attr_setdetachstate(&pAttrs, detachState);

    Make sure the blocking call doesn't cause the device to go to LPDS (in LPDS only one GPIO can be set as wakeup source).

      

    Br,

    Kobi