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.

CC3100 uart interface

Other Parts Discussed in Thread: CC3100, CC3100MODBOOST

Hi,

i'm using uart interface for CC3100.

I'm arrive al sl_accept command, i pink my device, i connect with a program from PC, but i'm stopped in this while:

" _SlDrvSyncObjWaitForever(&g_pCB->ObjPool[ObjIdx].SyncObj);".

I don't undertand?

Below my sl_accept function:

//////--------------------

_SocketAddrResponse_u   AsyncRsp_A;
_i16 sl_Accept(_i16 sd, SlSockAddr_t *addr, SlSocklen_t *addrlen)
{
 _SlSockAcceptMsg_u      Msg;
    _SlReturnVal_t          RetVal;
    //_SocketAddrResponse_u   AsyncRsp;

 _u8 ObjIdx = MAX_CONCURRENT_ACTIONS;


    MsgAc.Cmd.sd = (_u8)sd;
    MsgAc.Cmd.family = (sizeof(SlSockAddrIn_t) == *addrlen) ? SL_AF_INET : SL_AF_INET6;
// MsgAc.Cmd.padding1 = 1;//MC141015

  ObjIdx = _SlDrvProtectAsyncRespSetting((_u8*)&AsyncRsp_A, ACCEPT_ID, sd  & BSD_SOCKET_ID_MASK ); 

    if (MAX_CONCURRENT_ACTIONS == ObjIdx)
    {
        return SL_POOL_IS_EMPTY;
    }
   
 /* send the command */
 //   VERIFY_RET_OK(_SlDrvCmdOp((_SlCmdCtrl_t *)&_SlAcceptCmdCtrl, &MsgAc, NULL));
      RetVal = (_SlDrvCmdOp((_SlCmdCtrl_t *)&_SlAcceptCmdCtrl, &MsgAc, NULL));
    _SL_ASSERT((_SlReturnVal_t)SL_OS_RET_CODE_OK == RetVal)

    VERIFY_PROTOCOL(MsgAc.Rsp.sd == sd);

    RetVal = MsgAc.Rsp.statusOrLen;

    if(SL_OS_RET_CODE_OK == RetVal)
    {
        /* wait for async and get Data Read parameters */
        _SlDrvSyncObjWaitForever(&g_pCB->ObjPool[ObjIdx].SyncObj);
       
        VERIFY_PROTOCOL(AsyncRsp_A.IpV4.sd == sd);

        RetVal = AsyncRsp_A.IpV4.statusOrLen;
        if( (NULL != addr) && (NULL != addrlen) ) 
        {
#if 0 /*  Kept for backup */
            _sl_ParseAddress(&AsyncRsp_A, addr, addrlen);
#else
        addr->sa_family = AsyncRsp_A.IpV4.family;

         if(SL_AF_INET == addr->sa_family)
         {
              if( *addrlen == sizeof( SlSockAddrIn_t ) )
              {
                ((SlSockAddrIn_t *)addr)->sin_port         = AsyncRsp_A.IpV4.port;
                ((SlSockAddrIn_t *)addr)->sin_addr.s_addr  = AsyncRsp_A.IpV4.address;
              }
              else
              {
                *addrlen = 0;
              }
         }
         else if (SL_AF_INET6_EUI_48 == addr->sa_family )
         {
                if( *addrlen == sizeof( SlSockAddrIn6_t ) )
              {
                ((SlSockAddrIn6_t *)addr)->sin6_port                   = AsyncRsp_A.IpV6EUI48.port    ;
                /*  will be called from here and from _sl_BuildAddress*/
                sl_Memcpy(((SlSockAddrIn6_t *)addr)->sin6_addr._S6_un._S6_u8, AsyncRsp_A.IpV6EUI48.address, 6);
              }
              else
              {
                *addrlen = 0;
              }
         }
#ifdef SL_SUPPORT_IPV6
         else
         {
              if( *addrlen == sizeof( sockaddr_in6 ) )
              {
             ((sockaddr_in6 *)addr)->sin6_port                   = AsyncRsp.IpV6.port    ;
             sl_Memcpy(((sockaddr_in6 *)addr)->sin6_addr._S6_un._S6_u32, AsyncRsp_A.IpV6.address, 16);
              }
              else
              {
                *addrlen = 0;
              }
         }
#endif
#endif   
        }
    }

    _SlDrvReleasePoolObj(ObjIdx);
    return (_i16)RetVal;
}

//-------------------------

sd = 0x0010

addrlen = 0x10

someone could halp me?

