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执行wlan_connect后一直没有HCI_EVNT_WLAN_UNSOL_CONNECT



cc3000初始化还有smartconfig,都是正确的,但是执行wlan_connect后一直没有返回HCI_EVNT_WLAN_UNSOL_CONNECT,是什么原因呢?

  • 我把我的代码贴出来一下:

    cc3000_setup_vbat_en();             //硬件初始化
    cc3000_setup_irq();
    cc3000_setup_spi();

    wlan_init(cc3000_async_callback,cc3000_send_FW_patch,cc3000_send_driver_patch,cc3000_send_bootloader_patch,cc3000_read_wlan_irq,cc3000_wlan_irq_enable,cc3000_wlan_irq_disable,cc3000_write_wlan_pin);

    wlan_start(0);

    //配置cc3000 ip
    pucSubnetMask[0] = 0xFF;
    pucSubnetMask[1] = 0xFF;
    pucSubnetMask[2] = 0xFF;
    pucSubnetMask[3] = 0x0;

    // CC3000's IP
    pucIP_Addr[0] = STATIC_IP_OCT1;
    pucIP_Addr[1] = STATIC_IP_OCT2;
    pucIP_Addr[2] = STATIC_IP_OCT3;
    pucIP_Addr[3] = STATIC_IP_OCT4;

    pucIP_DefaultGWAddr[0] = STATIC_IP_OCT1;
    pucIP_DefaultGWAddr[1] = STATIC_IP_OCT2;
    pucIP_DefaultGWAddr[2] = STATIC_IP_OCT3;
    pucIP_DefaultGWAddr[3] = 1;

    pucDNS[0] = STATIC_IP_OCT1;
    pucDNS[1] = STATIC_IP_OCT2;
    pucDNS[2] = STATIC_IP_OCT3;
    pucDNS[3] = 1;

    netapp_dhcp((unsigned long *)pucIP_Addr, (unsigned long *)pucSubnetMask,
    (unsigned long *)pucIP_DefaultGWAddr, (unsigned long *)pucDNS);

    // reset the CC3000 to apply Static Setting
    wlan_stop();
    delay_ms(600);
    wlan_start(0);

    // 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);

    // CC3000 has been initialized
    setCC3000MachineState(CC3000_INIT);

    unsigned long aucDHCP, aucARP, aucKeepalive, aucInactivity;

    aucDHCP = 14400;
    aucARP = 3600;
    aucKeepalive = 10;
    aucInactivity = 25;

    if(netapp_timeout_values(&(aucDHCP), &(aucARP), &(aucKeepalive), &(aucInactivity)) != 0)
    {
    while(1);
    }

    // Check if we should erase previous stored connection details (most likely written with data from the SmartConfig app)
    wlan_ioctl_set_connection_policy(0, 0, 0);
    wlan_disconnect();
    unsetCC3000MachineState(CC3000_ASSOC);

    StartSmartConfig();                                     //SmartConfig

    delay_ms(100);

    {
      unsigned char loop_index = 0;

      while (loop_index < 3)
      {
        mdnsAdvertiser(1,(char *)cc3000_device_name,strlen(cc3000_device_name));
        loop_index++;
      }
    }
    if(!(currentCC3000State() & CC3000_ASSOC))
    {

      if(isAssocSSIDValid() == 1)
      {
        ConnectUsingSSID((char *)ptrSSID, (char *)ptrKEY);         //ptrSSID是读出的ssid,ptrKEY是密码
      }
      else
      {
        ConnectUsingSSID(DEFAULT_OUT_OF_BOX_SSID, NULL);
      }

    }

    ConnectUsingSSID的代码如下:

    int ConnectUsingSSID(char * ssidName, char *key)
    {
    unsetCC3000MachineState(CC3000_ASSOC);

    // Disable Profiles and Fast Connect
    wlan_ioctl_set_connection_policy(0, 0, 0);
    delay_ms(500);
    if (wlan_connect(WLAN_SEC_WPA, (char *) ssidName, strlen(ssidName), NULL, (unsigned char *) key, strlen(key)) != 0)
    {
    dbg_str("SSID connection failed");       //不会进入这里面
    return 1;
    }
    // We don't wait for connection. This is handled somewhere else (in the main loop for example).
    return 0;
    }

    但是接下来就是一直没有HCI_EVNT_WLAN_UNSOL_CONNECT的中断进来。。

    请大侠们 帮我看看可能是什么问题,谢谢了!

  •  再补充一点:cc3000的Service Pack和Firework的版本是P1.13.7 的

    还有用netapp_ipconfig(&ipconfig);读ip也读不出来。。

    哪位遇到过类似问题的大侠请不吝赐教!谢谢!

  • 各位!要接天线啊!