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.

CC3220: POSIX and TI-RTOS : Calling Task_SetPri()

Part Number: CC3220

Hi,

I've been having stability problems porting my application from GEN1 (stable with TI-RTOS)  to GEN2 with POSIX.  (ROV reports no errors but it still occasionally crashes).

I have modified the 'httpget' project (TI-RTOS derivative). In the project I use the TI-RTOS static configurator for task, semaphore and clock function creation.

In the function 'SimplLinkNetAppEventHandler' (in platform.c) once the system has acquired a network address I have replaced the POSIX created httpTask  with a Task_SetPri(MyTask,MyPri) call to change MyTask from inactive (-1) to Active (2)  and let it run. 'MyTask' is one of the tasks I created using the static configurator.

Now I noticed in the following WIKI that a Task_SetPri() call from a pthread is not allowed:

processors.wiki.ti.com/.../BIOS_POSIX_Thread_(pthread)_Support

"SYS/BIOS supports both pthread and pthread_attrs APIs for POSIX threads.

Since each SYS/BIOS pthread has an underlying Task object, some of the SYS/BIOS Task APIs can be called from a pthread. These include Task_sleep(), Task_yield(), Task_self(), and Task_getPri(). Some Task APIs, such as Task_setPri(), should never be called from a pthread."

Am I still OK however to call Task_SetPri() from the function 'SimpleLinkNetAppEventHandler' ? If not then how would I make my inactive task become active. If I can then my problem must lie elsewhere and I need to dig a bit deeper.

thks & rgds,

Stuart

  • Hi Stuart,

    The C3220 host driver uses posix objects and threads, and using SYS/BIOS (TIRTOS) native objects and calls have been observed to cause problems:
    e2e.ti.com/.../721060
    I suggest you try using the pthread_attr_setschedparam() posix call to set your task priority.

    Let me know if that doesn't fix your issue or if you have further questions.

    Regards,
    Michael
  • Hi Michael,

    Many thanks for the prompt reply.
    So currently all my tasks etc were written using the static configurator (and so TI-RTOS) and were set to inactive (-1) until a successful net address was acquired at which point I set the main task (say 'MyTask') to active. Does your suggestion mean I must convert all 5 tasks I created with the configurator to dynamic ones with pthreads ?
    ....or can I use pthread_attr_setschedparam(MyTaskHandle,MyPri) to set 'MyTask' (created with the configurator) priority to MyPri directly. I tried and although it compiles, using ROV it did not set 'MyTask' to MyPri (2), its still inactive (-1).

    regards,

    Stuart
  • HI Stuart,

    Please try using dynamic thread spawning with the pthread_create() API. Our SDKs use pthread_create() to dynamically create needed threads for our demos and examples, while static tasks are not used at all to my knowledge.

    Regards,
    Michael
  • Hi Michael,

    Thanks for your message.

    Yeah, I had a feeling things were going this way. For stability either use POSIX or native TI-RTOS but don't mix them.

    Before I most  reluctantly (as I've invested a significant time learning and using TI-RTOS and which I really like) bite the bullet  can you please consider the following:

    My needs are very simple: basically to provision and acquire a network address. From there I can take it. Is there not one native TI-RTOS example I can modify to facilitate my need ?

    regards,

    Stuart

  • Hi Stuart,

    There is no native TIRTOS example that you can use. Our examples are all written to use POSIX calls so that they can be used with not just TIRTOS but other RTOSes as desired.

    Regards,
    Michael
  • Hi Michael,

    Well hopefully over time the POSIX strategy will result in more silicon sales and lessen the support burden for TI.

    Many thanks for the prompt support to date !

    We can close this one out.

    regards,

    Stuart