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.

CCS / CC3220SF-LAUNCHXL:CC3220SF-LAUNCHXL

Part Number: CC3220SF-LAUNCHXL
Other Parts Discussed in Thread: CC3220SF, UNIFLASH

Tool/software: Code Composer Studio

Hello I hope you can help me with the following problem.
I use the cc3220SF
I also use freeRTOS
software versions.
UniFlash: 5.2.0
Code Composer Studio 9.3.0
PROBLEM: I'm using the out of th box example, I create a separate task using xtaskcreate() and when I add the task and the .c file the out of the box example doesn't run because the red LED on my launch pad doesn't blink and I can't do the provisioning.
Commenting the task, resolves the issue.

  • Hey Carlos,

    When you create your new task, are you setting its priority higher than that of the provisioning task (priority =1)?

    If so, try giving it a priority lower than, or equal to, the provisioning tasks priority.

    Regards,

    Paul

  • Thanks for the help.
    set the priority to 2 but still have the same problem.

    code example.

    main_freertos


    extern void * mainThread(void *arg0);
    extern void *doorToggle(void *arg0);
    /* Stack size in bytes */
    #define THREADSTACKSIZE 4096

    /*
    * ======== main ========
    */
    int main(void)
    {
    pthread_t thread;
    pthread_attr_t pAttrs;
    struct sched_param priParam;
    int retc;
    int detachState;

    /* Call board init functions */
    Board_init();
    xTaskCreate(doorToggle,"Door Toggle",1000,NULL,2,NULL);
    /* Set priority and stack size attributes */
    pthread_attr_init(&pAttrs);
    priParam.sched_priority = 1;

    detachState = PTHREAD_CREATE_DETACHED;
    retc = pthread_attr_setdetachstate(&pAttrs, detachState);
    if(retc != 0)
    {
    /* pthread_attr_setdetachstate() failed */
    while(1)
    {

    door.c

    }

    /*
    * ======== mainThread ========
    */
    void *doorToggle(void *arg0)
    {
    temporizadorPuertas[0]=10;
    tiempos[0]=10;
    pinesRelay[0]=10;
    pinesRelay[1]=11;
    pinesRelay[2]=12;
    puertaenPrueba[0]=1;
    erroresMaximos[0]=10;
    // GPIO_setConfig(10,GPIO_CFG_OUT_STD | GPIO_CFG_OUT_LOW);
    GPIO_write(10,(1));
    while (1) {

  • Hey Carlos,

    When scheduling threads a higher integer value means higher priority. So in the example you provided, you are giving doorToggle (priority=2) a higher priority than mainThread (priority=1). This means that from the thread schedulers perspective, if doorToggle is runnable it will always be prioritized over running mainThread.

    Based on the code you provided, it looks like doorToggle runs without yielding. This means that once doorToggle  has started running it does not stop unless a task with a higher priority preempts it. And because doorToggle has a higher priority than mainThread, mainThread never gets scheduled and thus never runs.

    A quick way to fix this is to add

    usleep(1000);

    to the bottom of doorToggles while loop. This will force it to sleep/yield for 1ms every loop, allowing other tasks to be scheduled.

    Regards,

    Paul