Port of TI's CC3100 Websock camera demo. Using FreeRTOS, mbedTLS, also parts of Arducam for cams ov5642 and 0v2640. Can also use MT9D111. Work in progress. Be warned some parts maybe a bit flacky. This is for Seeed Arch max only, for an M3, see the demo for CM3 using the 0v5642 aducam mini.

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
dflet
Date:
Thu Sep 10 17:56:09 2015 +0000
Parent:
18:3f1b52616d00
Child:
20:409ebd125b9c
Commit message:
Solved part of the problem with spi, looks like there is maybe a fault with the Seeed Arch Max, fault or by design i don't know, program seems to work fine on an STMF32407I (Waveshare) baord.

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
simplelink/G_functions/fPtr_func.cpp Show annotated file Show diff for this revision Revisions of this file
simplelink/cc3100.cpp Show annotated file Show diff for this revision Revisions of this file
simplelink/cc3100.h Show annotated file Show diff for this revision Revisions of this file
simplelink/cc3100_driver.cpp Show annotated file Show diff for this revision Revisions of this file
simplelink/cc3100_driver.h Show annotated file Show diff for this revision Revisions of this file
simplelink/cc3100_netapp.cpp Show annotated file Show diff for this revision Revisions of this file
simplelink/cc3100_netapp.h Show annotated file Show diff for this revision Revisions of this file
simplelink/cc3100_nonos.cpp Show annotated file Show diff for this revision Revisions of this file
simplelink/cc3100_nonos.h Show annotated file Show diff for this revision Revisions of this file
simplelink/cc3100_socket.cpp Show annotated file Show diff for this revision Revisions of this file
simplelink/cc3100_socket.h Show annotated file Show diff for this revision Revisions of this file
simplelink/cc3100_spawn.cpp Show annotated file Show diff for this revision Revisions of this file
simplelink/cc3100_spi.cpp Show annotated file Show diff for this revision Revisions of this file
simplelink/cc3100_trace.h Show annotated file Show diff for this revision Revisions of this file
simplelink/cc3100_user.h Show annotated file Show diff for this revision Revisions of this file
utils/app_config.h Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Thu Sep 03 20:10:39 2015 +0000
+++ b/main.cpp	Thu Sep 10 17:56:09 2015 +0000
@@ -70,6 +70,7 @@
  * HttpSocket.cpp
  * HttpStatic.cpp
  * fPtr_func.cpp
+ * cc3100_spawn.cpp
  */ 
 
 /* Off board leds */
--- a/simplelink/G_functions/fPtr_func.cpp	Thu Sep 03 20:10:39 2015 +0000
+++ b/simplelink/G_functions/fPtr_func.cpp	Thu Sep 10 17:56:09 2015 +0000
@@ -47,12 +47,8 @@
 #include "myBoardInit.h"
     
 using namespace mbed_cc3100;
-
-#if (THIS_BOARD == Seeed_Arch_Max)       
+    
 cc3100 _cc3100_(NC, NC, PD_12, PD_13, PD_11, SPI(PB_5, PB_4, PB_3));//Seeed_Arch_Max  irq, nHib, cs, mosi, miso, sck
-#elif (THIS_BOARD == EA_MBED_LPC4088)
-cc3100 _cc3100_(p14, p15, p9, p10, p8, SPI(p5, p6, p7));//LPC4088  irq, nHib, cs, mosi, miso, sck
-#endif
 
 #ifdef __cplusplus
 extern "C" {
@@ -636,9 +632,9 @@
     } while (OSI_OK != retCode);
 
 #else 
-#ifndef SL_PLATFORM_MULTI_THREADED
+//#ifndef SL_PLATFORM_MULTI_THREADED
+#if (!defined (SL_PLATFORM_MULTI_THREADED)) && (!defined (SL_PLATFORM_EXTERNAL_SPAWN))
     _cc3100_._driver._SlDrvObjLockWaitForever(&g_pCB->GlobalLockObj); 
-//    OSI_RET_OK_CHECK(_cc3100_._nonos.sl_LockObjLock(&g_pCB->GlobalLockObj, SL_OS_WAIT_FOREVER) );
 #else    
     OSI_RET_OK_CHECK(sl_LockObjLock(&g_pCB->GlobalLockObj, SL_OS_WAIT_FOREVER) );
 #endif    
@@ -650,9 +646,9 @@
     /*  Messages might have been read by CmdResp context. Therefore after */
     /*  getting LockObj, check again where the Pending Rx Msg is still present. */
     if(FALSE == (_cc3100_._driver._SL_PENDING_RX_MSG(g_pCB))) {
-#ifndef SL_PLATFORM_MULTI_THREADED
+//#ifndef SL_PLATFORM_MULTI_THREADED
+#if (!defined (SL_PLATFORM_MULTI_THREADED)) && (!defined (SL_PLATFORM_EXTERNAL_SPAWN))
         _cc3100_._driver._SlDrvObjUnLock(&g_pCB->GlobalLockObj);       
-//        OSI_RET_OK_CHECK(_cc3100_._nonos.sl_LockObjUnlock(&g_pCB->GlobalLockObj));
 #else        
         OSI_RET_OK_CHECK(sl_LockObjUnlock(&g_pCB->GlobalLockObj));
 #endif        
@@ -687,7 +683,8 @@
         default:
             VERIFY_PROTOCOL(0);
     }
-#ifndef SL_PLATFORM_MULTI_THREADED
+//#ifndef SL_PLATFORM_MULTI_THREADED
+#if (!defined (SL_PLATFORM_MULTI_THREADED)) && (!defined (SL_PLATFORM_EXTERNAL_SPAWN))
     _cc3100_._driver._SlDrvObjUnLock(&g_pCB->GlobalLockObj);
 //    OSI_RET_OK_CHECK(_cc3100_._nonos.sl_LockObjUnlock(&g_pCB->GlobalLockObj));
 #else    
--- a/simplelink/cc3100.cpp	Thu Sep 03 20:10:39 2015 +0000
+++ b/simplelink/cc3100.cpp	Thu Sep 10 17:56:09 2015 +0000
@@ -61,7 +61,8 @@
     int32_t   g_SockID;
 		
 
-#ifndef SL_PLATFORM_MULTI_THREADED
+//#ifndef SL_PLATFORM_MULTI_THREADED
+#if (!defined (SL_PLATFORM_MULTI_THREADED)) && (!defined (SL_PLATFORM_EXTERNAL_SPAWN))
 cc3100::cc3100(PinName button1_irq, PinName button2_irq, PinName cc3100_irq, PinName cc3100_nHIB, PinName cc3100_cs, SPI cc3100_spi)
     : _spi(button1_irq, button2_irq, cc3100_irq, cc3100_nHIB, cc3100_cs, cc3100_spi, _driver),
       _driver(_spi, _nonos, _netapp, _flowcont), _nonos(_driver), _wlan(_driver, _wlan_filters),
@@ -133,7 +134,8 @@
     if(0 == retVal)
     {
         /* Wait */
-#ifndef SL_PLATFORM_MULTI_THREADED         
+//#ifndef SL_PLATFORM_MULTI_THREADED
+#if (!defined (SL_PLATFORM_MULTI_THREADED)) && (!defined (SL_PLATFORM_EXTERNAL_SPAWN))         
         while(IS_CONNECTED(g_Status,STATUS_BIT_CONNECTION)) { _nonos._SlNonOsMainLoopTask(); }
 #endif        
     }
