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/CC3220SF-LAUNCHXL: blocking thread with api-call sl_select

Part Number: CC3220SF-LAUNCHXL

Tool/software: TI-RTOS

Hi e2e Forum,

i opened this new related thread because the original one 

e2e.ti.com/.../749464

was closed.

The last status was, that the problem of concurring api calls was eliminated by using semaphores to handle these calls.

Due to your information that it is not advisable to use these solution i would like to give you the asked additional information.

I reproduced the error of the blocking thread with the api call and documented the related sync-object g_pcb.

Best regards

Jonas Knüpper

*(g_pCB)	struct <unnamed>	{FD=16850944,TempProtocolHeader={Opcode=37895,Len=12},pInitCallback=0x00000000,ObjPool=...	0x2000B400	
	FD	int	16850944	0x2000B400	
	TempProtocolHeader	struct <unnamed>	{Opcode=37895,Len=12}	0x2000B404	
	pInitCallback	void (*)(unsigned long,<unnamed>*)	0x00000000	0x2000B408	
	ObjPool	struct _SlPoolObj_t[18]	[{SyncObj={sysbios={__f0=0x00000000,__f1=1,__f2=Opaque_Mode_1,__f3=0,__f4={__f0=......,freertos=...,pRespArgs=...,...	0x2000B40C	
		[0]	struct _SlPoolObj_t	{SyncObj={sysbios={__f0=0x00000000,__f1=1,__f2=Opaque_Mode_1,__f3=0,__f4={__f0={next=...,__f1=......,freertos=...,pRespArgs=...	0x2000B40C	
			SyncObj	union <unnamed>	{sysbios={__f0=0x00000000,__f1=1,__f2=Opaque_Mode_1,__f3=0,__f4={__f0={next=0x20008B3C ...,prev=...,__f1=......,freertos=...	0x2000B40C	
			pRespArgs	unsigned char *	0x00000000 {0 '\x00'}	0x2000B428	
			ActionID	unsigned char	27 '\x1b'	0x2000B42C	
			AdditionalData	unsigned char	15 '\x0f'	0x2000B42D	
			NextIndex	unsigned char	18 '\x12'	0x2000B42E	
		[1]	struct _SlPoolObj_t	{SyncObj={sysbios={__f0=0x00000000,__f1=1,__f2=Opaque_Mode_1,__f3=0,__f4={__f0={next=...,__f1=......,freertos=...,pRespArgs=...	0x2000B430	
			SyncObj	union <unnamed>	{sysbios={__f0=0x00000000,__f1=1,__f2=Opaque_Mode_1,__f3=0,__f4={__f0={next=0x2000B43C ...,prev=...,__f1=......,freertos=...	0x2000B430	
			pRespArgs	unsigned char *	0x00000000 {0 '\x00'}	0x2000B44C	
			ActionID	unsigned char	0 '\x00'	0x2000B450	
			AdditionalData	unsigned char	16 '\x10'	0x2000B451	
			NextIndex	unsigned char	2 '\x02'	0x2000B452	
		[2]	struct _SlPoolObj_t	{SyncObj={sysbios={__f0=0x00000000,__f1=1,__f2=Opaque_Mode_1,__f3=0,__f4={__f0={next=...,__f1=......,freertos=...,pRespArgs=...	0x2000B454	
			SyncObj	union <unnamed>	{sysbios={__f0=0x00000000,__f1=1,__f2=Opaque_Mode_1,__f3=0,__f4={__f0={next=0x2000B460 ...,prev=...,__f1=......,freertos=...	0x2000B454	
			pRespArgs	unsigned char *	0x00000000 {0 '\x00'}	0x2000B470	
			ActionID	unsigned char	0 '\x00'	0x2000B474	
			AdditionalData	unsigned char	16 '\x10'	0x2000B475	
			NextIndex	unsigned char	3 '\x03'	0x2000B476	
		[3]	struct _SlPoolObj_t	{SyncObj={sysbios={__f0=0x00000000,__f1=1,__f2=Opaque_Mode_1,__f3=0,__f4={__f0={next=...,__f1=......,freertos=...,pRespArgs=...	0x2000B478	
			SyncObj	union <unnamed>	{sysbios={__f0=0x00000000,__f1=1,__f2=Opaque_Mode_1,__f3=0,__f4={__f0={next=0x2000B484 ...,prev=...,__f1=......,freertos=...	0x2000B478	
			pRespArgs	unsigned char *	0x00000000 {0 '\x00'}	0x2000B494	
			ActionID	unsigned char	0 '\x00'	0x2000B498	
			AdditionalData	unsigned char	16 '\x10'	0x2000B499	
			NextIndex	unsigned char	4 '\x04'	0x2000B49A	
		[4]	struct _SlPoolObj_t	{SyncObj={sysbios={__f0=0x00000000,__f1=1,__f2=Opaque_Mode_1,__f3=0,__f4={__f0={next=...,__f1=......,freertos=...,pRespArgs=...	0x2000B49C	
			SyncObj	union <unnamed>	{sysbios={__f0=0x00000000,__f1=1,__f2=Opaque_Mode_1,__f3=0,__f4={__f0={next=0x2000B4A8 ...,prev=...,__f1=......,freertos=...	0x2000B49C	
			pRespArgs	unsigned char *	0x00000000 {0 '\x00'}	0x2000B4B8	
			ActionID	unsigned char	0 '\x00'	0x2000B4BC	
			AdditionalData	unsigned char	16 '\x10'	0x2000B4BD	
			NextIndex	unsigned char	5 '\x05'	0x2000B4BE	
		[5]	struct _SlPoolObj_t	{SyncObj={sysbios={__f0=0x00000000,__f1=1,__f2=Opaque_Mode_1,__f3=0,__f4={__f0={next=...,__f1=......,freertos=...,pRespArgs=...	0x2000B4C0	
			SyncObj	union <unnamed>	{sysbios={__f0=0x00000000,__f1=1,__f2=Opaque_Mode_1,__f3=0,__f4={__f0={next=0x2000B4CC ...,prev=...,__f1=......,freertos=...	0x2000B4C0	
			pRespArgs	unsigned char *	0x00000000 {0 '\x00'}	0x2000B4DC	
			ActionID	unsigned char	0 '\x00'	0x2000B4E0	
			AdditionalData	unsigned char	16 '\x10'	0x2000B4E1	
			NextIndex	unsigned char	6 '\x06'	0x2000B4E2	
		[6]	struct _SlPoolObj_t	{SyncObj={sysbios={__f0=0x00000000,__f1=1,__f2=Opaque_Mode_1,__f3=0,__f4={__f0={next=...,__f1=......,freertos=...,pRespArgs=...	0x2000B4E4	
			SyncObj	union <unnamed>	{sysbios={__f0=0x00000000,__f1=1,__f2=Opaque_Mode_1,__f3=0,__f4={__f0={next=0x2000B4F0 ...,prev=...,__f1=......,freertos=...	0x2000B4E4	
			pRespArgs	unsigned char *	0x00000000 {0 '\x00'}	0x2000B500	
			ActionID	unsigned char	0 '\x00'	0x2000B504	
			AdditionalData	unsigned char	16 '\x10'	0x2000B505	
			NextIndex	unsigned char	7 '\x07'	0x2000B506	
		[7]	struct _SlPoolObj_t	{SyncObj={sysbios={__f0=0x00000000,__f1=1,__f2=Opaque_Mode_1,__f3=0,__f4={__f0={next=...,__f1=......,freertos=...,pRespArgs=...	0x2000B508	
			SyncObj	union <unnamed>	{sysbios={__f0=0x00000000,__f1=1,__f2=Opaque_Mode_1,__f3=0,__f4={__f0={next=0x2000B514 ...,prev=...,__f1=......,freertos=...	0x2000B508	
			pRespArgs	unsigned char *	0x00000000 {0 '\x00'}	0x2000B524	
			ActionID	unsigned char	0 '\x00'	0x2000B528	
			AdditionalData	unsigned char	16 '\x10'	0x2000B529	
			NextIndex	unsigned char	8 '\x08'	0x2000B52A	
		[8]	struct _SlPoolObj_t	{SyncObj={sysbios={__f0=0x00000000,__f1=1,__f2=Opaque_Mode_1,__f3=0,__f4={__f0={next=...,__f1=......,freertos=...,pRespArgs=...	0x2000B52C	
			SyncObj	union <unnamed>	{sysbios={__f0=0x00000000,__f1=1,__f2=Opaque_Mode_1,__f3=0,__f4={__f0={next=0x2000B538 ...,prev=...,__f1=......,freertos=...	0x2000B52C	
			pRespArgs	unsigned char *	0x00000000 {0 '\x00'}	0x2000B548	
			ActionID	unsigned char	0 '\x00'	0x2000B54C	
			AdditionalData	unsigned char	16 '\x10'	0x2000B54D	
			NextIndex	unsigned char	9 '\x09'	0x2000B54E	
		[9]	struct _SlPoolObj_t	{SyncObj={sysbios={__f0=0x00000000,__f1=1,__f2=Opaque_Mode_1,__f3=0,__f4={__f0={next=...,__f1=......,freertos=...,pRespArgs=...	0x2000B550	
			SyncObj	union <unnamed>	{sysbios={__f0=0x00000000,__f1=1,__f2=Opaque_Mode_1,__f3=0,__f4={__f0={next=0x2000B55C ...,prev=...,__f1=......,freertos=...	0x2000B550	
			pRespArgs	unsigned char *	0x00000000 {0 '\x00'}	0x2000B56C	
			ActionID	unsigned char	0 '\x00'	0x2000B570	
			AdditionalData	unsigned char	16 '\x10'	0x2000B571	
			NextIndex	unsigned char	10 '\x0a'	0x2000B572	
		[10]	struct _SlPoolObj_t	{SyncObj={sysbios={__f0=0x00000000,__f1=1,__f2=Opaque_Mode_1,__f3=0,__f4={__f0={next=...,__f1=......,freertos=...,pRespArgs=...	0x2000B574	
			SyncObj	union <unnamed>	{sysbios={__f0=0x00000000,__f1=1,__f2=Opaque_Mode_1,__f3=0,__f4={__f0={next=0x2000B580 ...,prev=...,__f1=......,freertos=...	0x2000B574	
			pRespArgs	unsigned char *	0x00000000 {0 '\x00'}	0x2000B590	
			ActionID	unsigned char	0 '\x00'	0x2000B594	
			AdditionalData	unsigned char	16 '\x10'	0x2000B595	
			NextIndex	unsigned char	11 '\x0b'	0x2000B596	
		[11]	struct _SlPoolObj_t	{SyncObj={sysbios={__f0=0x00000000,__f1=1,__f2=Opaque_Mode_1,__f3=0,__f4={__f0={next=...,__f1=......,freertos=...,pRespArgs=...	0x2000B598	
			SyncObj	union <unnamed>	{sysbios={__f0=0x00000000,__f1=1,__f2=Opaque_Mode_1,__f3=0,__f4={__f0={next=0x2000B5A4 ...,prev=...,__f1=......,freertos=...	0x2000B598	
			pRespArgs	unsigned char *	0x00000000 {0 '\x00'}	0x2000B5B4	
			ActionID	unsigned char	0 '\x00'	0x2000B5B8	
			AdditionalData	unsigned char	16 '\x10'	0x2000B5B9	
			NextIndex	unsigned char	12 '\x0c'	0x2000B5BA	
		[12]	struct _SlPoolObj_t	{SyncObj={sysbios={__f0=0x00000000,__f1=1,__f2=Opaque_Mode_1,__f3=0,__f4={__f0={next=...,__f1=......,freertos=...,pRespArgs=...	0x2000B5BC	
			SyncObj	union <unnamed>	{sysbios={__f0=0x00000000,__f1=1,__f2=Opaque_Mode_1,__f3=0,__f4={__f0={next=0x2000B5C8 ...,prev=...,__f1=......,freertos=...	0x2000B5BC	
			pRespArgs	unsigned char *	0x00000000 {0 '\x00'}	0x2000B5D8	
			ActionID	unsigned char	0 '\x00'	0x2000B5DC	
			AdditionalData	unsigned char	16 '\x10'	0x2000B5DD	
			NextIndex	unsigned char	13 '\x0d'	0x2000B5DE	
		[13]	struct _SlPoolObj_t	{SyncObj={sysbios={__f0=0x00000000,__f1=1,__f2=Opaque_Mode_1,__f3=0,__f4={__f0={next=...,__f1=......,freertos=...,pRespArgs=...	0x2000B5E0	
			SyncObj	union <unnamed>	{sysbios={__f0=0x00000000,__f1=1,__f2=Opaque_Mode_1,__f3=0,__f4={__f0={next=0x2000B5EC ...,prev=...,__f1=......,freertos=...	0x2000B5E0	
			pRespArgs	unsigned char *	0x00000000 {0 '\x00'}	0x2000B5FC	
			ActionID	unsigned char	0 '\x00'	0x2000B600	
			AdditionalData	unsigned char	16 '\x10'	0x2000B601	
			NextIndex	unsigned char	14 '\x0e'	0x2000B602	
		[14]	struct _SlPoolObj_t	{SyncObj={sysbios={__f0=0x00000000,__f1=1,__f2=Opaque_Mode_1,__f3=0,__f4={__f0={next=...,__f1=......,freertos=...,pRespArgs=...	0x2000B604	
			SyncObj	union <unnamed>	{sysbios={__f0=0x00000000,__f1=1,__f2=Opaque_Mode_1,__f3=0,__f4={__f0={next=0x2000B610 ...,prev=...,__f1=......,freertos=...	0x2000B604	
			pRespArgs	unsigned char *	0x00000000 {0 '\x00'}	0x2000B620	
			ActionID	unsigned char	0 '\x00'	0x2000B624	
			AdditionalData	unsigned char	16 '\x10'	0x2000B625	
			NextIndex	unsigned char	15 '\x0f'	0x2000B626	
		[15]	struct _SlPoolObj_t	{SyncObj={sysbios={__f0=0x00000000,__f1=1,__f2=Opaque_Mode_1,__f3=0,__f4={__f0={next=...,__f1=......,freertos=...,pRespArgs=...	0x2000B628	
			SyncObj	union <unnamed>	{sysbios={__f0=0x00000000,__f1=1,__f2=Opaque_Mode_1,__f3=0,__f4={__f0={next=0x2000B634 ...,prev=...,__f1=......,freertos=...	0x2000B628	
			pRespArgs	unsigned char *	0x00000000 {0 '\x00'}	0x2000B644	
			ActionID	unsigned char	0 '\x00'	0x2000B648	
			AdditionalData	unsigned char	16 '\x10'	0x2000B649	
			NextIndex	unsigned char	16 '\x10'	0x2000B64A	
		[16]	struct _SlPoolObj_t	{SyncObj={sysbios={__f0=0x00000000,__f1=1,__f2=Opaque_Mode_1,__f3=0,__f4={__f0={next=...,__f1=......,freertos=...,pRespArgs=...	0x2000B64C	
			SyncObj	union <unnamed>	{sysbios={__f0=0x00000000,__f1=1,__f2=Opaque_Mode_1,__f3=0,__f4={__f0={next=0x2000B658 ...,prev=...,__f1=......,freertos=...	0x2000B64C	
			pRespArgs	unsigned char *	0x00000000 {0 '\x00'}	0x2000B668	
			ActionID	unsigned char	0 '\x00'	0x2000B66C	
			AdditionalData	unsigned char	16 '\x10'	0x2000B66D	
			NextIndex	unsigned char	17 '\x11'	0x2000B66E	
		[17]	struct _SlPoolObj_t	{SyncObj={sysbios={__f0=0x00000000,__f1=1,__f2=Opaque_Mode_1,__f3=0,__f4={__f0={next=...,__f1=......,freertos=...,pRespArgs=...	0x2000B670	
			SyncObj	union <unnamed>	{sysbios={__f0=0x00000000,__f1=1,__f2=Opaque_Mode_1,__f3=0,__f4={__f0={next=0x2000B67C ...,prev=...,__f1=......,freertos=...	0x2000B670	
			pRespArgs	unsigned char *	0x00000000 {0 '\x00'}	0x2000B68C	
			ActionID	unsigned char	0 '\x00'	0x2000B690	
			AdditionalData	unsigned char	16 '\x10'	0x2000B691	
			NextIndex	unsigned char	18 '\x12'	0x2000B692	
	FreePoolIdx	unsigned char	1 '\x01'	0x2000B694	
	PendingPoolIdx	unsigned char	0 '\x00'	0x2000B695	
	ActivePoolIdx	unsigned char	18 '\x12'	0x2000B696	
	ActiveActionsBitmap	unsigned long	0	0x2000B698	
	ProtectionLockObj	union <unnamed>	{sysbios={owner=0x00000000,lockCnt=0,type=1,sem={__f0=0x00000000,__f1=1,__f2=Opaque_Mode_2,__f3=...,mpo=...,freertos=...	0x2000B69C	
	CmdSyncObj	union <unnamed>	{sysbios={__f0=0x00000000,__f1=1,__f2=Opaque_Mode_1,__f3=0,__f4={__f0={next=0x2000B6D4 ...,prev=...,__f1=......,freertos=...	0x2000B6C8	
	WaitForCmdResp	unsigned char	0 '\x00'	0x2000B6E4	
	FlowContCB	struct <unnamed>	{TxPoolCnt=40 '(',MinTxPayloadSize=1460,TxLockObj={sysbios={owner=0x00000000,lockCnt=...,freertos=...,TxSyncObj=...	0x2000B6E8	
	TxSeqNum	unsigned char	2 '\x02'	0x2000B734	
	RxDoneCnt	unsigned char	2 '\x02'	0x2000B735	
	SocketNonBlocking	unsigned short	49	0x2000B736	
	SocketTXFailure	unsigned short	65515	0x2000B738	
	FunctionParams	struct <unnamed>	{pCmdCtrl=0x010122AE {Opcode=37895,TxDescLen=12 '\x0c',RxDescLen=4 '\x04'},pTxRxDescBuff=...	0x2000B73C	
	ActionIndex	unsigned char	0 '\x00'	0x2000B754	
	ApiInProgressCnt	char	2 '\x02'	0x2000B755	
	MultiSelectCB	struct _SlMultiSelectCB_t	{readsds=0,writesds=0,CtrlSockFD=2,ActiveSelect=0 '\x00',ActiveWaiters=0 '\x00'...}	0x2000B758	
	spawnMsgList	struct _SlSpawnMsgItem_s *	0x00000000 {AsyncHndlr=0x20004000,ActionIndex=49 '1',Buffer=0x0000FDA9,next=0x0000FDAB ...}	0x2000B7F4	
	NumOfDeletedSyncObj	unsigned char	0 '\x00'	0x2000B7F8	

  • Hi Jonas,

    The SimpleLink Wi-Fi host driver has an internal queuing mechanism that precludes the need for using a semaphore to ensure that you do not issue concurrent SL API calls. This is why Shlomi advised you to debug the source of the problem rather than rely on the semaphore to work around the problem.

    Out of curiosity, what does ROV report for the state of your task stacks? Please double-check and ensure that your task stacks are still in a good state. You can follow my instructions here to launch ROV and examine your RTOS state:
    e2e.ti.com/.../2707429

    Regards,
    Michael
  • Hello Jonas,

    Thanks for coming back.

    I reviewed the log and there are many things that doesn't fall into place.

    • RxDoneCnt which counts the number of processed interrupts shows a value of 2 which means that the captured data is right at the beginning after init complete event was received. Is that the case (unless there was a wrap around on this variable but I don't think this is the case here as I explain in the next bullet)?
    • The other evidence that this is right after init complete is the 18 entries of the pools. Seems like the values are just as their initial values. If this si the case, I do not see any way you called Select() and then Recv() since the numbers should have been different.
    • The ActionID on the first entry which is the only occupied entry is 27. Not sure exactly what SDK version you are using but this would be one of the latest since client #27 wouldn't be RECV. What version are you using?
    • If it is indeed RECV, and the ActiveActionsBitmap is 0, you can look at the code that you should not enter into the waiting for a pool to be free. You should get one immediately.
      /*In case this action is socket related, SocketID bit will be on
          In case SocketID is set to SL_MAX_SOCKETS, the socket is not relevant to the action. In that case ActionID bit will be on */
          while ( ( (SL_MAX_SOCKETS > SocketID) && (g_pCB->ActiveActionsBitmap & (1<<SocketID)) ) || 
                  ( (g_pCB->ActiveActionsBitmap & ( MULTI_SELECT_MASK & (1<<ActionID))) && (SL_MAX_SOCKETS == SocketID) ) )

    • please try again and run till you get stuck in the _SlDrvSyncObjWaitForever() as before and also provide the call stack to verify it. Also provide the globals.
    • Lastly, please attach your user.h header file.

    Regards,

    Shlomi

  • Hi Jonas,

    I assume that you have resolved your issue since we have not heard back from you. If not, feel free to post a response to this thread, or open a new thread regarding this issue.

    Regards,
    Michael