Other Parts Discussed in Thread: UNIFLASH, CC3120, CC3100, CC3200
I am a FAE of a Distributor in Japan.
My customer has a problem.
SL_DEVICE_EVENT_FATAL_DRIVER_ABORT occurs in sl_SendTo when multiple UDP communications are performed in an environment with weak radio quality.
They checked the details and found that TxPoolCnt was 4 at the beginning of the _SlDrvDataWriteOp function (# 1), but TxPoolCnt was 2 at VERIFY_PROTOCOL (# 2).
It seems that the spawn task is executed between # 1 and # 2, and TxPoolCnt is changed to 2 by the _SlDrvMsgRead function.
- Is there anything the TxPoolCnt suddenly update to the minimum value?
- Can you give me advice on how to avoid this issue?
/* ******************************************************************************/ /* _SlDrvDataWriteOp */ /* ******************************************************************************/ _SlReturnVal_t _SlDrvDataWriteOp(_SlSd_t Sd, _SlCmdCtrl_t *pCmdCtrl, void *pTxRxDescBuff, _SlCmdExt_t *pCmdExt) { _SlReturnVal_t RetVal = SL_ERROR_BSD_EAGAIN; /* initiated as SL_EAGAIN for the non blocking mode */ _u32 allocTxPoolPkts; while(1) { /* Do Flow Control check/update for DataWrite operation */ SL_DRV_OBJ_LOCK_FOREVER(&g_pCB->FlowContCB.TxLockObj); : if(g_pCB->FlowContCB.TxPoolCnt <= FLOW_CONT_MIN + allocTxPoolPkts) ----> (#1) { /* we have indication that this socket is set as blocking and we try to */ /* unblock it - return an error */ if(g_pCB->SocketNonBlocking & (1 << (Sd & SL_BSD_SOCKET_ID_MASK))) { #if (defined (SL_PLATFORM_MULTI_THREADED)) && \ (!defined (SL_PLATFORM_EXTERNAL_SPAWN)) if(_SlDrvIsSpawnOwnGlobalLock()) { _SlInternalSpawnWaitForEvent(); } #endif SL_DRV_OBJ_UNLOCK(&g_pCB->FlowContCB.TxLockObj); return(RetVal); } /* If TxPoolCnt was increased by other thread at this moment, */ /* TxSyncObj won't wait here */ #if (defined (SL_PLATFORM_MULTI_THREADED)) && \ (!defined (SL_PLATFORM_EXTERNAL_SPAWN)) if(_SlDrvIsSpawnOwnGlobalLock()) { while(TRUE) { /* If we are in spawn context, this is an API which was called from event handler, read any async event and check if we got signaled */ _SlInternalSpawnWaitForEvent(); /* is it mine? */ if(0 == sl_SyncObjWait(&g_pCB->FlowContCB.TxSyncObj, SL_OS_NO_WAIT)) { break; } } } else #endif { SL_DRV_SYNC_OBJ_WAIT_FOREVER(&g_pCB->FlowContCB.TxSyncObj); } } if(g_pCB->FlowContCB.TxPoolCnt > FLOW_CONT_MIN + allocTxPoolPkts) { break; } else { SL_DRV_OBJ_UNLOCK(&g_pCB->FlowContCB.TxLockObj); } } SL_DRV_LOCK_GLOBAL_LOCK_FOREVER(GLOBAL_LOCK_FLAGS_UPDATE_API_IN_PROGRESS); /* In case the global was succesffully taken but error in progress it means it has been released as part of an error handling and we should abort immediately */ if(SL_IS_RESTART_REQUIRED) { SL_DRV_LOCK_GLOBAL_UNLOCK(TRUE); return(SL_API_ABORTED); } /* Here we consider the case in which some cmd has been sent to the NWP, And its allocated packet has not been freed yet. */ VERIFY_PROTOCOL(g_pCB->FlowContCB.TxPoolCnt > (FLOW_CONT_MIN + allocTxPoolPkts - 1)); ----> (#2) g_pCB->FlowContCB.TxPoolCnt -= (_u8)allocTxPoolPkts; SL_DRV_OBJ_UNLOCK(&g_pCB->FlowContCB.TxLockObj); SL_TRACE1(DBG_MSG, MSG_312, "\n\r_SlDrvCmdOp: call _SlDrvMsgWrite: %x\n\r", pCmdCtrl->Opcode); /* send the message */ RetVal = _SlDrvMsgWrite(pCmdCtrl, pCmdExt, pTxRxDescBuff); SL_DRV_LOCK_GLOBAL_UNLOCK(TRUE); return(RetVal); }
The environments they use are:
- SDK Version : 2.40.00.22 (simplelink_sdk_wifi_plugin_2_40_00_22.exe)
- Service Pack : 3.11.1.0_2.0.0.0_2.2.0.6 (CC3x20ServicePack-3.11.1.0_2.0.0.0_2.2.0.6-windows-installer(2.40.00.22).exe)
- Host OS : RTX OS (MCU: Renesas RZ/A1H)
Thank you for advice.
Regards,
Yojiro