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) ASSERT_ON_ERROR(retVal); /* ------------------------------- */ /* 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) ASSERT_ON_ERROR(retVal); /* Set P2P Device name */ retVal = sl_NetAppSet(SL_NET_APP_DEVICE_CONFIG_ID, NETAPP_SET_GET_DEV_CONF_OPT_DEVICE_URN, pal_Strlen(P2P_DEVICE_NAME), (_u8 *) P2P_DEVICE_NAME); if (retVal < 0) ASSERT_ON_ERROR(retVal); /* Set P2P device type */ retVal = sl_WlanSet(SL_WLAN_CFG_P2P_PARAM_ID, WLAN_P2P_OPT_DEV_TYPE, pal_Strlen(DEVICE_TYPE), (_u8*) DEVICE_TYPE); if (retVal < 0) ASSERT_ON_ERROR(retVal); /* 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 retVal = sl_WlanSet(SL_WLAN_CFG_P2P_PARAM_ID, WLAN_P2P_OPT_CHANNEL_N_REGS, 4, paramBuff); if (retVal < 0) ASSERT_ON_ERROR(retVal); /* -------------------- */ /* 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, SL_P2P_POLICY(SL_P2P_ROLE_NEGOTIATE, SL_P2P_NEG_INITIATOR_RAND_BACKOFF), NULL, 0); if (retVal < 0) ASSERT_ON_ERROR(retVal); /* P2P Profile Connection Policy (nailed P2P client) */ retVal = sl_WlanPolicySet(SL_POLICY_CONNECTION, SL_CONNECTION_POLICY(TRUE, TRUE, FALSE, FALSE, FALSE), NULL, 0); if (retVal < 0) ASSERT_ON_ERROR(retVal); /* Restart as P2P device */ retVal = sl_Stop(0); if (retVal < 0) { ASSERT_ON_ERROR(retVal); } retVal = sl_Start(NULL,NULL,NULL); if (retVal < 0) ASSERT_ON_ERROR(retVal); 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.