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: [WiFi Direct/P2P] Problem to communicate a CC3100 module with a Windows 10 PC

Part Number: CC3100

Hi, I`m trying to use the CC3100 to communicate with a PC. To do that, I used as reference the P2P exemple that TI made Available. Int he PC side, I`m using the Universal Windows Platform (UWP) app samples.
The problem is, I can create a connection between the module and a Android phone, but when I try to do the same thing with the application, sometimes I can connect the device, sometimes I can`t. 

 Here how I configure the P2P mode:

_i32 ConfigureModuleToP2PMode()
	_u8 paramBuff[4];
	_i32 retVal = -1;
	_i8 val = 1;

	/* Configuring device in P2P mode */
	/* Configure P2P mode */
	retVal = sl_WlanSetMode(ROLE_P2P);
	if (retVal < 0)

	/* ------------------------------- */
	/* Configure P2P global parameters */
	/* ------------------------------- */
	/* P2P Network Config: P2P DHCP Client */
	retVal = sl_NetCfgSet(SL_IPV4_STA_P2P_CL_DHCP_ENABLE,
	IPCONFIG_MODE_ENABLE_IPV4, 1, (_u8*) &val);
	if (retVal < 0)

	/* Set P2P Device name */
			(_u8 *) P2P_DEVICE_NAME);
	if (retVal < 0)

        /* Set P2P device type */
			pal_Strlen(DEVICE_TYPE), (_u8*) DEVICE_TYPE);
	if (retVal < 0)

	/* P2P Listen and Operation Channels */
	paramBuff[0] = LISTEN_CHANNEL;			// Listen Channel
	paramBuff[1] = REGULATORY_CLASS;		// Listen Regulatory Class
	paramBuff[2] = OPRA_CHANNEL;			// Operation Channel
	paramBuff[3] = REGULATORY_CLASS;		// Operation Regulatory Class
			4, paramBuff);
	if (retVal < 0)

	/* -------------------- */
	/* Configure P2P Policy */
	/* -------------------- */
	 * Set the negotiation role (SL_P2P_ROLE_NEGOTIATE).
	 * CC3100 will negotiate with remote device GO/client mode.
	 * Other valid options are:
	 *             - SL_P2P_ROLE_GROUP_OWNER
	 *             - SL_P2P_ROLE_CLIENT
	/* P2P Policy (P2P_ROLE_CLIENT intent 0, random backoff) */
	retVal = sl_WlanPolicySet(SL_POLICY_P2P,
	if (retVal < 0)

    /* P2P Profile Connection Policy (nailed P2P client) */
	retVal = sl_WlanPolicySet(SL_POLICY_CONNECTION,

	if (retVal < 0)

	/* Restart as P2P device */
	retVal = sl_Stop(0);
	if (retVal < 0) {

	retVal = sl_Start(NULL,NULL,NULL);
	if (retVal < 0)

	return 0;

I really don`t know what is the difference between the PC and the mobile phone. I saw that some people here had the same problem, but I didn't find any thing that could help me with or any resolution to this.