@@ -157,9 +159,11 @@
     role = sl_Start(0, 0, 0);
     if (ROLE_AP == role) {
         /* If the device is in AP mode, we need to wait for this event before doing anything */
+#if (!defined (SL_PLATFORM_MULTI_THREADED)) && (!defined (SL_PLATFORM_EXTERNAL_SPAWN))        
         while(!IS_IP_ACQUIRED(g_Status,STATUS_BIT_IP_ACQUIRED)) {
             _nonos._SlNonOsMainLoopTask();
         }
+#endif        
     } else {
         /* Configure CC3100 to start in AP mode */
         retVal = _wlan.sl_WlanSetMode(ROLE_AP);
@@ -190,10 +194,12 @@
 
         role = sl_Start(0, 0, 0);
         if (ROLE_AP == role) {
+#if (!defined (SL_PLATFORM_MULTI_THREADED)) && (!defined (SL_PLATFORM_EXTERNAL_SPAWN))            
             /* If the device is in AP mode, we need to wait for this event before doing anything */
             while(!IS_IP_ACQUIRED(g_Status,STATUS_BIT_IP_ACQUIRED)) {
                 _nonos._SlNonOsMainLoopTask();
             }
+#endif            
         } else {
             printf(" Device couldn't be configured in AP mode \n\r");
             LOOP_FOREVER();
@@ -283,7 +289,8 @@
 			GPIO_IF_LedOff(MCU_RED_LED_GPIO);
 			osi_Sleep(50);
 
-#ifndef SL_PLATFORM_MULTI_THREADED
+//#ifndef SL_PLATFORM_MULTI_THREADED
+#if (!defined (SL_PLATFORM_MULTI_THREADED)) && (!defined (SL_PLATFORM_EXTERNAL_SPAWN))
               _nonos._SlNonOsMainLoopTask();
 #else
               osi_Sleep(1);
@@ -362,7 +369,8 @@
     if (ROLE_STA != role) {
         if (ROLE_AP == role) {
             /* If the device is in AP mode, we need to wait for this event before doing anything */
-#ifndef SL_PLATFORM_MULTI_THREADED            
+//#ifndef SL_PLATFORM_MULTI_THREADED
+#if (!defined (SL_PLATFORM_MULTI_THREADED)) && (!defined (SL_PLATFORM_EXTERNAL_SPAWN))            
             while(!IS_IP_ACQUIRED(g_Status,STATUS_BIT_IP_ACQUIRED)) {
                 _nonos._SlNonOsMainLoopTask();
             }
@@ -408,7 +416,8 @@
     retVal = _wlan.sl_WlanDisconnect();
     if(0 == retVal) {
         /* Wait */
-#ifndef SL_PLATFORM_MULTI_THREADED        
+//#ifndef SL_PLATFORM_MULTI_THREADED
+#if (!defined (SL_PLATFORM_MULTI_THREADED)) && (!defined (SL_PLATFORM_EXTERNAL_SPAWN))        
         while(IS_CONNECTED(g_Status,STATUS_BIT_CONNECTION)) {
             _nonos._SlNonOsMainLoopTask();
         }
@@ -926,7 +935,8 @@
     ASSERT_ON_ERROR(retVal);
     
     /* Wait */
-#ifndef SL_PLATFORM_MULTI_THREADED    
+//#ifndef SL_PLATFORM_MULTI_THREADED 
+#if (!defined (SL_PLATFORM_MULTI_THREADED)) && (!defined (SL_PLATFORM_EXTERNAL_SPAWN))   
     while((!IS_CONNECTED(g_Status,STATUS_BIT_CONNECTION)) || (!IS_IP_ACQUIRED(g_Status,STATUS_BIT_IP_ACQUIRED))) { _nonos._SlNonOsMainLoopTask(); }
 #endif
     return SUCCESS;
@@ -963,7 +973,8 @@
     ASSERT_ON_ERROR(retVal);
 
     /* Wait */
-#ifndef SL_PLATFORM_MULTI_THREADED    
+//#ifndef SL_PLATFORM_MULTI_THREADED 
+#if (!defined (SL_PLATFORM_MULTI_THREADED)) && (!defined (SL_PLATFORM_EXTERNAL_SPAWN))   
     while(!IS_PING_DONE(g_Status,STATUS_BIT_PING_DONE)) { _nonos._SlNonOsMainLoopTask(); }
 #endif    
 
@@ -1018,7 +1029,8 @@
     ASSERT_ON_ERROR(retVal);
 
     /* Wait */
-#ifndef SL_PLATFORM_MULTI_THREADED    
+//#ifndef SL_PLATFORM_MULTI_THREADED
+#if (!defined (SL_PLATFORM_MULTI_THREADED)) && (!defined (SL_PLATFORM_EXTERNAL_SPAWN))    
     while(!IS_PING_DONE(g_Status,STATUS_BIT_PING_DONE)) { _nonos._SlNonOsMainLoopTask(); }
 #endif    
 
--- a/simplelink/cc3100.h	Thu Sep 03 20:10:39 2015 +0000
+++ b/simplelink/cc3100.h	Thu Sep 10 17:56:09 2015 +0000
@@ -801,7 +801,8 @@
     
     cc3100_spi               _spi;
     cc3100_driver            _driver;
-#ifndef SL_PLATFORM_MULTI_THREADED   
+//#ifndef SL_PLATFORM_MULTI_THREADED 
+#if (!defined (SL_PLATFORM_MULTI_THREADED)) && (!defined (SL_PLATFORM_EXTERNAL_SPAWN))  
     cc3100_nonos             _nonos;
 #endif    
     cc3100_wlan              _wlan;
--- a/simplelink/cc3100_driver.cpp	Thu Sep 03 20:10:39 2015 +0000
+++ b/simplelink/cc3100_driver.cpp	Thu Sep 10 17:56:09 2015 +0000
@@ -157,7 +157,8 @@
     NULL
 };
 
-#ifndef SL_PLATFORM_MULTI_THREADED
+//#ifndef SL_PLATFORM_MULTI_THREADED
+#if (!defined (SL_PLATFORM_MULTI_THREADED)) && (!defined (SL_PLATFORM_EXTERNAL_SPAWN))
 cc3100_driver::cc3100_driver(cc3100_spi &spi, cc3100_nonos &nonos, cc3100_netapp &netapp, cc3100_flowcont &flowcont)
     :  _spi(spi), _nonos(nonos), _netapp(netapp), _flowcont(flowcont)
 {
@@ -230,7 +231,8 @@
     MALLOC_OK_CHECK(g_pCB);
     _SlDrvMemZero(g_pCB, sizeof(_SlDriverCb_t));
     RxIrqCnt = 0;
-#ifndef SL_PLATFORM_MULTI_THREADED
+//#ifndef SL_PLATFORM_MULTI_THREADED
+#if (!defined (SL_PLATFORM_MULTI_THREADED)) && (!defined (SL_PLATFORM_EXTERNAL_SPAWN))
     OSI_RET_OK_CHECK( _nonos.sl_SyncObjCreate(&g_pCB->CmdSyncObj, "CmdSyncObj") );
     _nonos.sl_SyncObjClear(&g_pCB->CmdSyncObj);
     OSI_RET_OK_CHECK( _nonos.sl_LockObjCreate(&g_pCB->GlobalLockObj, "GlobalLockObj") );
@@ -251,7 +253,8 @@
     {
         g_pCB->ObjPool[Idx].NextIndex = Idx + 1;
         g_pCB->ObjPool[Idx].AdditionalData = SL_MAX_SOCKETS;
-#ifndef SL_PLATFORM_MULTI_THREADED
+//#ifndef SL_PLATFORM_MULTI_THREADED
+#if (!defined (SL_PLATFORM_MULTI_THREADED)) && (!defined (SL_PLATFORM_EXTERNAL_SPAWN))
         OSI_RET_OK_CHECK( _nonos.sl_SyncObjCreate(&g_pCB->ObjPool[Idx].SyncObj, "SyncObj"));
         _nonos.sl_SyncObjClear(&g_pCB->ObjPool[Idx].SyncObj);
 #else
@@ -265,7 +268,8 @@
 
     /* Flow control init */
     g_pCB->FlowContCB.TxPoolCnt = FLOW_CONT_MIN;
-#ifndef SL_PLATFORM_MULTI_THREADED   
+//#ifndef SL_PLATFORM_MULTI_THREADED
+#if (!defined (SL_PLATFORM_MULTI_THREADED)) && (!defined (SL_PLATFORM_EXTERNAL_SPAWN))   
     OSI_RET_OK_CHECK(_nonos.sl_LockObjCreate(&g_pCB->FlowContCB.TxLockObj, "TxLockObj"));
     OSI_RET_OK_CHECK(_nonos.sl_SyncObjCreate(&g_pCB->FlowContCB.TxSyncObj, "TxSyncObj"));
 #else
@@ -284,7 +288,8 @@
     
     /* Flow control de-init */
     g_pCB->FlowContCB.TxPoolCnt = 0;
-#ifndef SL_PLATFORM_MULTI_THREADED    
+//#ifndef SL_PLATFORM_MULTI_THREADED 
+#if (!defined (SL_PLATFORM_MULTI_THREADED)) && (!defined (SL_PLATFORM_EXTERNAL_SPAWN))   
     OSI_RET_OK_CHECK(_nonos.sl_LockObjDelete(&g_pCB->FlowContCB.TxLockObj));
     OSI_RET_OK_CHECK(_nonos.sl_SyncObjDelete(&g_pCB->FlowContCB.TxSyncObj));
     
@@ -330,7 +335,8 @@
     RxIrqCnt++;
     
     if (TRUE == g_pCB->IsCmdRespWaited) {
-#ifndef SL_PLATFORM_MULTI_THREADED      
+//#ifndef SL_PLATFORM_MULTI_THREADED
+#if (!defined (SL_PLATFORM_MULTI_THREADED)) && (!defined (SL_PLATFORM_EXTERNAL_SPAWN))      
         OSI_RET_OK_CHECK( _nonos.sl_SyncObjSignalFromIRQ(&g_pCB->CmdSyncObj) );
 #else        
         OSI_RET_OK_CHECK( sl_SyncObjSignalFromIRQ(&g_pCB->CmdSyncObj) );
@@ -428,7 +434,8 @@
     /* Clear SyncObj for the case it was signalled before TxPoolCnt */
     /* dropped below '1' (last Data buffer was taken)  */
     /* OSI_RET_OK_CHECK( sl_SyncObjClear(&g_pCB->FlowContCB.TxSyncObj) ); */
-#ifndef SL_PLATFORM_MULTI_THREADED       
+//#ifndef SL_PLATFORM_MULTI_THREADED
+#if (!defined (SL_PLATFORM_MULTI_THREADED)) && (!defined (SL_PLATFORM_EXTERNAL_SPAWN))       
     _nonos.sl_SyncObjClear(&g_pCB->FlowContCB.TxSyncObj);
 #else    
     sl_SyncObjClear(&g_pCB->FlowContCB.TxSyncObj);
@@ -475,7 +482,8 @@
         /*  Clear SyncObj for the case it was signalled before TxPoolCnt */
         /*  dropped below '1' (last Data buffer was taken) */
         /* OSI_RET_OK_CHECK( sl_SyncObjClear(&g_pCB->FlowContCB.TxSyncObj) ); */
-#ifndef SL_PLATFORM_MULTI_THREADED               
+//#ifndef SL_PLATFORM_MULTI_THREADED
+#if (!defined (SL_PLATFORM_MULTI_THREADED)) && (!defined (SL_PLATFORM_EXTERNAL_SPAWN))               
         _nonos.sl_SyncObjClear(&g_pCB->FlowContCB.TxSyncObj);
 #else        
         sl_SyncObjClear(&g_pCB->FlowContCB.TxSyncObj);
@@ -553,18 +561,18 @@
 
 #ifdef SL_IF_TYPE_UART
     /*  Write long sync pattern */
-    _spi.spi_Write(g_pCB->FD, (uint8_t *)&g_H2NSyncPattern.Long, 2*SYNC_PATTERN_LEN);
+    NWP_IF_WRITE_CHECK(g_pCB->FD, (uint8_t *)&g_H2NSyncPattern.Long, 2*SYNC_PATTERN_LEN);
 #else
     /*  Write short sync pattern */
-    _spi.spi_Write(g_pCB->FD, (uint8_t *)&g_H2NSyncPattern.Short, SYNC_PATTERN_LEN);
+    NWP_IF_WRITE_CHECK(g_pCB->FD, (uint8_t *)&g_H2NSyncPattern.Short, SYNC_PATTERN_LEN);
 #endif
     /*  Header */
-    _spi.spi_Write(g_pCB->FD, (uint8_t *)&g_pCB->TempProtocolHeader, _SL_CMD_HDR_SIZE);
+    NWP_IF_WRITE_CHECK(g_pCB->FD, (uint8_t *)&g_pCB->TempProtocolHeader, _SL_CMD_HDR_SIZE);
 
     /*  Descriptors */
     if (pTxRxDescBuff && pCmdCtrl->TxDescLen > 0)
     {
-    	_spi.spi_Write(g_pCB->FD, pTxRxDescBuff, 
+    	NWP_IF_WRITE_CHECK(g_pCB->FD, pTxRxDescBuff, 
                            _SL_PROTOCOL_ALIGN_SIZE(pCmdCtrl->TxDescLen));
     }
 
@@ -573,7 +581,7 @@
     /*  transceiver mode */
     if (sendRxPayload == TRUE )
     {
-     	_spi.spi_Write(g_pCB->FD, pCmdExt->pRxPayload, _SL_PROTOCOL_ALIGN_SIZE(pCmdExt->RxPayloadLen));
+     	NWP_IF_WRITE_CHECK(g_pCB->FD, pCmdExt->pRxPayload, _SL_PROTOCOL_ALIGN_SIZE(pCmdExt->RxPayloadLen));
     }
 
     /*  Payload */
@@ -583,7 +591,7 @@
         /*  Otherwise the aligning of arguments will create a gap between arguments and payload. */
         VERIFY_PROTOCOL(_SL_IS_PROTOCOL_ALIGNED_SIZE(pCmdCtrl->TxDescLen));
 
-    	_spi.spi_Write(g_pCB->FD, pCmdExt->pTxPayload, _SL_PROTOCOL_ALIGN_SIZE(pCmdExt->TxPayloadLen));
+    	NWP_IF_WRITE_CHECK(g_pCB->FD, pCmdExt->pTxPayload, _SL_PROTOCOL_ALIGN_SIZE(pCmdExt->TxPayloadLen));
     }
 
     _SL_DBG_CNT_INC(MsgCnt.Write);
@@ -672,7 +680,7 @@
 			}
             if (RespPayloadLen > 0)
             {
-                _spi.spi_Read(g_pCB->FD, pAsyncBuf + _SL_RESP_HDR_SIZE, AlignedLengthRecv);
+                NWP_IF_READ_CHECK(g_pCB->FD, pAsyncBuf + _SL_RESP_HDR_SIZE, AlignedLengthRecv);
             }
         /* In case ASYNC RX buffer length is smaller then the received data length, dump the rest */
 			if ((_SL_PROTOCOL_ALIGN_SIZE(RespPayloadLen) > SL_ASYNC_MAX_PAYLOAD_LEN))
@@ -680,7 +688,7 @@
 				AlignedLengthRecv = _SL_PROTOCOL_ALIGN_SIZE(RespPayloadLen) - SL_ASYNC_MAX_PAYLOAD_LEN;
                 while (AlignedLengthRecv > 0)
                 {
-                _spi.spi_Read(g_pCB->FD,TailBuffer,4);
+                NWP_IF_READ_CHECK(g_pCB->FD,TailBuffer,4);
                 AlignedLengthRecv = AlignedLengthRecv - 4;
                 }
             }
@@ -722,7 +730,7 @@
 
             /*  Read first 4 bytes of Recv/Recvfrom response to get SocketId and actual  */
             /*  response data length */
-            _spi.spi_Read(g_pCB->FD, &uBuf.TempBuf[4], RECV_ARGS_SIZE);
+            NWP_IF_READ_CHECK(g_pCB->FD, &uBuf.TempBuf[4], RECV_ARGS_SIZE);
 
             /*  Validate Socket ID and Received Length value.  */
             VERIFY_PROTOCOL((SD(&uBuf.TempBuf[4])& BSD_SOCKET_ID_MASK) < SL_MAX_SOCKETS);
@@ -739,7 +747,7 @@
 
             if(ExpArgSize > RECV_ARGS_SIZE)
             {
-                _spi.spi_Read(g_pCB->FD,
+                NWP_IF_READ_CHECK(g_pCB->FD,
                     ((_SlArgsData_t *)(g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].pRespArgs))->pArgs + RECV_ARGS_SIZE,
                     ExpArgSize - RECV_ARGS_SIZE);
             }
@@ -759,12 +767,12 @@
                 AlignedLengthRecv = ACT_DATA_SIZE(&uBuf.TempBuf[4]) & (~3);
                 if( AlignedLengthRecv >= 4)
                 {
-                    _spi.spi_Read(g_pCB->FD,((_SlArgsData_t *)(g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].pRespArgs))->pData,AlignedLengthRecv );                      
+                    NWP_IF_READ_CHECK(g_pCB->FD,((_SlArgsData_t *)(g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].pRespArgs))->pData,AlignedLengthRecv );                      
                 }
                 /*  copy the unaligned part, if any */
                 if( LengthToCopy > 0) 
                 {
-                    _spi.spi_Read(g_pCB->FD,TailBuffer,4);
+                    NWP_IF_READ_CHECK(g_pCB->FD,TailBuffer,4);
                     /*  copy TailBuffer unaligned part (1/2/3 bytes) */
                     memcpy(((_SlArgsData_t *)(g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].pRespArgs))->pData + AlignedLengthRecv,TailBuffer,LengthToCopy);                    
                 }                  
@@ -782,7 +790,7 @@
             /*  When RxDescLen is not exact, using RxPayloadLen is forbidden! */
             /*  If such case cannot be avoided - parse message here to detect */
             /*  arguments/payload border. */
-            _spi.spi_Read(g_pCB->FD, g_pCB->FunctionParams.pTxRxDescBuff, _SL_PROTOCOL_ALIGN_SIZE(g_pCB->FunctionParams.pCmdCtrl->RxDescLen));
+            NWP_IF_READ_CHECK(g_pCB->FD, g_pCB->FunctionParams.pTxRxDescBuff, _SL_PROTOCOL_ALIGN_SIZE(g_pCB->FunctionParams.pCmdCtrl->RxDescLen));
 
             if((NULL != g_pCB->FunctionParams.pCmdExt) && (0 != g_pCB->FunctionParams.pCmdExt->RxPayloadLen)) {
                 /*  Actual size of command's response payload: <msg_payload_len> - <rsp_args_len> */
@@ -808,14 +816,14 @@
                     /*  and copied to a TailBuffer  */
 
                     if( AlignedLengthRecv >= 4) {
-                        _spi.spi_Read(g_pCB->FD,
+                        NWP_IF_READ_CHECK(g_pCB->FD,
                                           g_pCB->FunctionParams.pCmdExt->pRxPayload,
                                           AlignedLengthRecv );
 
                     }
                     /*  copy the unaligned part, if any */
                     if( LengthToCopy > 0) {
-                        _spi.spi_Read(g_pCB->FD,TailBuffer,4);
+                        NWP_IF_READ_CHECK(g_pCB->FD,TailBuffer,4);
                         /*  copy TailBuffer unaligned part (1/2/3 bytes) */
                         memcpy(g_pCB->FunctionParams.pCmdExt->pRxPayload + AlignedLengthRecv,
                                   TailBuffer,
@@ -827,7 +835,7 @@
                         /* calculate the rest of the data size to dump */
                         AlignedLengthRecv = ActDataSize - (g_pCB->FunctionParams.pCmdExt->RxPayloadLen & (~3));
                         while( AlignedLengthRecv > 0) {
-                            _spi.spi_Read(g_pCB->FD,TailBuffer, 4 );
+                            NWP_IF_READ_CHECK(g_pCB->FD,TailBuffer, 4 );
                             AlignedLengthRecv = AlignedLengthRecv - 4;
                         }
                     }
@@ -841,7 +849,7 @@
     }
 
     if(AlignSize > 0) {
-        _spi.spi_Read(g_pCB->FD, uBuf.TempBuf, AlignSize);
+        NWP_IF_READ_CHECK(g_pCB->FD, uBuf.TempBuf, AlignSize);
     }
 
     _SL_DBG_CNT_INC(MsgCnt.Read);
@@ -927,7 +935,8 @@
 
                 /*  In case CmdResp has been read without  waiting on CmdSyncObj -  that */
                 /*  Sync object. That to prevent old signal to be processed. */
-#ifndef SL_PLATFORM_MULTI_THREADED               
+//#ifndef SL_PLATFORM_MULTI_THREADED 
+#if (!defined (SL_PLATFORM_MULTI_THREADED)) && (!defined (SL_PLATFORM_EXTERNAL_SPAWN))              
                 _nonos.sl_SyncObjClear(&g_pCB->CmdSyncObj);
 #else                
                 sl_SyncObjClear(&g_pCB->CmdSyncObj);
@@ -961,7 +970,8 @@
     _SlDrvObjUnLock(&g_pCB->GlobalLockObj);
     
     if(_SL_PENDING_RX_MSG(g_pCB)) {
-#ifndef SL_PLATFORM_MULTI_THREADED      
+//#ifndef SL_PLATFORM_MULTI_THREADED 
+#if (!defined (SL_PLATFORM_MULTI_THREADED)) && (!defined (SL_PLATFORM_EXTERNAL_SPAWN))     
       _nonos._SlNonOsSpawn((_SlSpawnEntryFunc_t)&_SlDrvMsgReadSpawnCtx, NULL, 0);
 #else
       sl_Spawn((_SlSpawnEntryFunc_t)&_SlDrvMsgReadSpawnCtx, NULL, 0);
@@ -1104,11 +1114,11 @@
     
 #ifndef SL_IF_TYPE_UART
     /*  1. Write CNYS pattern to NWP when working in SPI mode only  */
-    _spi.spi_Write(g_pCB->FD, (uint8_t *)&g_H2NCnysPattern.Short, SYNC_PATTERN_LEN);
+    NWP_IF_WRITE_CHECK(g_pCB->FD, (uint8_t *)&g_H2NCnysPattern.Short, SYNC_PATTERN_LEN);
 #endif
   
     /*  2. Read 4 bytes (protocol aligned) */
-    _spi.spi_Read(g_pCB->FD, &pBuf[0], 4);
+    NWP_IF_READ_CHECK(g_pCB->FD, &pBuf[0], 4);
     _SL_DBG_SYNC_LOG(SyncCnt,pBuf);
  
     /* Wait for SYNC_PATTERN_LEN from the device */
@@ -1121,7 +1131,7 @@
 
         /*  4. Read next 4 bytes to Low 4 bytes of buffer */
         if(0 == (SyncCnt % (uint32_t)SYNC_PATTERN_LEN)) {
-            _spi.spi_Read(g_pCB->FD, &pBuf[4], 4);
+            NWP_IF_READ_CHECK(g_pCB->FD, &pBuf[4], 4);
             _SL_DBG_SYNC_LOG(SyncCnt,pBuf);
         }
 
@@ -1140,20 +1150,20 @@
 
     if(SyncCnt > 0) {
         *(uint32_t *)&pBuf[0] = *(uint32_t *)&pBuf[4];
-        _spi.spi_Read(g_pCB->FD, &pBuf[SYNC_PATTERN_LEN - SyncCnt], (uint16_t)SyncCnt);
+        NWP_IF_READ_CHECK(g_pCB->FD, &pBuf[SYNC_PATTERN_LEN - SyncCnt], (uint16_t)SyncCnt);
     } else {
-        _spi.spi_Read(g_pCB->FD, &pBuf[0], 4);
+        NWP_IF_READ_CHECK(g_pCB->FD, &pBuf[0], 4);
     }
 
     /*  6. Scan for Double pattern. */
     while ( N2H_SYNC_PATTERN_MATCH(pBuf, g_pCB->TxSeqNum) ) {
         _SL_DBG_CNT_INC(Work.DoubleSyncPattern);
-        _spi.spi_Read(g_pCB->FD, &pBuf[0], SYNC_PATTERN_LEN);
+        NWP_IF_READ_CHECK(g_pCB->FD, &pBuf[0], SYNC_PATTERN_LEN);
     }
     g_pCB->TxSeqNum++;
 
     /*  7. Here we've read Generic Header (4 bytes). Read the Resp Specific header (4 more bytes). */
-    _spi.spi_Read(g_pCB->FD, &pBuf[SYNC_PATTERN_LEN], _SL_RESP_SPEC_HDR_SIZE);
+    NWP_IF_READ_CHECK(g_pCB->FD, &pBuf[SYNC_PATTERN_LEN], _SL_RESP_SPEC_HDR_SIZE);
 
     /*  8. Here we've read the entire Resp Header. */
     /*     Return number bytes needed to be sent after read for NWP Rx 4-byte alignment (protocol alignment) */
@@ -1433,7 +1443,8 @@
 
 void  cc3100_driver::_SlDrvSyncObjWaitForever(_SlSyncObj_t *pSyncObj)
 {
-#ifndef SL_PLATFORM_MULTI_THREADED   
+//#ifndef SL_PLATFORM_MULTI_THREADED
+#if (!defined (SL_PLATFORM_MULTI_THREADED)) && (!defined (SL_PLATFORM_EXTERNAL_SPAWN))   
     OSI_RET_OK_CHECK(_nonos.sl_SyncObjWait(pSyncObj, SL_OS_WAIT_FOREVER));
 #else    
     OSI_RET_OK_CHECK(sl_SyncObjWait(pSyncObj, SL_OS_WAIT_FOREVER));
@@ -1442,7 +1453,8 @@
 
 void  cc3100_driver::_SlDrvSyncObjSignal(_SlSyncObj_t *pSyncObj)
 {
-#ifndef SL_PLATFORM_MULTI_THREADED   
+//#ifndef SL_PLATFORM_MULTI_THREADED 
+#if (!defined (SL_PLATFORM_MULTI_THREADED)) && (!defined (SL_PLATFORM_EXTERNAL_SPAWN))  
     OSI_RET_OK_CHECK(_nonos.sl_SyncObjSignal(pSyncObj));
 #else    
     OSI_RET_OK_CHECK(sl_SyncObjSignal(pSyncObj));
@@ -1451,7 +1463,8 @@
 
 void cc3100_driver::_SlDrvObjLockWaitForever(_SlLockObj_t *pLockObj)
 {
-#ifndef SL_PLATFORM_MULTI_THREADED  
+//#ifndef SL_PLATFORM_MULTI_THREADED
+#if (!defined (SL_PLATFORM_MULTI_THREADED)) && (!defined (SL_PLATFORM_EXTERNAL_SPAWN))  
     OSI_RET_OK_CHECK(_nonos.sl_LockObjLock(pLockObj, SL_OS_WAIT_FOREVER));
 #else    
     OSI_RET_OK_CHECK(sl_LockObjLock(pLockObj, SL_OS_WAIT_FOREVER));
@@ -1460,7 +1473,8 @@
 
 void cc3100_driver::_SlDrvProtectionObjLockWaitForever()
 {
-#ifndef SL_PLATFORM_MULTI_THREADED    
+//#ifndef SL_PLATFORM_MULTI_THREADED
+#if (!defined (SL_PLATFORM_MULTI_THREADED)) && (!defined (SL_PLATFORM_EXTERNAL_SPAWN))    
     OSI_RET_OK_CHECK(_nonos.sl_LockObjLock(&g_pCB->ProtectionLockObj, SL_OS_WAIT_FOREVER));
 #else
     OSI_RET_OK_CHECK(sl_LockObjLock(&g_pCB->ProtectionLockObj, SL_OS_WAIT_FOREVER));
@@ -1469,7 +1483,8 @@
 
 void cc3100_driver::_SlDrvObjUnLock(_SlLockObj_t *pLockObj)
 {
-#ifndef SL_PLATFORM_MULTI_THREADED    
+//#ifndef SL_PLATFORM_MULTI_THREADED
+#if (!defined (SL_PLATFORM_MULTI_THREADED)) && (!defined (SL_PLATFORM_EXTERNAL_SPAWN))    
     OSI_RET_OK_CHECK(_nonos.sl_LockObjUnlock(pLockObj));
 #else    
     OSI_RET_OK_CHECK(sl_LockObjUnlock(pLockObj));
@@ -1478,7 +1493,8 @@
 
 void cc3100_driver::_SlDrvProtectionObjUnLock()
 {
-#ifndef SL_PLATFORM_MULTI_THREADED   
+//#ifndef SL_PLATFORM_MULTI_THREADED
+#if (!defined (SL_PLATFORM_MULTI_THREADED)) && (!defined (SL_PLATFORM_EXTERNAL_SPAWN))   
     OSI_RET_OK_CHECK(_nonos.sl_LockObjUnlock(&g_pCB->ProtectionLockObj));
 #else    
     OSI_RET_OK_CHECK(sl_LockObjUnlock(&g_pCB->ProtectionLockObj));
--- a/simplelink/cc3100_driver.h	Thu Sep 03 20:10:39 2015 +0000
+++ b/simplelink/cc3100_driver.h	Thu Sep 10 17:56:09 2015 +0000
@@ -39,6 +39,7 @@
 
 #include "mbed.h"
 #include "cc3100_simplelink.h"
+#include "cc3100_user.h"
 
 #include "cc3100_protocol.h"
 #include "cc3100_spi.h"
@@ -46,7 +47,8 @@
 #include "cc3100_netapp.h"
 //#include "cc3100.h"
 
-#ifdef SL_PLATFORM_MULTI_THREADED
+//#ifdef SL_PLATFORM_MULTI_THREADED
+#if (defined (SL_PLATFORM_MULTI_THREADED)) || (defined (SL_PLATFORM_EXTERNAL_SPAWN))
 #include "osi.h"
 #endif
 
@@ -114,8 +116,8 @@
     uint8_t  *pData;
 } _SlArgsData_t;
 
-typedef struct {
-    _SlSyncObj_t	      SyncObj;
+typedef struct {     
+    _SlSyncObj_t	      SyncObj;    
     uint8_t               *pRespArgs;
     uint8_t			      ActionID;
     uint8_t			      AdditionalData; /* use for socketID and one bit which indicate supprt IPV6 or not (1=support, 0 otherwise) */
@@ -161,7 +163,7 @@
 
 
 typedef struct {
-    uint8_t         TxPoolCnt;
+    uint8_t         TxPoolCnt;    
     _SlLockObj_t    TxLockObj;
     _SlSyncObj_t    TxSyncObj;
 } _SlFlowContCB_t;
@@ -225,7 +227,8 @@
 
 public:
 
-#ifndef SL_PLATFORM_MULTI_THREADED
+//#ifndef SL_PLATFORM_MULTI_THREADED
+#if (!defined (SL_PLATFORM_MULTI_THREADED)) && (!defined (SL_PLATFORM_EXTERNAL_SPAWN))
     cc3100_driver(cc3100_spi &spi, cc3100_nonos &nonos, cc3100_netapp &netapp, cc3100_flowcont &flowcont);
 #else 
     cc3100_driver(cc3100_spi &spi, cc3100_netapp &netapp, cc3100_flowcont &flowcont);
@@ -288,12 +291,12 @@
 
     _SlReturnVal_t	 _SlFindAndSetActiveObj(_SlOpcode_t  Opcode, uint8_t Sd);
     
-    uint16_t _SlDrvAlignSize(uint16_t msgLen); 
+    uint16_t _SlDrvAlignSize(uint16_t msgLen);     
     void  _SlDrvSyncObjWaitForever(_SlSyncObj_t *pSyncObj);
     void  _SlDrvSyncObjSignal(_SlSyncObj_t *pSyncObj);
     void  _SlDrvObjLock(_SlLockObj_t *pLockObj, _SlTime_t Timeout);
     void  _SlDrvObjLockWaitForever(_SlLockObj_t *pLockObj);
-    void  _SlDrvObjUnLock(_SlLockObj_t *pLockObj);    
+    void  _SlDrvObjUnLock(_SlLockObj_t *pLockObj);        
     void  _SlDrvProtectionObjLockWaitForever();
     void  _SlDrvProtectionObjUnLock();
     void  _SlDrvMemZero(void* Addr, uint16_t size);
@@ -303,7 +306,8 @@
 private:
 
     cc3100_spi        &_spi;
-#ifndef SL_PLATFORM_MULTI_THREADED    
+//#ifndef SL_PLATFORM_MULTI_THREADED
+#if (!defined (SL_PLATFORM_MULTI_THREADED)) && (!defined (SL_PLATFORM_EXTERNAL_SPAWN))    
     cc3100_nonos      &_nonos;
 #endif    
     cc3100_netapp     &_netapp;
--- a/simplelink/cc3100_netapp.cpp	Thu Sep 03 20:10:39 2015 +0000
+++ b/simplelink/cc3100_netapp.cpp	Thu Sep 10 17:56:09 2015 +0000
@@ -60,7 +60,8 @@
 const uint8_t NETAPP_MDNS_MAX_SERVICE_NAME_AND_TEXT_LENGTH   =      255;
 #endif
 
-#ifndef SL_PLATFORM_MULTI_THREADED	
+//#ifndef SL_PLATFORM_MULTI_THREADED	
+#if (!defined (SL_PLATFORM_MULTI_THREADED)) && (!defined (SL_PLATFORM_EXTERNAL_SPAWN))
 cc3100_netapp::cc3100_netapp(cc3100_driver &driver, cc3100_nonos &nonos)
     : _driver(driver), _nonos(nonos)
 {
@@ -775,7 +776,8 @@
         if (MAX_CONCURRENT_ACTIONS == ObjIdx) {
             return SL_POOL_IS_EMPTY;
         }
-#ifndef SL_PLATFORM_MULTI_THREADED               
+//#ifndef SL_PLATFORM_MULTI_THREADED
+#if (!defined (SL_PLATFORM_MULTI_THREADED)) && (!defined (SL_PLATFORM_EXTERNAL_SPAWN))               
         OSI_RET_OK_CHECK(_nonos.sl_LockObjLock(&g_pCB->ProtectionLockObj, SL_OS_WAIT_FOREVER));
 #else        
         OSI_RET_OK_CHECK(sl_LockObjLock(&g_pCB->ProtectionLockObj, SL_OS_WAIT_FOREVER));
@@ -783,7 +785,8 @@
         /* async response handler for non callback mode */
         g_pCB->ObjPool[ObjIdx].pRespArgs = (uint8_t *)&PingRsp;
         pPingCallBackFunc = NULL;
-#ifndef SL_PLATFORM_MULTI_THREADED
+//#ifndef SL_PLATFORM_MULTI_THREADED
+#if (!defined (SL_PLATFORM_MULTI_THREADED)) && (!defined (SL_PLATFORM_EXTERNAL_SPAWN))
         OSI_RET_OK_CHECK(_nonos.sl_LockObjUnlock(&g_pCB->ProtectionLockObj));
 #else        
         OSI_RET_OK_CHECK(sl_LockObjUnlock(&g_pCB->ProtectionLockObj));
@@ -931,7 +934,8 @@
 }
 #endif
 
-#ifndef SL_PLATFORM_MULTI_THREADED
+//#ifndef SL_PLATFORM_MULTI_THREADED
+#if (!defined (SL_PLATFORM_MULTI_THREADED)) && (!defined (SL_PLATFORM_EXTERNAL_SPAWN))
 cc3100_flowcont::cc3100_flowcont(cc3100_driver &driver, cc3100_nonos &nonos)
     : _driver(driver), _nonos(nonos)
 {
--- a/simplelink/cc3100_netapp.h	Thu Sep 03 20:10:39 2015 +0000
+++ b/simplelink/cc3100_netapp.h	Thu Sep 10 17:56:09 2015 +0000
@@ -513,7 +513,8 @@
 
 public:
 
-#ifndef SL_PLATFORM_MULTI_THREADED
+//#ifndef SL_PLATFORM_MULTI_THREADED
+#if (!defined (SL_PLATFORM_MULTI_THREADED)) && (!defined (SL_PLATFORM_EXTERNAL_SPAWN))
     cc3100_netapp(cc3100_driver &driver, cc3100_nonos &nonos);
 #else
     cc3100_netapp(cc3100_driver &driver);
@@ -1081,7 +1082,8 @@
 private:
 
     cc3100_driver           &_driver;
-#ifndef SL_PLATFORM_MULTI_THREADED    
+#if (!defined (SL_PLATFORM_MULTI_THREADED)) && (!defined (SL_PLATFORM_EXTERNAL_SPAWN))    
+//#ifndef SL_PLATFORM_MULTI_THREADED    
     cc3100_nonos            &_nonos;
 #endif
 
@@ -1098,7 +1100,8 @@
 
 public:
 
-#ifndef SL_PLATFORM_MULTI_THREADED
+//#ifndef SL_PLATFORM_MULTI_THREADED
+#if (!defined (SL_PLATFORM_MULTI_THREADED)) && (!defined (SL_PLATFORM_EXTERNAL_SPAWN))
     cc3100_flowcont(cc3100_driver &driver, cc3100_nonos &nonos);
 #else
     cc3100_flowcont(cc3100_driver &driver);
@@ -1117,7 +1120,8 @@
 private:
 
     cc3100_driver &_driver;
-#ifndef SL_PLATFORM_MULTI_THREADED    
+//#ifndef SL_PLATFORM_MULTI_THREADED
+#if (!defined (SL_PLATFORM_MULTI_THREADED)) && (!defined (SL_PLATFORM_EXTERNAL_SPAWN))    
     cc3100_nonos  &_nonos;
 #endif    
 
--- a/simplelink/cc3100_nonos.cpp	Thu Sep 03 20:10:39 2015 +0000
+++ b/simplelink/cc3100_nonos.cpp	Thu Sep 10 17:56:09 2015 +0000
@@ -43,8 +43,8 @@
 #include "cc3100_simplelink.h"
 #include "fPtr_func.h"
 
-#ifndef SL_PLATFORM_MULTI_THREADED
-
+//#ifndef SL_PLATFORM_MULTI_THREADED
+#if (!defined (SL_PLATFORM_MULTI_THREADED)) && (!defined (SL_PLATFORM_EXTERNAL_SPAWN))
 #include "cc3100_nonos.h"
 
 namespace mbed_cc3100 {
@@ -146,6 +146,7 @@
 
 _SlNonOsRetVal_t cc3100_nonos::_SlNonOsMainLoopTask(void)
 {
+    printf("_SlNonOsMainLoopTask\r\n");
     int8_t i = 0;
       	
 #ifndef SL_TINY_EXT
--- a/simplelink/cc3100_nonos.h	Thu Sep 03 20:10:39 2015 +0000
+++ b/simplelink/cc3100_nonos.h	Thu Sep 10 17:56:09 2015 +0000
@@ -43,7 +43,8 @@
 /* Macro declarations                                                        */
 /*****************************************************************************/
 
-#ifndef SL_PLATFORM_MULTI_THREADED
+//#ifndef SL_PLATFORM_MULTI_THREADED
+#if (!defined (SL_PLATFORM_MULTI_THREADED)) && (!defined (SL_PLATFORM_EXTERNAL_SPAWN))
 
 namespace mbed_cc3100 {
 
--- a/simplelink/cc3100_socket.cpp	Thu Sep 03 20:10:39 2015 +0000
+++ b/simplelink/cc3100_socket.cpp	Thu Sep 10 17:56:09 2015 +0000
@@ -74,7 +74,8 @@
     (1440 - SL_SOCKET_PAYLOAD_BASE)  /* Default */
 };	
 
-#ifndef SL_PLATFORM_MULTI_THREADED
+//#ifndef SL_PLATFORM_MULTI_THREADED
+#if (!defined (SL_PLATFORM_MULTI_THREADED)) && (!defined (SL_PLATFORM_EXTERNAL_SPAWN))
 cc3100_socket::cc3100_socket(cc3100_driver &driver, cc3100_nonos &nonos)
     : _driver(driver), _nonos(nonos)
 {
--- a/simplelink/cc3100_socket.h	Thu Sep 03 20:10:39 2015 +0000
+++ b/simplelink/cc3100_socket.h	Thu Sep 10 17:56:09 2015 +0000
@@ -631,7 +631,8 @@
 
 public:
 
-#ifndef SL_PLATFORM_MULTI_THREADED
+//#ifndef SL_PLATFORM_MULTI_THREADED
+#if (!defined (SL_PLATFORM_MULTI_THREADED)) && (!defined (SL_PLATFORM_EXTERNAL_SPAWN))
     cc3100_socket(cc3100_driver &driver, cc3100_nonos &nonos);
 #else
     cc3100_socket(cc3100_driver &driver);
@@ -1549,7 +1550,8 @@
 private:
 
     cc3100_driver   &_driver;
-#ifndef SL_PLATFORM_MULTI_THREADED    
+//#ifndef SL_PLATFORM_MULTI_THREADED 
+#if (!defined (SL_PLATFORM_MULTI_THREADED)) && (!defined (SL_PLATFORM_EXTERNAL_SPAWN))   
     cc3100_nonos    &_nonos;
 #endif    
     
--- a/simplelink/cc3100_spawn.cpp	Thu Sep 03 20:10:39 2015 +0000
+++ b/simplelink/cc3100_spawn.cpp	Thu Sep 10 17:56:09 2015 +0000
@@ -49,8 +49,7 @@
 
 #define _SL_MAX_INTERNAL_SPAWN_ENTRIES      10
 
-cc3100 _cc3100(PC_13, PC_6, PE_5, PE_4, PE_6, SPI(PB_5, PB_4, PB_3));
-
+cc3100 _cc3100(NC, NC, PD_12, PD_13, PD_11, SPI(PB_5, PB_4, PB_3));//Seeed_Arch_Max  irq, nHib, cs, mosi, miso, sck
 
 typedef struct _SlInternalSpawnEntry_t {
     _SlSpawnEntryFunc_t 		        pEntry;
--- a/simplelink/cc3100_spi.cpp	Thu Sep 03 20:10:39 2015 +0000
+++ b/simplelink/cc3100_spi.cpp	Thu Sep 10 17:56:09 2015 +0000
@@ -54,7 +54,7 @@
     : /*_sw1_irq(button1_irq), _sw2_irq(button2_irq),*/ _wlan_irq(cc3100_irq), _wlan_nHIB(cc3100_nHIB), _wlan_cs(cc3100_cs), _wlan_spi(cc3100_spi), _driver(driver)
 {
 
-    _wlan_spi.format(8,0);//Note Mode 0
+    _wlan_spi.format(8,0);//Note: 8 bit Mode 0
     _wlan_spi.frequency(12000000);
     _wlan_irq.rise(this, &cc3100_spi::IntSpiGPIOHandler);      //_SlDrvRxIrqHandler is called from IntSpiGPIOHandler
 //    _sw1_irq.rise(this, &cc3100_spi::buttonHandler_1);
@@ -77,7 +77,7 @@
     // Disable WLAN Interrupt ...
     cc3100_InterruptDisable();
     
-    return NONOS_RET_OK;
+    return 0;
 }
 
 void cc3100_spi::button1_InterruptDisable()
@@ -129,7 +129,7 @@
     // Enable WLAN interrupt
     cc3100_InterruptEnable();
 
-    return NONOS_RET_OK;
+    return 0;
 }
 
 int cc3100_spi::spi_Write(Fd_t fd, uint8_t *pBuff, int len)
@@ -137,12 +137,12 @@
     int len_to_return = len;
     
     _wlan_cs = 0;
-  
+//    wait_us(10);
     while(len) {
         _wlan_spi.write(*pBuff++);
         len--;
     }
-
+//    wait_us(10);
     _wlan_cs = 1;
     
     return len_to_return;
@@ -153,11 +153,11 @@
     int i = 0;
 
     _wlan_cs = 0;
-
+//    wait_us(10);
     for (i = 0; i < len; i++) {
         pBuff[i] = _wlan_spi.write(0xFF);
     }
-
+//    wait_us(10);
     _wlan_cs = 1;
     return len;
 }
--- a/simplelink/cc3100_trace.h	Thu Sep 03 20:10:39 2015 +0000
+++ b/simplelink/cc3100_trace.h	Thu Sep 10 17:56:09 2015 +0000
@@ -101,14 +101,14 @@
 #endif
 
 #if (SL_NWP_IF_HANDLING == SL_HANDLING_ASSERT)
-//#define NWP_IF_WRITE_CHECK(fd,pBuff,len)       { int16_t RetSize, ExpSize = (len); RetSize = sl_IfWrite((fd),(pBuff),ExpSize); _SL_ASSERT(ExpSize == RetSize)}
-//#define NWP_IF_READ_CHECK(fd,pBuff,len)        { int16_t RetSize, ExpSize = (len); RetSize = sl_IfRead((fd),(pBuff),ExpSize);  _SL_ASSERT(ExpSize == RetSize)}
+#define NWP_IF_WRITE_CHECK(fd,pBuff,len)       { int16_t RetSize, ExpSize = (len); RetSize = sl_IfWrite((fd),(pBuff),ExpSize); _SL_ASSERT(ExpSize == RetSize)}
+#define NWP_IF_READ_CHECK(fd,pBuff,len)        { int16_t RetSize, ExpSize = (len); RetSize = sl_IfRead((fd),(pBuff),ExpSize);  _SL_ASSERT(ExpSize == RetSize)}
 #elif (SL_NWP_IF_HANDLING == SL_HANDLING_ERROR)
-//#define NWP_IF_WRITE_CHECK(fd,pBuff,len)       { _SL_ERROR((len == sl_IfWrite((fd),(pBuff),(len))), SL_RET_CODE_NWP_IF_ERROR);}
-//#define NWP_IF_READ_CHECK(fd,pBuff,len)        { _SL_ERROR((len == sl_IfRead((fd),(pBuff),(len))),  SL_RET_CODE_NWP_IF_ERROR);}
+#define NWP_IF_WRITE_CHECK(fd,pBuff,len)       { _SL_ERROR((len == sl_IfWrite((fd),(pBuff),(len))), SL_RET_CODE_NWP_IF_ERROR);}
+#define NWP_IF_READ_CHECK(fd,pBuff,len)        { _SL_ERROR((len == sl_IfRead((fd),(pBuff),(len))),  SL_RET_CODE_NWP_IF_ERROR);}
 #else
-//#define NWP_IF_WRITE_CHECK(fd,pBuff,len)       { sl_IfWrite((fd),(pBuff),(len));}
-//#define NWP_IF_READ_CHECK(fd,pBuff,len)        { sl_IfRead((fd),(pBuff),(len));}
+#define NWP_IF_WRITE_CHECK(fd,pBuff,len)       { sl_IfWrite((fd),(pBuff),(len));}
+#define NWP_IF_READ_CHECK(fd,pBuff,len)        { sl_IfRead((fd),(pBuff),(len));}
 #endif
 
 #if (SL_OSI_RET_OK_HANDLING == SL_HANDLING_ASSERT)
--- a/simplelink/cc3100_user.h	Thu Sep 03 20:10:39 2015 +0000
+++ b/simplelink/cc3100_user.h	Thu Sep 10 17:56:09 2015 +0000
@@ -497,7 +497,7 @@
 
     \warning
 */
-//#define sl_IfRead                           _spi->spi_Read
+#define sl_IfRead                           _spi.spi_Read
 
 /*!
     \brief attempts to write up to len bytes to the SPI channel
@@ -527,7 +527,7 @@
 
     \warning
 */
-//#define sl_IfWrite                          _spi->spi_Write
+#define sl_IfWrite                          _spi.spi_Write
 
 /*!
     \brief 		register an interrupt handler routine for the host IRQ
@@ -713,7 +713,7 @@
  */
 
 
-//#define SL_PLATFORM_MULTI_THREADED
+#define SL_PLATFORM_MULTI_THREADED
 
 
 #ifdef SL_PLATFORM_MULTI_THREADED
--- a/utils/app_config.h	Thu Sep 03 20:10:39 2015 +0000
+++ b/utils/app_config.h	Thu Sep 10 17:56:09 2015 +0000
@@ -33,9 +33,9 @@
 #define sensor_addr  0x78
 #endif
 
-#define SPAWN_TASK_PRIORITY            7//9
-#define HTTP_SERVER_APP_TASK_PRIORITY  5//1
-#define CAMERA_SERVICE_PRIORITY        5
+#define SPAWN_TASK_PRIORITY            9//9
+#define HTTP_SERVER_APP_TASK_PRIORITY  3//1
+#define CAMERA_SERVICE_PRIORITY        3
 #define OSI_STACK_SIZE                 8 * 1024
 
 //*****************************************************************************