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.

CC3000 disconnect after about 5 minutes

Hi,

init_ti_spi(); /* ti wifi spi kurulumu */
ulCC3000DHCP = 0;
ulCC3000Connected = 0;
ulSocket = 0;
ulSmartConfigFinished=0;
/* WLAN On API Implementation*/
wlan_init( CC3000_UsynchCallback, sendWLFWPatch, sendDriverPatch, sendBootLoaderPatch, ReadWlanInterruptPin, WlanInterruptEnable, WlanInterruptDisable, WriteWlanPin);
/* Trigger a WLAN device*/
wlan_start(0);
/* Turn on the LED 1 to indicate that we are active and initiated WLAN successfully*/
led1_on;
/* Mask out all non-required events from CC3000*/
wlan_set_event_mask(HCI_EVNT_WLAN_KEEPALIVE|HCI_EVNT_WLAN_UNSOL_INIT|HCI_EVNT_WLAN_ASYNC_PING_REPORT);
ucStopSmartConfig = 0;

and than

// wlan disconnect
wlan_disconnect();
netapp_dhcp((unsigned long *)cc3000_ip_adres, (unsigned long *)subnet_mask, (unsigned long *)deafault_gateway, (unsigned long *)ag_dns);
// reset the CC3000
wlan_stop();
__delay_cycles(6000000);
wlan_start(0);
__delay_cycles(6000000);
// aga baglan
ssid_uzunluk = sizeof(ssid_isim_buffer); //atoc(temp_buf[17]);
ssid_ismi = (char *)&ssid_isim_buffer[0];
ssid_sifre=(unsigned char*)&smartconfigkey[0];
wlan_connect(WLAN_SEC_WPA, ssid_ismi, ssid_uzunluk,NULL, ssid_sifre, 11);

success connect to AP. and than ;

ulSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
__delay_cycles(6000000);
/*****************************************************************************/

// the family is always AF_INET
ti_tSocketAddr.sa_family = (unsigned int)AF_INET;// atoshort(ti_pcSockAddrAscii[0], ti_pcSockAddrAscii[1]);
// the destination port
temp_f_dest_port = destination_port_oku();
temp_f_dest_port = temp_f_dest_port >> 16;
temp_dest_port = (unsigned int)temp_f_dest_port;
ti_tSocketAddr.sa_data[1] = (unsigned char) temp_dest_port;//ascii_to_char(ti_pcSockAddrAscii[2], ti_pcSockAddrAscii[3]);
temp_dest_port = temp_dest_port >> 8;
ti_tSocketAddr.sa_data[0] = (unsigned char) temp_dest_port;//ascii_to_char(ti_pcSockAddrAscii[4], ti_pcSockAddrAscii[5]);
// the destination IP address
temp_dest_ip = destination_ip_oku();
ti_tSocketAddr.sa_data[5] = (unsigned char)temp_dest_ip; //ascii_to_char(ti_pcSockAddrAscii[6], ti_pcSockAddrAscii[7]);
temp_dest_ip = temp_dest_ip >> 8;
ti_tSocketAddr.sa_data[4] = (unsigned char)temp_dest_ip; //ascii_to_char(ti_pcSockAddrAscii[8], ti_pcSockAddrAscii[9]);
temp_dest_ip = temp_dest_ip >> 8;
ti_tSocketAddr.sa_data[3] = (unsigned char)temp_dest_ip; //ascii_to_char(ti_pcSockAddrAscii[10], ti_pcSockAddrAscii[11]);
temp_dest_ip = temp_dest_ip >> 8;
ti_tSocketAddr.sa_data[2] = (unsigned char)temp_dest_ip; //ascii_to_char(ti_pcSockAddrAscii[12], ti_pcSockAddrAscii[13]);
connect(ulSocket,&ti_tSocketAddr,sizeof(ti_tSocketAddr));

socket open and than

send(ulSocket, ti_pcData, data_length, 0); 

I send to message stirng to PC TCP Server. But socket and Wlan connect disconnects after about 5 minutes.

I try nettapp_timeout_values but not success. same socket and wlan disconnects after about 5 minutes.

unsigned long aucDHCP = 0xFFFFFFFF;//14400;
unsigned long aucARP = 0xFFFFFFFF;//3600;
unsigned long aucKeepalive = 0xFFFFFFFF;//30;
unsigned long aucInactivity = 0xFFFFFFFF;
signed long iRet;
iRet = netapp_timeout_values(&aucDHCP, &aucARP, &aucKeepalive, &aucInactivity);

Can you tell me what I do?

regards 

Hakki KAPLAN

  • Hi Hakki,

    Some questions:

    1) Are you able to get the events 'HCI_EVNT_WLAN_UNSOL_CONNECT' and 'HCI_EVNT_WLAN_UNSOL_DHCP' when you connect CC3000 to the AP?

    2) Is your TCP server able to receive the string that you send from CC3000 for first 5 minutes?

    3) Do you receive the event 'HCI_EVNT_WLAN_UNSOL_DISCONNECT' when the AP disconnects from CC3000?

    If the connection with AP disconnects then the sockets will not be functional. Have you tried this with any other access point?

    Thanks & Regards,
    Raghavendra

  • Hi Raghavendrai

    1) Yes, I able to get the events 'HCI_EVNT_WLAN_UNSOL_CONNECT' and 'HCI_EVNT_WLAN_UNSOL_DHCP' when I connect CC3000 to the AP.
    2) My TCP server able to receive the string. The String sends to TCP server per 30 seconds and TCP server receives all sended the string.
    3) Yes, I receive the event HCI_EVNT_WLAN_UNSOL_DISCONNECT when the AP disconnects from CC3000.

    if (lEventType == HCI_EVNT_WLAN_UNSOL_DISCONNECT)
    {
    ulCC3000Connected = 0;
    ulCC3000DHCP = 0;
    ulCC3000DHCP_configured = 0;
    // Turn off the LED1
    led1_off;
    // Turn off LED2
    led2_off;

    Thanks & Regards,

    Hakki

  • Hi Hakki,

    It looks like the AP is disconnecting with CC3000. And hence the socket communication fails. Can you please try with a different AP and check the behavior?

    Thanks & Regards,
    Raghavendra

  • Hi Raghavendra,

    Thank you for help. I will be try different AP.

     

    Thanks & Regards,

    Hakki