Can anyone help me with that?
Thank you in advance.

  • Hello,

    As you observed already, it is not that stable.

    The problem is that when I tested it few months back, some mobile devices also experienced connection issues (at least with the Windows10 Add Devive).

    The only limitations I know of are:

    1. when connecting from Win10 to the device and the device "profile" is already stored, Win10 uses it as a persistent profile and sends invite to the device (skipping the negotiation part). In this case, the device does not response. The device does not support this feature
    2. connection statistics in general is ~65% (tested over several WiFi Direct devices). It means that it is not always successful and a 2nd trial is required.

    In your case, what is the statistics?



  • Hi Shlomi,

    I don't have a exact statistic about the connection, because it's a little bit unstable.

    Yesterday I passed the entire day trying to discover (only discover, not connect) the device and I couldn't, the device didn't appear in the Universal WiFi Direct application or in Windows 10 add devices option, however if I tried to do the same thing, discover the device, using the mobile and I always found it. In the end of the day, I magically could find the device using Windows.
    It was so unstable that it worried me a lot, because we need to create a Windows application to works with a embedded system.

    About these limitations, is there any workarround to them?

    Is there anything wrong in my code? How I'm trying to configure it?
    I'm using the same sequence as the P2P example does: Configure to default state => sl_start(0, 0, 0) => configure module to P2P mode => try to establish a connection with P2P device.

    The entire ideai is create a embedded device which communicates with a PC using WiFi Direct transmit and receive some data, in other words, to change a Bluetooth to WiFi Direct communication.


    Felipe Lemos

  • Hello Felipe,

    This was exactly the point I was trying to raise. We too observed the unstable nature of WiFi direct with Win10, mostly from the Ad Device but also from the UWP. We noticed it with several mobiles as reference.

    I do not see any issues with your implementation.

    Regarding the limitation:

    1. Persistent GO: if our device skips negotiation and gets an invite, it fails. There is no fix for this one. As far as I know, this is not mandatory in WiFi direct spec.
    2. connection statistics in general is ~65%. This one could be improved to ~90% but it is not part of future servicepack. Need to find out the timelines.



  • Hello,

    Any update on the post?


  • Hi Shlomi,

    I changed the environment and now I'm trying to connect the CC3100MODBOOTS to a Virtual Machine with Linux to do my tests. I will leave the Windows 10 configuration problem to the desktop team.

    Now I'm using wpa_supplicant to connect step by step to the module. I successfully received the SL_WLAN_CONNECT_EVENT event, and after that the module enters in the loop, waiting a valid IP.

    while ((!IS_IP_LEASED(stDeviceCfg.status)
    		&& !IS_IP_ACQUIRED(stDeviceCfg.status))
    		|| (!IS_CONNECTED(stDeviceCfg.status)
    		&& !IS_STA_CONNECTED(stDeviceCfg.status))) {
    	if (IS_CONNECTION_FAILED(stDeviceCfg.status)) {
    		/* Error, connection is failed */

    I don't know if I have to call "udhcpc -i wlan0" in Linux to that. For while, I will try to use static IP to see how the things will work.
    I'm using this wiki from Texas Instruments as guide to use the wpa_supplicant software in Linux side. As I'm using Linux instead OMAP, I have to do some modification. On the virtual machine, I'm connected a wireless dongle and with that dongle as "wlan0", I will try to open a socket (before that, I have to fix the IP issue) and use iPerf to create a traffic between the computer and the module.

    Do you have any suggestion, Shlomi?

    Thank you,

    Felipe Lemos

  • Hello,

    When you say you received the SL_WLAN_CONNECT_EVENT event, do you mean IS_P2P_REQ_RCVD() return as true?

    If so, it means you get a negotiation request from the other side and during this request you fill in the p2p device name so next you try to connect to it via sl_WlanConnect().

    Then you should wait for IS_IP_ACQUIRED() or IS_IP_LEASED(), depends on the role (see the example on SDK).

    Do you have DHCP enabled on the other side?



  • Hi,

    When you say you received the SL_WLAN_CONNECT_EVENT event, do you mean IS_P2P_REQ_RCVD() return as true?
    I didn't find any IS_P2P_REQ_RCVD() macro or fuction at CC3100SDK_1.2.0 folder, however, I think that a P2P_REQ occured.

    Do you have DHCP enabled on the other side?
    Using DHCP, my code was stuck at that while, then I modified the application to use static IP. With that, it was possible to get connected, as the wpa_cli log showsÇ

    Successfully initialized wpa_supplicant
    P2P-DEVICE-FOUND AA:BB:CC:CC:DD:XX p2p_dev_addr=AA:BB:CC:CC:DD:XX pri_dev_type=1-0050F204-1 name='CC3100-Dev' config_methods=0x188 dev_capab=0x21 group_capab=0x0 new=1
    P2P-GO-NEG-SUCCESS role=GO freq=2437 ht40=1 peer_dev=AA:BB:CC:CC:DD:XX peer_iface=AA:BB:CC:CC:DD:XX wps_method=PBC
    Using interface wlan0 with hwaddr AC:DC:XX:XX:AA:BB and ssid "DIRECT-EJ"
    wlan0: interface state UNINITIALIZED->ENABLED
    wlan0: AP-ENABLED 
    wlan0: CTRL-EVENT-CONNECTED - Connection to AC:DC:XX:XX:AA:BB completed [id=1 id_str=]
    wlan0: WPS-PBC-ACTIVE 
    nl80211: wpa_driver_nl80211_event_receive->nl_recvmsgs failed: -4
    wlan0: CTRL-EVENT-EAP-PROPOSED-METHOD vendor=0 method=1
    wlan0: CTRL-EVENT-EAP-PROPOSED-METHOD vendor=14122 method=254
    wlan0: WPS-REG-SUCCESS AA:BB:CC:CC:DD:XX 22154c53-...
    P2P-GROUP-STARTED wlan0 GO ssid="DIRECT-EJ" freq=2437 go_dev_addr=AC:DC:XX:XX:AA:BB
    wlan0: WPS-PBC-DISABLE 
    wlan0: WPS-SUCCESS 
    wlan0: AP-STA-CONNECTED AA:BB:CC:CC:DD:XX p2p_dev_addr=AA:BB:CC:CC:DD:XX

    Now, my code is stuck at this part, waiting the socket accepts:

    Status = sl_Listen(SockID, 0);
    if (Status < 0) {
    	/* [TCP Server] Listen Error */
    newSockID = sl_Accept(SockID, (struct SlSockAddr_t *) &Addr,
    		(SlSocklen_t*) &AddrSize);
    if (newSockID < 0) {
    	/* [TCP Server] Accept connection Error */

    The strange occurred in the Linux side, the wlan0, which was without a valid ip, got an IP different network than IP I configured on the static configuration.

    wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
            inet  netmask  broadcast
            inet6 abcd::...::....:....  prefixlen 64  scopeid 0x20<link>
            ether = AC:DC:XX:XX:AA:BB txqueuelen 1000  (Ethernet)
            RX packets 57  bytes 14093 (14.0 KB)
            RX errors 0  dropped 8  overruns 0  frame 0
            TX packets 379  bytes 70509 (70.5 KB)
            TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

    Instead to receive an IP on the network
    Even using this IP or configuring it with a IP on that network that I mentioned, I couldn't send any package using iperf or ping...

    sudo iperf -c -p 50001 -i 1

    Any advice?
    Thank you,

    Felipe Lemos

  • Hello Felipe,

    I am not familiar with the wpa_supplicant configuration on Linux but it seems it is not working as expected.

    You are not able to make the DHCP server work and static IP seems to get an IP address different from what you configured.

    Also, you cannot connect on TCP level.

    Do you have an air sniffer you can capture and see what is going on?



  • Hello Shlomi,

    After some attempts, I could get an IP using DHCP, the problem was my DHCP server on Linux side.
    But I'm still stucked on the socket "sl_Accept" thing. I don't know if it is a firewall problem (as I'm using a virtual machine). The other reason to me to using Linux now instead windows is to sniff the wifi packets more easily (in Linux I can use airmon-ng to put the interface in monitor mode and with that I can use Wireshark to sniff wireless traffic without a need of a paid software or hardware).

    In some threads, a user called "matianfu" mentioned that he could use wpa_supplicant to connect with the P2P example.

    I will try to see first if there's any problem with my firewall.

    Any news, I will post here.

    Thank you, Shlomi.


    Felipe lemos

  • Updates about my problem. I could connect, send and receive data now. The problem was the socket, I was configuring it as blocking, when I need it as non-blocking.
    I'm checking the SL_EAGAIN return after each sl_accept, sl_send or sl_recv. This resolve my problem.
    Now other problem occurred, in the authentication mode, I don't know why the SL_SEC_TYPE_P2P_PIN_KEYPAD mode is returning an error after connection, but I will ask about it in other thread.
    Thank you a lot, Shlomi.