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.

SimpleLink Driver update from 2.10 to 2.20 hangs on sl_Start

Guru 39650 points

Part Number: CC3220
Other Parts Discussed in Thread: SYSBIOS, CC3200

Hi Team,

I decided finally move my project to latest SDK and driver (2.20.00.10) from previous version 2.10.00.04. Unfortunately I have a issue and I need yours help.

My code works properly with previous driver version. But after update to latest version of driver its hangs at first call of the sl_Start() API. It is at line 185 in file device.c and its waits for async. event forever:

VERIFY_RET_OK(_SlDrvWaitForInternalAsyncEvent(ObjIdx, INIT_COMPLETE_TIMEOUT, SL_OPCODE_DEVICE_INITCOMPLETE));

My sl_Task is spawned and task is "running" at while cycle at line 107 in spwan.c.

/* here we ready to execute entries */
while (TRUE)
{
  /* wait for event */
  _SlInternalSpawnWaitForEvent();
}

Few observations/points:

  • issue is not related to ServicePack version (I tested my code with 3.7.0.1 and 3.8.0.3 with same result; with same SP versions network_terminal demo from 2.20 works properly)
  • in case of calling sl_Start() from main before is scheduler called, sl_Start() is executed and returned properly. In this moment is only hardware initialised. SimpleLink and other tasks are not spawned.
  • I use TI-RTOS and CCS 7.4 (I did not expect issue with CCS version)
  • Issue is not related to macro SL_PLATFORM_MULTI_THREADED

Update1: OK, now I understand why sl_Start() works without sl_Task, but still not understand what is going on when task is running

Update2: It seems interrupt is fired, _SlInternalSpawn is called from handler and its signalised by SL_DRV_SYNC_OBJ_SIGNAL(&g_SlInternalSpawnCB.SyncObj); but still it does not work. How should to works new spawn.c is really mysterious for me.

I am still not familiar with changes in latest driver which are pretty complex and I am not sure why I have issue with serving of async. event. I will be glad for any tip or the advice.

Thanks

Jan

  • Hi,

    Issue resolved. It was required to brings big shovel and dig deeper into SimpleLink driver and sysbios kernel. Issue was in the OSI layer implementation of task creating. During study of new SimpleLink driver I found few suspicious things in implementation of synchronization, which I want to investigate later. If I found any issue I will report.

    Solution of issue was pretty simple. It is mandatory to change implementation of osi_TaskCreate() from old code which comes from CC3200 SDK to POSIX.

    OsiReturnVal_e osi_TaskCreate(P_OSI_TASK_ENTRY pEntry, const signed char * const pcName, unsigned short usStackDepth,
                       void *pvParameters, unsigned long uxPriority, OsiTaskHandle *pTaskHandle)
    {
      int32_t RetVal;
      pthread_attr_t pAttrs_spawn;
      struct sched_param priParam;
      pthread_t spawnThread;
    
      pthread_attr_init(&pAttrs_spawn);
      priParam.sched_priority = uxPriority;
      RetVal = pthread_attr_setschedparam(&pAttrs_spawn, &priParam);
      RetVal |= pthread_attr_setstacksize(&pAttrs_spawn, usStackDepth);
    
      RetVal = pthread_create(&spawnThread, &pAttrs_spawn, (void *(*)(void *))pEntry, NULL);
      if(RetVal < 0)
      {
        return OSI_FAILURE;
      }
    
      return OSI_OK_P;
    }

    Jan

  • Hey Jan,

    Thanks so much for sharing this.

    BR,
    Seong