thanks

  • Hi,

    From what you describe it seems sl_accept() is waiting for TCP connection from a client.

    Can you elaborate the test fixture? Are you trying to connect from a client to CC3100 which is connected as a server?

    Shlomi

  • Hi,
    thanks for your reply.
    I'have a PC, connected at the same access point of the CC3100.
    i run a software, Hercules, installed on PC , from this software i try to create a connection by TCP Client to CC3100 module.
    The software reply to me that che modulo is connected, but my FW is blocked in
    " _SlDrvSyncObjWaitForever(&g_pCB->ObjPool[ObjIdx].SyncObj);".

    In my FW i use a "case" machine for connect the CC3100:

    while (1)
    {
    Delay20ms(2);//MC161015




    switch(wFC_Phase_CC3100)
    {
    case wFC_INIT_DRIVER:
    {
    while(graphline||stepcnt);
    if(wifi_debug == TRUE) //MA250315
    {
    MoveMess((BYTE*)"Init CC3100...", PRINT); //MA030315
    while(graphline||stepcnt);

    }

    //--------------------------- //ES201212
    //---------------------------


    InfoWlan_CC3100.ulCC3X00Connected = 0;
    InfoWlan_CC3100.ulCC3X00Shutdown = 0;

    //Start CC3000 State Machine
    resetCC3X00StateMachine();
    //Initializes a CC3100 device
    //retVal = configureSimpleLinkToDefaultState(); //MA030215

    retVal__ = initDriver_CC3100(ROLE_STA); //MA270215
    if(retVal__ < 0)
    {
    retVal__ = 0x45;//MC080415 debug
    break; //MA030315
    }

    //non spostare, deve eseere eseguito dopo initDriver_CC3100()
    InfoWlan_CC3100.reboot = FALSE;
    InfoWlan_CC3100.reset = FALSE;
    InfoWlan_CC3100.n_retry = 0; //ES170314

    if(wifi_debug == TRUE) //MA250315
    {
    MoveMess((BYTE*)"Init OK!", PRINT); //MA030315
    while(graphline||stepcnt);
    }

    wFC_Phase_CC3100++;

    break;
    }

    case wFC_SSID_ASSOC_AP:
    {

    if(wifi_debug == TRUE) //MA250315
    {
    MoveMess((BYTE*)"Attesa Connessione...", PRINT); //MA030315
    while(graphline||stepcnt);
    }
    /* Connecting to WLAN AP */
    //retVal__ = ConnectUsingSSID_CC3100(Dev.SSID, Dev.SecKey, Dev.SecType); //MA160215
    retVal__ = establishConnectionWithAP();
    if(wifi_debug == TRUE) //MA250315
    {
    if(retVal__ == SL_ERROR_INVALID_SECURITY_TYPE)
    MoveMess((BYTE*)"Invalid Security Type!", PRINT); //MA250315
    else if(retVal__ == SL_ERROR_PASSWORD_ERROR)
    MoveMess((BYTE*)"Password Error!", PRINT); //MA250315
    else if(retVal__ == SL_ERROR_SSID_LEN_ERROR)
    MoveMess((BYTE*)"SSID Len Error!", PRINT); //MA250315
    else if(retVal__ == SL_ERROR_INVALID_POLICY_TYPE)
    MoveMess((BYTE*)"Invalid Policy Type!", PRINT); //MA250315
    //wait_print_end(NU_SUSPEND); //MA250315
    while(graphline||stepcnt); //MC270315
    }
    if( (retVal__ < 0) && (retVal__ != SL_ERROR_INVALID_SECURITY_TYPE) && (retVal__ != SL_ERROR_WIFI_NOT_CONNECTED) ) //MA250315
    {

    InfoWlan_CC3100.reboot = TRUE; //MA250215
    }

    wFC_timeout_CC3100 = 0;
    if (InfoWlan_CC3100.reboot)
    wFC_Phase_CC3100 = wFC_INIT_DRIVER;
    else
    wFC_Phase_CC3100++;




    break;
    }

    case wFC_WAIT_ASSOC_AP:
    {
    if( (IS_CONNECTED(g_Status)) && (IS_IP_ACQUIRED(g_Status))) //MA050315
    // (0 != (g_Status & ((unsigned long)1<<(STATUS_BIT_CONNECTION)))) )

    {


    // WLAN explicity connection DONE
    //------------------------------------------
    if ( (Dev.WlanSet == FALSE) || (InfoWlan_CC3100.n_retry >= WLAN_CONNECT_MAX_RETRY) ) //ES170314
    {
    /* Restart the device */
    // reset the CC3100
    retVal__ = sl_Stop(SL_STOP_TIMEOUT); //wlan_stop(); //MA170215
    //NU_Sleep(12); //MA020315
    Delay20ms(2); //MC270315

    retVal__ = sl_Start(0, 0, 0); //wlan_start(0); //MA170215
    /* MC19105*/
    InfoWlan_CC3100.ulCC3X00Connected = 0;
    InfoWlan_CC3100.ulCC3X00Shutdown = 0;
    //////-------********


    //MoveMess((BYTE*)"30!", PRINT); //MA030315
    //while(graphline||stepcnt);

    // Set Fast Connect, the CC3000 device tries to automatically to reconnect to the last AP connected
    //wlan_ioctl_set_connection_policy(0, 1, 0);
    /*
    * Set connection policy to Fast - Device will connect to the last connected AP.
    * This feature can be used to reconnect to AP
    */
    retVal__ = sl_WlanPolicySet(SL_POLICY_CONNECTION, SL_CONNECTION_POLICY(1, 1, 0, 0, 0), 0, 0); //MA170215
    // retVal__ = sl_WlanPolicySet(SL_POLICY_CONNECTION, SL_CONNECTION_POLICY(1, 1, 0, 0, 0), 0, 0); //MA170215 MC191015
    if(wifi_debug == TRUE)
    {
    MoveMess((BYTE*)"31!", PRINT); //MA030315
    while(graphline||stepcnt);
    }
    if(wifi_time == TRUE)
    {
    Delay20ms(TIMEDEBWIFI);
    }

    if(retVal__ < 0)
    while(1); //MA030215


    if (Dev.WlanSet == FALSE) //ES170314
    {
    U8 newval = TRUE;
    // SaveParamNetItf(Dev.WlanSet, newval);
    }
    }
    //------------------------------------------

    if(wifi_debug == TRUE) //MA250315
    {
    MoveMess((BYTE*)"Connesso to: ", NOPRINT); //MA030315
    MoveMess((U8*)&Dev.SSID,PRINT); //MA090315
    while(graphline||stepcnt);
    }

    //reset wlan connect retry //ES170314
    InfoWlan_CC3100.n_retry = 0;

    wFC_Phase_CC3100++;

    }
    //else if (wFC_timeout_CC3100 > 250)

    else if (wFC_timeout_CC3100 > 1000) //MA250315
    {
    wFC_Phase_CC3100 = wFC_SSID_ASSOC_AP;
    InfoWlan_CC3100.n_retry++; //ES170314

    }

    break;
    }

    case wFC_WAIT_IP_ADDRESS:
    {
    /* Wait for the connection to be established */
    if(wifi_debug == TRUE)
    {
    MoveMess((BYTE*)"40!", PRINT); //MA030315
    while(stepcnt||graphline);
    }
    if(wifi_time == TRUE)
    {
    Delay20ms(TIMEDEBWIFI);
    }

    _SlNonOsMainLoopTask(); //MA090315
    //if (currentCC3X00State() & CC3X00_IP_ALLOC)
    if(wifi_debug == TRUE)
    {
    MoveMess((BYTE*)"41!", PRINT); //MA030315
    while (graphline||stepcnt);
    }
    if(wifi_time == TRUE)
    {
    Delay20ms(TIMEDEBWIFI);
    }

    if(IS_IP_ACQUIRED(g_Status)) //MA170215
    {
    if(wifi_debug == TRUE) //MA250315
    {
    MoveMess((BYTE*)"IPv4 ok: ", NOPRINT); //MA090315

    btoa (Dev.LocalIp[0], stringaux, 10);
    //MoveMess((U8*)&Dev.LocalIp,PRINT); //MA090315
    MoveMess((U8*)&stringaux,NOPRINT);
    MoveMess((BYTE*)".", NOPRINT); //MA030315
    btoa (Dev.LocalIp[1], stringaux, 10);
    //MoveMess((U8*)&Dev.LocalIp,PRINT); //MA090315
    MoveMess((U8*)&stringaux,NOPRINT);
    MoveMess((BYTE*)".", NOPRINT); //MA030315


    btoa (Dev.LocalIp[2], stringaux, 10);
    //MoveMess((U8*)&Dev.LocalIp,PRINT); //MA090315
    MoveMess((U8*)&stringaux,NOPRINT);
    MoveMess((BYTE*)".", NOPRINT); //MA030315

    btoa (Dev.LocalIp[3], stringaux, 10);
    //MoveMess((U8*)&Dev.LocalIp,PRINT); //MA090315
    MoveMess((U8*)&stringaux,PRINT);


    while (graphline||stepcnt);
    }





    //retVal__ = sl_WlanProfileGet(SavedIndex, SavedSSID, &SSIDLenght, &SavedMAC, &SavedSecParams, &SavedSecExtParams, &SavedPriority);
    retVal__ = sl_WlanProfileGet(0, SavedSSID, &SSIDLenght, &SavedMAC, &SavedSecParams, &SavedSecExtParams, &SavedPriority);
    if(retVal__ < 0)
    while(1); //MA030215

    Dev.SecType = 0; //MA190215
    //Dev.SecKey = SavedSecParams.Key; //La Key non può essere letta x ragioni di sicurezza //MA250215

    for(SavedIndex=0; SavedIndex<(NAME_SZ+1); SavedIndex++) //MA260215
    {
    Dev.SSID[SavedIndex] = SavedSSID[SavedIndex]; //MA260215
    }



    if (Dev.DHCPEn)
    {
    //NU_Sleep(15); //MA260215
    Delay20ms(10); //MC270315
    //-------------- MC210415
    //ipV4Savedlen =sizeof(ipV4Saved); //MA260215 mod
    //retVal = sl_NetCfgGet(SL_IPV4_STA_P2P_CL_GET_INFO, &dhcpIsOn, &ipV4Savedlen, (_u8*)&ipV4Saved); //MA250215
    ipV4Savedlen =sizeof(ipV4Temp);
    retVal__ = sl_NetCfgGet(SL_IPV4_STA_P2P_CL_GET_INFO, &dhcpIsOn, &ipV4Savedlen, (_u8*)&ipV4Temp);

    ipV4Saved.ipV4 = ipV4Temp.ipV4;
    ipV4Saved.ipV4Mask = ipV4Temp.ipV4Mask;
    ipV4Saved.ipV4Gateway = ipV4Temp.ipV4Gateway;
    ipV4Saved.ipV4DnsServer = ipV4Temp.ipV4DnsServer;




    //--------------------------
    #ifdef WIFI_DEBUG //MA220315
    if(retVal__ < 0)
    flaf = 0x51; //while(1); //MA220315 trappola
    #endif


    }

    wFC_Phase_CC3100++;

    InfoWlan_CC3100.serverErrorCode = 0;

    }
    break;
    }

    case wFC_INIT_SERVER_TCP:
    {
    if(wifi_debug == TRUE) //MA250315
    {
    MoveMess((BYTE*)"Init TCP Server...", PRINT); //MA030315
    while(graphline||stepcnt);
    }
    if(wifi_time == TRUE)
    {
    Delay20ms(TIMEDEBWIFI);
    }

    initServer_CC3100();

    if ((currentCC3X00State() & TCP_SERVER_INIT) == 0)
    {
    InfoWlan_CC3100.ulCC3X00Connected = 0;
    wFC_Phase_CC3100 = wFC_SHUTDOWN_SERVER;
    }
    else
    wFC_Phase_CC3100++;


    break;
    }

    case wFC_INIT_CONNECTION_SOCKET:
    {



    if(wifi_debug == TRUE) //MA250315
    {
    MoveMess((BYTE*)"Waiting Socket TCP...", PRINT); //MA030315
    while(graphline||stepcnt);
    }
    wFC_Phase_CC3100++;


    break;
    }

    case wFC_ACCEPT_CONNECTION_SOCKET:
    {
    //clilen = sizeof(clientAddr);
    // enable_int();
    clilen = sizeof(SlSockAddrIn_t); //MA180215
    Delay20ms(100); //
    //cliemsDescriptor_CC3100 = accept(SocketTCP_CC3100, (sockaddr *) &clientAddr, &clilen);

    //MC211015 clientDescriptor_CC3100 = sl_Accept(SocketTCP_CC3100, ( struct SlSockAddr_t *)&clientAddr, (SlSocklen_t*)&clilen); //MA170215
    //------
    Status__ = sl_SetSockOpt (SocketTCP_CC3100, SL_SOL_SOCKET, SL_SO_NONBLOCKING, &nonBlocking,
    sizeof(nonBlocking));
    while( newSockID < 0 )
    {
    newSockID = sl_Accept(SocketTCP_CC3100, ( struct SlSockAddr_t*) &clientAddr, (SlSocklen_t*) &clilen) ;
    if( newSockID == SL_EAGAIN )
    {
    /* Wait for 1 ms */
    Delay1ms(1);
    }
    else if( newSockID < 0 )
    {
    return -1;
    }
    }
    //------

    //newSockID = sl_Accept(SockID, ( struct SlSockAddr_t *)&Addr, (SlSocklen_t*)&AddrSize); //MA180215
    //
    // Handle any un-solicited event if required - the function shall be triggered
    // few times in a second
    //

    /*
    if (clientDescriptor_CC3100 == SOCKET_INACTIVE_ERR)
    {
    wFC_Phase_CC3100 = wFC_SOCKET_ERROR;
    break;
    }
    else */
    //if ( (clientDescriptor_CC3100 != -1) && (clientDescriptor_CC3100 != -2) )
    if ( (clientDescriptor_CC3100 != SL_POOL_IS_EMPTY) && (clientDescriptor_CC3100 != SL_EAGAIN) ) //MA230215
    {
    if(wifi_debug == TRUE) //MA250315
    MoveMess((BYTE*)"Socket TCP Open.", PRINT); //MA030315

    wFC_Phase_CC3100 = wFC_CONNECTION_SOCKET_HANDLE;
    }
    else
    break;
    }

    case wFC_CONNECTION_SOCKET_HANDLE:
    {

    long optvalue_block = 1; // Enable/disable nonblocking mode
    //unsigned long timeout = 0;

    setCC3X00MachineState(TCP_CLIENT_CONNECTED); //compatibilità con CC3000

    // Connection Accepted, Wait for data exchange

    // set RECV non blocking
    //setsockopt(clientDescriptor_CC3100, SOL_SOCKET, SOCKOPT_RECV_NONBLOCK, &optvalue_block, sizeof(optvalue_block));
    /*retVal*/fiag = sl_SetSockOpt(clientDescriptor_CC3100, SL_SOL_SOCKET, SL_SO_NONBLOCKING, &optvalue_block, sizeof(optvalue_block)) ; //MA170215
    if(/*retVal*/fiag < 0)
    while(1);
    /*Sets the timeout value that specifies the maximum amount of time an input function waits until it completes.
    timeVal.tv_sec = Dev.TCPTimeout; // 30 Seconds //MA270215
    timeVal.tv_usec = 0; // Microseconds. 10000 microseconds resolution //MA270215
    retVal = sl_SetSockOpt(clientDescriptor_CC3100, SL_SOL_SOCKET, SL_SO_RCVTIMEO, (_u8 *)&timeVal, sizeof(timeVal)); // Enable receive timeout //MA270215
    if(retVal < 0)
    while(1);
    */

    //interface = WIFI;

    SelectInterface(1); /* Select Ethernet Interface */

    //reset flag
    disable_int();
    statusreg3 &= ~BSD_TCP_CLOSE;
    enable_int();

    wFC_Phase_CC3100 = wFC_SHUTDOWN_SERVER;

    break;
    }

    case wFC_SHUTDOWN_SERVER:
    {

    if( (InfoWlan_CC3100.ulCC3X00Connected == FALSE) || (InfoWlan_CC3100.ForceShutdown) ) //MA250215 mod
    //if(!(IS_CONNECTED(g_Status))) //MA180215
    {

    if ( (InfoWlan_CC3100.serverErrorCode == SERV_ERR_SOCKET) || (InfoWlan_CC3100.reset) )
    {
    wFC_Phase_CC3100 = wFC_INIT_DRIVER;
    }
    else
    {
    wFC_Phase_CC3100 = wFC_SSID_ASSOC_AP;

    InfoWlan_CC3100.n_retry = WLAN_CONNECT_MAX_RETRY; //ES170314

    //-------------------------------- //ES201212
    //--------------------------------
    }

    if (clientDescriptor_CC3100 >= 0)
    {
    //if (USBIO.INTSTS0.BIT.VBSTS)
    if (USBFM.IFR1.BIT.VBUS_MN) //USB Bus Connected //MA170714
    isUsbdSetConfiguration = TRUE;

    disable_int();
    interface = NONE;
    enable_int();
    }

    //shutdown sockets
    shutdownSocket_CC3100(&clientDescriptor_CC3100);
    shutdownSocket_CC3100(&SocketTCP_CC3100);
    shutdownSocket_CC3100(&SocketUDP_CC3100);

    unsetCC3X00MachineState(TCP_SERVER_INIT); //MA030315

    //Wlan STOP
    //------------------------
    if (InfoWlan_CC3100.reset)
    {
    sl_Stop(SL_STOP_TIMEOUT); //wlan_stop(); //MA170215
    InfoWlan_CC3100.reset = FALSE;
    }
    //------------------------

    InfoWlan_CC3100.serverErrorCode = 0;
    InfoWlan_CC3100.ulCC3X00Shutdown = FALSE;
    InfoWlan_CC3100.ForceShutdown = 0; //MA260215
    }

    break;
    }
    }
    // /*MC161015 provo
    if (InfoWlan_CC3100.ulCC3X00Shutdown)
    {
    wFC_Phase_CC3100 = wFC_SHUTDOWN_SERVER;
    InfoWlan_CC3100.ulCC3X00Shutdown = FALSE;
    }
    // */
    // flag_wait = 0;

    }





    i arrive until "case wFC_ACCEPT_CONNECTION_SOCKET:"


    thanks.
    Marco
  • Hi,

    The switch case does not show some steps that are important such as creation of the main socket (sl_socket), binding and listening to connections. I guess you have it somewhere in your code.

    Also, are you working in block mode or not? I suppose you are blocked according to your first post, right?

    From what you describe, the client indicates it is connected so on TCP level, CC3100 network processor completed the negotiation and should only send an event back to the host - releasing the sl_accept().

    Can you run the tcp_socket example code and suggest if you have the same issue?

    Shlomi

  • Hi,

    this is the reply to your first question:

    _i32 initServer_CC3100(void) //MA170215
    {
    SlSockAddrIn_t LocalAddr;
    SlSocklen_t clilen; //MA160315

    _u16 a;
    _u16 AddrSize = 0;

    _i16 recvSize = 0;
    _u16 Port;
    _u16 app;
    _u32 app_1 = 0;
    long optvalue_tcp = 1; // Enable/disable nonblocking mode
    _u32 flaf2,flaf1;


    Port = PORT_NUM; //PORT_NUM = 9100 //MA170215

    clientDescriptor_CC3100 = -1; //newSockID //MA180215
    SocketTCP_CC3100 = 0; //socket TCP //SockID //MA180215
    SocketUDP_CC3100 = 0; //socket UDP //MA180215

    LocalAddr.sin_family = SL_AF_INET;
    LocalAddr.sin_port = sl_Htons((_u16)Port); //MC100415



    LocalAddr.sin_addr.s_addr = 0;
    SocketTCP_CC3100 = sl_Socket(SL_AF_INET,SL_SOCK_STREAM, SL_IPPROTO_TCP); //MA190215
    if( SocketTCP_CC3100 < 0 )
    {
    serverError_CC3100(SERV_ERR_SOCKET); //MA170215
    //CLI_Write(" [TCP Server] Create socket Error \n\r");
    ASSERT_ON_ERROR(SocketTCP_CC3100);
    }

    AddrSize = sizeof(SlSockAddrIn_t);
    Status_ = sl_Bind(SocketTCP_CC3100, (SlSockAddr_t *)&LocalAddr, AddrSize);
    if( Status_ < 0 )
    {
    sl_Close(SocketTCP_CC3100);
    serverError_CC3100(SERV_ERR_BIND); //MA170215
    //CLI_Write(" [TCP Server] Socket address assignment Error \n\r");
    ASSERT_ON_ERROR(Status_);
    }

    Status_ = sl_Listen(SocketTCP_CC3100, 0);
    if( Status_ < 0 )
    {
    sl_Close(SocketTCP_CC3100);
    serverError_CC3100(SERV_ERR_LISTEN); //MA170215
    //CLI_Write(" [TCP Server] Listen Error \n\r");
    ASSERT_ON_ERROR(Status_);
    }

    //Serve x mettere in NONBLOCKING sl_accept() chiamata in seguito
    //----- MC151015
    app_1 = ( optvalue_tcp & 0x000000FF) << 24;
    app_1 |= ( optvalue_tcp & 0x0000FF00 ) << 8;
    app_1 |= ( optvalue_tcp & 0x00FF0000 ) >> 8;
    app_1 |= ( optvalue_tcp & 0xFF000000 )>> 24;

    optvalue_tcp = app_1;
    //------ MC151015
    Status_ = sl_SetSockOpt(SocketTCP_CC3100, SL_SOL_SOCKET, SL_SO_NONBLOCKING, &(optvalue_tcp), sizeof(optvalue_tcp)) ; //MA230215 MC151015
    if(Status_ < 0)
    ASSERT_ON_ERROR(Status_); //while(1); //MA240315
    setCC3X00MachineState(TCP_SERVER_INIT); //compatibilità con CC3000 //MA170215


    return SUCCESS;
    }


    Could you send me tcp_socket example code ?
    Where can i try it?

    thanks a lot.
    Marco
  • CC3100 SDK can be found under http://www.ti.com/tool/cc3100sdk

    There are plenty of examples there but specifically you need the tcp_socket.

    Regards,

    Shlomi

  • Hi,

    i'm here......
    i find the example and i modify my souce code as below:


    case wFC_SSID_ASSOC_AP:
    {

    if(wifi_debug == TRUE) //MA250315
    {
    MoveMess((BYTE*)"Attesa Connessione...", PRINT); //MA030315
    while(graphline||stepcnt);
    }
    /* Connecting to WLAN AP */
    retVal__ = establishConnectionWithAP();
    if(wifi_debug == TRUE) //MA250315
    {
    if(retVal__ == SL_ERROR_INVALID_SECURITY_TYPE)
    MoveMess((BYTE*)"Invalid Security Type!", PRINT); //MA250315
    else if(retVal__ == SL_ERROR_PASSWORD_ERROR)
    MoveMess((BYTE*)"Password Error!", PRINT); //MA250315
    else if(retVal__ == SL_ERROR_SSID_LEN_ERROR)
    MoveMess((BYTE*)"SSID Len Error!", PRINT); //MA250315
    else if(retVal__ == SL_ERROR_INVALID_POLICY_TYPE)
    MoveMess((BYTE*)"Invalid Policy Type!", PRINT); //MA250315
    //wait_print_end(NU_SUSPEND); //MA250315
    while(graphline||stepcnt); //MC270315
    }
    if( (retVal__ < 0) && (retVal__ != SL_ERROR_INVALID_SECURITY_TYPE) && (retVal__ != SL_ERROR_WIFI_NOT_CONNECTED) ) //MA250315
    {
    //CLI_Write((_u8 *)" Failed to establish connection w/ an AP \n\r");

    InfoWlan_CC3100.reboot = TRUE; //MA250215
    }
    /**/

    retVal = BsdTcpClient(9100);


    i have insert "BsdTcpClient(9100)"

    _i32 BsdTcpClient(_u16 Port)
    {
    SlSockAddrIn_t Addr;

    _u16 idx = 0;
    _u16 AddrSize = 0;
    _i16 SockID = 0;
    _i16 Status = 0;
    _u16 LoopCount = 0;

    for (idx=0 ; idx<BUF_SIZE1 ; idx++)
    {
    BsdBuf[idx] = (_u8)(idx % 10);
    }

    Addr.sin_family = SL_AF_INET;
    Addr.sin_port = sl_Htons((_u16)Port);
    Addr.sin_addr.s_addr = sl_Htonl(0xC0A80196);
    AddrSize = sizeof(SlSockAddrIn_t);

    SockID = sl_Socket(SL_AF_INET,SL_SOCK_STREAM, 0);
    if( SockID < 0 )
    {
    MoveMess((BYTE*)" [TCP Client] Create socket Error",PRINT);
    ASSERT_ON_ERROR(SockID);
    }

    Status = sl_Connect(SockID, ( SlSockAddr_t *)&Addr, AddrSize);
    if( Status < 0 )
    {
    sl_Close(SockID);
    MoveMess((BYTE*)" [TCP Client] TCP connection Error",PRINT);
    ASSERT_ON_ERROR(Status);
    }

    while (LoopCount < NO_OF_PACKETS)
    {
    Status = sl_Send(SockID, BsdBuf, BUF_SIZE1, 0 );
    if( Status <= 0 )
    {
    MoveMess((BYTE*)" [TCP Client] Data send Error",PRINT);
    Status = sl_Close(SockID);
    ASSERT_ON_ERROR(TCP_SEND_ERROR);
    }

    LoopCount++;
    }

    Status = sl_Close(SockID);
    ASSERT_ON_ERROR(Status);

    return SUCCESS;
    }


    but when ariived to sl_connect

    _i16 sl_Connect(_i16 sd, const SlSockAddr_t *addr, _i16 addrlen)
    {
    _SlSockConnectMsg_u Msg;
    _SlReturnVal_t RetVal;
    _SlCmdCtrl_t CmdCtrl = {0, 0, sizeof(_SocketResponse_t)};
    _SocketResponse_t AsyncRsp;
    _u8 ObjIdx = MAX_CONCURRENT_ACTIONS;


    switch(addr->sa_family)
    {
    case SL_AF_INET :
    CmdCtrl.Opcode = SL_OPCODE_SOCKET_CONNECT;
    CmdCtrl.TxDescLen = sizeof(_SocketAddrIPv4Command_t);
    /* Do nothing - cmd already initialized to this type */
    break;
    case SL_AF_INET6_EUI_48:
    CmdCtrl.Opcode = SL_OPCODE_SOCKET_CONNECT_V6;
    CmdCtrl.TxDescLen = sizeof(_SocketAddrIPv6EUI48Command_t);
    break;
    #ifdef SL_SUPPORT_IPV6
    case AF_INET6:
    CmdCtrl.Opcode = SL_OPCODE_SOCKET_CONNECT_V6;
    CmdCtrl.TxDescLen = sizeof(_SocketAddrIPv6Command_t);
    break;
    #endif
    case SL_AF_RF:
    default:
    return SL_RET_CODE_INVALID_INPUT;
    }

    Msg.Cmd.IpV4.lenOrPadding = 0;
    Msg.Cmd.IpV4.sd = (_u8)sd;

    _sl_BuildAddress(addr, addrlen, &Msg.Cmd);


    ObjIdx = _SlDrvProtectAsyncRespSetting((_u8*)&AsyncRsp, CONNECT_ID, sd & BSD_SOCKET_ID_MASK);

    if (MAX_CONCURRENT_ACTIONS == ObjIdx)
    {
    return SL_POOL_IS_EMPTY;
    }

    /* send the command */
    //VERIFY_RET_OK(_SlDrvCmdOp((_SlCmdCtrl_t *)&CmdCtrl, &Msg, NULL));
    RetVal = (_SlDrvCmdOp((_SlCmdCtrl_t *)&CmdCtrl, &Msg, NULL));
    //_SL_ASSERT((_SlReturnVal_t)SL_OS_RET_CODE_OK == _RetVal);
    if(!((_SlReturnVal_t)SL_OS_RET_CODE_OK == RetVal)){_SlDrvAssert(__LINE__); }


    //VERIFY_PROTOCOL(Msg.Rsp.sd == sd)
    //_SL_ASSERT(Msg.Rsp.sd == sd)
    if(!(Msg.Rsp.sd == sd)){_SlDrvAssert(__LINE__); }

    RetVal = Msg.Rsp.statusOrLen;

    if(SL_RET_CODE_OK == RetVal)
    {
    /* wait for async and get Data Read parameters */
    _SlDrvSyncObjWaitForever(&g_pCB->ObjPool[ObjIdx].SyncObj);

    //VERIFY_PROTOCOL(AsyncRsp.sd == sd);
    if(!(AsyncRsp.sd == sd))
    {
    _SlDrvAssert(__LINE__);
    }

    RetVal = AsyncRsp.statusOrLen;
    }



    _SlDrvReleasePoolObj(ObjIdx);
    return RetVal;
    }


    the FW stops in

    _SlDrvSyncObjWaitForever(&g_pCB->ObjPool[ObjIdx].SyncObj);


    i dont understand.

    Best regards
    Marco
  • Now it seems you are trying the client and not the server role.

    My request was to try the example code "as is" and not try to integrate into your code. Can you try the TCP server and try to connect with an external TCP client and let me know if it works?

    Shlomi

  • Sorry....

    i'm trying with a CC3100MODBOOST and this is the response, using a software to read the debuq messages:

    TCP socket application - Version 1.2.0
    *******************************************************************************
    Device is configured in default state
    Device started as STATION
    Connection established w/ AP and IP is acquired
    Establishing connection with TCP server
    [TCP Client] TCP connection Error
    Failed to establishing connection with TCP server
    Starting TCP server

    If i try to connect with a PC using WiFi access point i read Connected to 192.168.1.111.

    is this the test that you ask me?

    Marco
  • I see.

    So you fail to connect to a TCP server using CC3100 as a TCP client.

    In this case, please look at sl_Connect(). It uses a SlSockAddr_t structure with details of the TCP server it needs to connect to.

    In this example, it is hard coded so you may want to change it to match the details of your TCP server.

    The hard coded values in the examples are: 192.168.1.102 and port 5001.

    Please verify.

    Shlomi

  • In the previous example i set the AP with DHCP.
    If i disable DHCP, this is te debug reply of the module:

    -----------------------------------------------------------------------------------------------------------------------------------------------------

    TCP socket application - Version 1.2.0
    *******************************************************************************
    Device is configured in default state
    Device started as STATION

    -----------------------------------------------------------------------------------------------------------------------------------------------------

    the address is 192.168.1.102 and port 5001(default), Access point name : custom.

    In this configuration the ping doesn't work and i don't connect.
    We are using the CC3100 mudule in another application using SPI to configure and communicate to module; and in this configuration is ok.

    I don't think is a access point problem.

    i hope that my explanation is clear.

    Marco
  • Hi,

    There is no need to move to static IP.

    The steps should be:

    1. AP is configured with  DHCP
    2. Run a TCP server (not the CC3100 device), connect to the AP and wait for connection
    3. enter the server assigned IP address in tcp_socket example and recompile. Make sure you connect to the same TCP port in the server

    If this setup does not work and it does work when you work with SPI, let me know.

    What is the HW setup you are using?

    Shlomi

  • Good Morning,

    i try with your instruction and now the example work.

    I look in Server page the data send by sl_send function called in BsdTcpClient.

    Do you suggest me to insert this code in my proget?

    I'm using rx,tx,rt  configuration, i do't use IRQ.

    thanks a lot

    Marco

  • So if the example code works and your code does not - worth checking what is wrong.

    Does this example work on UART?

    Shlomi

  • I'm trying.....
    i have a problem with

    _i16 sl_Connect(_i16 sd, const SlSockAddr_t *addr, _i16 addrlen)
    {
    _SlSockConnectMsg_u Msg;
    _SlReturnVal_t RetVal;
    _SlCmdCtrl_t CmdCtrl = {0, 0, sizeof(_SocketResponse_t)};
    _SocketResponse_t AsyncRsp;
    _u8 ObjIdx = MAX_CONCURRENT_ACTIONS;


    switch(addr->sa_family)
    {
    case SL_AF_INET :
    CmdCtrl.Opcode = SL_OPCODE_SOCKET_CONNECT;
    CmdCtrl.TxDescLen = sizeof(_SocketAddrIPv4Command_t);
    /* Do nothing - cmd already initialized to this type */
    break;
    case SL_AF_INET6_EUI_48:
    CmdCtrl.Opcode = SL_OPCODE_SOCKET_CONNECT_V6;
    CmdCtrl.TxDescLen = sizeof(_SocketAddrIPv6EUI48Command_t);
    break;
    #ifdef SL_SUPPORT_IPV6
    case AF_INET6:
    CmdCtrl.Opcode = SL_OPCODE_SOCKET_CONNECT_V6;
    CmdCtrl.TxDescLen = sizeof(_SocketAddrIPv6Command_t);
    break;
    #endif
    case SL_AF_RF:
    default:
    return SL_RET_CODE_INVALID_INPUT;
    }

    Msg.Cmd.IpV4.lenOrPadding = 0;
    Msg.Cmd.IpV4.sd = (_u8)sd;

    _sl_BuildAddress(addr, &Msg.Cmd);


    ObjIdx = _SlDrvProtectAsyncRespSetting((_u8*)&AsyncRsp, CONNECT_ID, sd & BSD_SOCKET_ID_MASK);

    if (MAX_CONCURRENT_ACTIONS == ObjIdx)
    {
    return SL_POOL_IS_EMPTY;
    }

    /* send the command */
    VERIFY_RET_OK(_SlDrvCmdOp((_SlCmdCtrl_t *)&CmdCtrl, &Msg, NULL));
    VERIFY_PROTOCOL(Msg.Rsp.sd == sd)

    RetVal = Msg.Rsp.statusOrLen;

    if(SL_RET_CODE_OK == RetVal)
    {
    /* wait for async and get Data Read parameters */
    _SlDrvSyncObjWaitForever(&g_pCB->ObjPool[ObjIdx].SyncObj);

    VERIFY_PROTOCOL(AsyncRsp.sd == sd);

    RetVal = AsyncRsp.statusOrLen;
    }



    _SlDrvReleasePoolObj(ObjIdx);
    return RetVal;
    }




    AsyncRsp is empty....it is all 0; also sd is 0.

    ????????
    Who copile this struct?
    thanks
  • Hi,

    i'm back.

    Today i work with porting  tcp_socket.

    I'm connecting with TCP Server and if i have modify:

    _SlReturnVal_t _SlDrvDataWriteOp(
        _SlSd_t             Sd,
        _SlCmdCtrl_t  *pCmdCtrl ,
        void                *pTxRxDescBuff ,
        _SlCmdExt_t         *pCmdExt)
    {
        _SlReturnVal_t  RetVal = SL_EAGAIN; /*  initiated as SL_EAGAIN for the non blocking mode */
        _SlReturnVal_t _RetVal;
       g_pCB->FlowContCB.TxPoolCnt--;

        _SlDrvObjUnLock(&g_pCB->FlowContCB.TxLockObj);
       
        /* send the message */
        RetVal =  _SlDrvMsgWrite(pCmdCtrl, pCmdExt, pTxRxDescBuff);

        _SlDrvObjUnLock(&g_pCB->GlobalLockObj);

        return RetVal;
    }

    in this way my FW sed to TCP server some BYTE.

    At tis time i' returning to my old project, i look that i don't enter in

    _sl_HandleAsync_Accept function.

    Can you help me to understand bwcause?

    thanks

    Marco

  • Hi,

    Not sure why you change the driver code. It should remain as is.

    My recommendation is to follow the SDK examples as reference (compare what you get from the example code and it should be the same as what you should get on your code).

    I don't see how sd is 0 as it is an input to sl_connect(). If you try IPv4 TCP connection, you should get sd as 0x10.

    Shlomi

  • Hi,
    i'm back!
    Now i connect by tcp client to my CC3100; but i have some problem with UDP service.
    I find the device but i don't succeed to connect with the module i use a interrupt timer to control the connection of the module.
    I must guarantee a timing for the initialization and connection cycle?

    In my rx uart interrupt i have a buffer like SDK example and its dimensione is:

    #define UART_READ_JITTER_BUFFER_SIZE 4
    #define UART_READ_JITTER_RTS_GUARD 3

    Can i change these dimensions?
    I'm tring to encrease these value but i don't have any result.
    Could you help me?

    thanks
    Marco
  • Marco,

    With all the tests you applied, I'm not sure I'm following.

    I understand you are using UART as your host interface.

    Can you please clarify whether SDK examples are working on your device?

    • when you are using examples under simplelinkstudio directory that connects directly to the device using the PC as a platform
    • when you use examples under any of the other directories (if you use another platform)

    In both cases, make sure if it is working on SPI and on UART (the SL_IF_TYPE_UART definition).

    Shlomi

  • Hi Shlomi,

    the example now is working is this:

    getting_started_with_wlan_station

    This the bahavior that i want in my device.

    I'm working on UART interface, i'm sure.I see the data on oscilloscope with decode data function.

    Thank,

    Maco  

  • OK,

    and when you take the getting_started_with_wlan_station example to your device. Is it working?

    If not:

    • please elaborate the setup with all connections
    • what platform are you using?
    • when is it getting stuck (i.e. call stack when it happens, UART lines capture)?

    Shlomi

  • Hi Shlomi,
    after my porting of getting_started_with_wlan_station my device is working but it is not ok; after few seconds that my device is connected with another device (PC or tablet) my FW is blocked in "uart_read" function in "while(puartFlowctrl->ActiveBufferWriteCounter < len);".
    On uart line i don't see data.
    I'm working with a H8SX1664, without SO.
    I use rx interrupt for to receive the data from CC3100 and another timer interrupt to manage the inizialization, connection, analisys of data received.

    have i reply to your question?

    Is it a timing error?
    Could you help me

    thanks
  • Hi,

    i hav a big problem with thi function:

    _SlReturnVal_t _SlDrvDataWriteOp(
    _SlSd_t Sd,
    _SlCmdCtrl_t *pCmdCtrl ,
    void *pTxRxDescBuff ,
    _SlCmdExt_t *pCmdExt)
    {
    _SlReturnVal_t RetVal = SL_EAGAIN; /* initiated as SL_EAGAIN for the non blocking mode */
    while( 1 )
    {
    /* Do Flow Control check/update for DataWrite operation */
    _SlDrvObjLockWaitForever(&g_pCB->FlowContCB.TxLockObj);

    /* 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) ); */
    sl_SyncObjClear(&g_pCB->FlowContCB.TxSyncObj);

    /* we have indication that the last send has failed - socket is no longer valid for operations */
    if(g_pCB->SocketTXFailure & (1<<(Sd & BSD_SOCKET_ID_MASK)))
    {
    _SlDrvObjUnLock(&g_pCB->FlowContCB.TxLockObj);
    return SL_SOC_ERROR;
    }
    if(g_pCB->FlowContCB.TxPoolCnt <= FLOW_CONT_MIN + 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 & BSD_SOCKET_ID_MASK)))
    {
    _SlDrvObjUnLock(&g_pCB->FlowContCB.TxLockObj);
    return RetVal;
    }
    /* If TxPoolCnt was increased by other thread at this moment, */
    /* TxSyncObj won't wait here */
    _SlDrvSyncObjWaitForever(&g_pCB->FlowContCB.TxSyncObj);
    }

    if(g_pCB->FlowContCB.TxPoolCnt > FLOW_CONT_MIN + 1 )
    {
    break;
    }
    else
    {
    _SlDrvObjUnLock(&g_pCB->FlowContCB.TxLockObj);
    }
    }

    _SlDrvObjLockWaitForever(&g_pCB->GlobalLockObj);


    VERIFY_PROTOCOL(g_pCB->FlowContCB.TxPoolCnt > FLOW_CONT_MIN + 1 );
    g_pCB->FlowContCB.TxPoolCnt--;

    _SlDrvObjUnLock(&g_pCB->FlowContCB.TxLockObj);

    /* send the message */
    RetVal = _SlDrvMsgWrite(pCmdCtrl, pCmdExt, pTxRxDescBuff);

    _SlDrvObjUnLock(&g_pCB->GlobalLockObj);

    return RetVal;
    }

    i'm stopped here:
    sl_SyncObjClear(&g_pCB->FlowContCB.TxSyncObj);

    Someone could tell me what is this "sl_SyncObjClear(&g_pCB->FlowContCB.TxSyncObj);"?
    What the CC3100 want?

    I'm using uart interface.

    THANKS.
    MARCO
  • Marco,

    The UART implementation used in the SDK is for MSP430 5529LP.

    We use a jitter buffer with size 4 to store some data in cases where the CC3100 sends data while the platform cannot accept it.

    It is possible that in your case, it is not sufficient.

    You can play with the UART_READ_JITTER_BUFFER_SIZE and UART_READ_JITTER_RTS_GUARD and try to increase those.

    Please note that HW flow control (RTS/CTS) is used in this case so you must verify that it is configured in your platform as well.

    Lastly, if you send a specific length you want to receive over UART, the function would not return until all data is received! What happens in your case? how many bytes are you requesting?

    Shlomi

  • Hi Shlomi,

    thanks for your reply.

    I use RTS/CTS flow control and i think it is configured well.

    I decribe what i see:

    i send from PC to my the command 0x1D 0x49 0x31, the right response from my device is 0x83; but if i send 0x1D 0x49 0x31 my device doen't respond nothing, if i add 1 more byte o my request and i send 0x00  0x1D 0x49 0x31 my device respond right

    I can see this strange behavior with other command?
    I have already increased the UART_READ_JITTER_BUFFER_SIZE and UART_READ_JITTER_RTS_GUARD but the behavior is the same.

    In the case my device doesn't reply the FW is stopped in

    "while(puartFlowctrl->ActiveBufferWriteCounter < len);"ciclein uart_re function.

    I hope these my informations are useful to reply me a solution.

    Thanks,

    Marco 

  • Marco,

    What are these commands? are those something propriatery to your application?

    If you are stuck at "while(puartFlowctrl->ActiveBufferWriteCounter < len);", it means you have not reached the number of characters you requested. Adding 1 character seems to work so you probably asked for 4 bytes.

    In any case, it is not clear whether you are stuck at the APIs exposed by the host driver or by some propriatery implementation you make.

    My advise as before is to mimic the sls examples with UART (compare what is received/transmitted on the UART lines).

    Shlomi

  • Shlomi,

    the command is propriatery of my application, i analyze the uart line by oscilloscope:
    these are the BYTES that i see between CC3100 module and my microcontroller

    3 BYTE command (1D 49 31):
    BA DC CD AB 0A 10 0B 00 38 01 05 05 03 00 11 6E 1D 49 31

    3 BYTE command + 1 BYTE (00 +1D 49 31) :
    BA DC CD AB 0A 10 0C 00 38 01 05 05 04 00 11 E2 00 1D 49 31

    I think that both the message are right...
    What do you think?

    Marco
  • Marco,

    I understand now what you mean by propriatery.

    This is all data on top of a socket.

    Both data streams seem OK. These streams are from the device to yout target host.

    Can you elaborate the followings:

    1. what is the content of puartFlowctrl structure when it happens (all the fields)?
    2. what is the state of RTS, CTS and HOST_IRQ lines?

    Shlomi

  • Hi Shlomi,

    thanks for ypur reply.

    Below puartFlowctrl structure screen shot.

    Now i'm not using IRQ signal.

    Marco

  • I don't see any screen shot.

    What  lines are connected between the host and CC3100? don't you use HOST IRQ line?

  • i'm afraid.
    puartFlowctrl 0x00ff3b38 { 0FF4656 } (_uartFlowctrl*) [Current Scope]
    * { 0FF3B38 } (_uartFlowctrl)
    JitterBuffer "ºÜºº" { 0FF3B38 } (unsigned char[4])
    [0] H'ba '.' { 0FF3B38 } (unsigned char)
    [1] H'dc '.' { 0FF3B39 } (unsigned char)
    [2] H'ba '.' { 0FF3B3A } (unsigned char)
    [3] H'ba '.' { 0FF3B3B } (unsigned char)

    JitterBufferWriteIdx H'00 '.' { 0FF3B3C } (char)

    JitterBufferReadIdx H'03 '.' { 0FF3B3D } (char)

    JitterBufferFreeBytes H'04 '.' { 0FF3B3E } (char)

    bRtsSetByFlowControl H'00 '.' { 0FF3B3F } (unsigned char)

    bActiveBufferIsJitterOne H'0000 { 0FF3B40 } (int)

    pActiveBuffer 0x00ffbc0a { 0FF3B42 } (unsigned char*)
    * H'ba "ºÜ" { 0FFBC0A } (unsigned char)

    ActiveBufferWriteCounter H'0002 { 0FF3B46 } (int)
    Can you see correctly now?
    RTS,CTS,RX and TX, i'm not using irq line, i'm using RX interrupt on my microcontroller for read the data on RX line...
  • Marco,

    What host are you using?

    If you do not use the host interrupt line, you need to make sure one of the following conditions is met:

    • Host always stays awake/active
    • Host goes to sleep but its UART module has receiver start-edge detection for auto wake up

    It might be that your host go into low power mode and looses a byte. Can you make sure the host stays active just for the test?

    From the structure it shows the first 2 bytes are received, 0xBA and 0xDC. Can you take a look at the "call stack" at this point and tell which of the functions in driver.c file is calling eventually to this uart_read()? 

    Shlomi

  • Shlomi,

    i'm trying to insert irq line.

    I'm using a oscilloscope to view the irq line, i can see that the line often do the sequece low-hgh-low, the sequence is more frequent when i connect the PC.

    I think this i right.

    When i sen data from the pc to the modulo te CC3100 stop to send me irq signal...... i think this is wrong!
    What is the cause of this behavior?

    thanks

    MArco

     

  • Marco,

    It is always advised to use the examples from SDK with TI evaluation board for reference.

    Hard to tell why you are not getting the interrupt but the device assert the interrupt in the following cases:

    1. upon sl_start() when the device finished initialization successfully and pending for commands
    2. upon unsolicited events (e.g. CONNECTED event, IPACQUIRED event, etc)
    3. upon command complete

    For the generic case of command complete, the interrupt is asserted by the device, indicating it has data for the host. Then, the host is triggering the device by sending CNYS pattern and then read the data. All of this is internal to the driver and should work flawlessly.

    Shlomi

  • Hi,

    Did the above post answer your query? Any update on the post?
    please verify the answer.

    Shlomi

  • Hi Shlomi,

    i'm afraid....but i have not good news.
    i'm trying to understand the function:

    _SlReturnVal_t _SlDrvMsgRead(void)

    Particularly i don't undestand the souce code when there is this comment:

    /* Read 4 bytes aligned from interface */
    /* therefore check the requested length and read only */
    /* 4 bytes aligned data. The rest unaligned (if any) will be read */
    /* and copied to a TailBuffer */

    what does it mean?
    This can explain why the SDK has a different behavior if i send to CC3100 a commando of 3 byte or 4 byte?

    MArco