TI中文支持网
TI专业的中文技术问题咨询交流网站

CC3200 AP模式下 设置本地IP 一直报错

CC3200 AP模式下  设置本地IP 一直报错

报错 [GENERAL EVENT] – ID=[-83] Sender=[11]

这个消息由sl_Start()发出

可以提供下AP下修改本地IP的例程吗

Kevin Qiu1:

官方提供的例程都是默认分配的,需要用以下自己修改

SL_IPV4_AP_P2P_GO_STATIC_ENABLE:

Setting a static IP address to the device working in AP mode or P2P go. The IP address will be stored in the FileSystem. Requires restart. SlNetCfgIpV4Args_t ipV4; ipV4.ipV4 = (_u32)SL_IPV4_VAL(10,1,1,201); // _u32 IP address ipV4.ipV4Mask = (_u32)SL_IPV4_VAL(255,255,255,0); // _u32 Subnet mask for this AP/P2P ipV4.ipV4Gateway = (_u32)SL_IPV4_VAL(10,1,1,1); // _u32 Default gateway address ipV4.ipV4DnsServer = (_u32)SL_IPV4_VAL(8,16,32,64); // _u32 DNS server address

sl_NetCfgSet(SL_IPV4_AP_P2P_GO_STATIC_ENABLE,IPCONFIG_MODE_ENABLE_IPV4,sizeof(SlNetCfgIpV4Args_t),(_u8 *)&ipV4); sl_Stop(0); sl_Start(NULL,NULL,NULL);

HUGH HUGH:

回复 Kevin Qiu1:

用的就是这个 用了以后就sl_Start()就提示 [GENERAL EVENT] – ID=[-83] Sender=[11]

Kevin Qiu1:

回复 Kevin Qiu1:

你是在哪里用的,可以把相关的代码贴出来吗

HUGH HUGH:

回复 Kevin Qiu1:

long ConfigureSimpleLinkToDefaultState1(){ SlVersionFull ver = {0}; _WlanRxFilterOperationCommandBuff_t RxFilterIdMsak = {0}; unsigned char ucConfigOpt = 0; unsigned char ucConfigLen = 0; unsigned char ucPower = 0; long lRetVal = -1; long lMode = -1; lMode = sl_Start(NULL,NULL,NULL); ASSERT_ON_ERROR(lMode); // 如果不在AP模式,尝试配置 if(ROLE_AP != lMode) { // 切换为AP模式并重启 lRetVal = sl_WlanSetMode(ROLE_AP); ASSERT_ON_ERROR(lRetVal); lRetVal = sl_Stop(0xFF); ASSERT_ON_ERROR(lRetVal); lRetVal = sl_Start(NULL, NULL, NULL); if(ROLE_AP != lRetVal) { UART_PRINT("Configure AP Mode Failed!"); return -1; } } // 获取设备的版本信息并打印 ucConfigOpt = SL_DEVICE_GENERAL_VERSION; ucConfigLen = sizeof(ver); lRetVal = sl_DevGet(SL_DEVICE_GENERAL_CONFIGURATION, &ucConfigOpt, &ucConfigLen, (unsigned char*)(&ver)); ASSERT_ON_ERROR(lRetVal); UART_PRINT("Host Driver Version: %s\n\r",SL_DRIVER_VERSION); UART_PRINT("Build Version %d.%d.%d.%d.31.%d.%d.%d.%d.%d.%d.%d.%d\n\r", ver.NwpVersion[0],ver.NwpVersion[1],ver.NwpVersion[2],ver.NwpVersion[3], ver.ChipFwAndPhyVersion.FwVersion[0],ver.ChipFwAndPhyVersion.FwVersion[1], ver.ChipFwAndPhyVersion.FwVersion[2],ver.ChipFwAndPhyVersion.FwVersion[3], ver.ChipFwAndPhyVersion.PhyVersion[0],ver.ChipFwAndPhyVersion.PhyVersion[1], ver.ChipFwAndPhyVersion.PhyVersion[2],ver.ChipFwAndPhyVersion.PhyVersion[3]); // 删除所有配置 lRetVal = sl_WlanProfileDel(0xFF); ASSERT_ON_ERROR(lRetVal); // 配置IP SlNetCfgIpV4Args_t ipV4; ipV4.ipV4 = (_u32)SL_IPV4_VAL(10,1,1,201); // _u32 IP address ipV4.ipV4Mask = (_u32)SL_IPV4_VAL(255,255,255,0); // _u32 Subnet mask for this AP/P2P ipV4.ipV4Gateway = (_u32)SL_IPV4_VAL(10,1,1,1); // _u32 Default gateway address ipV4.ipV4DnsServer = (_u32)SL_IPV4_VAL(8,16,32,64); // _u32 DNS server address

sl_NetCfgSet(SL_IPV4_AP_P2P_GO_STATIC_ENABLE,IPCONFIG_MODE_ENABLE_IPV4,sizeof(SlNetCfgIpV4Args_t),(_u8 *)&ipV4); sl_Stop(0); sl_Start(NULL,NULL,NULL); // 设置发送功率为最大 ucPower = 0; lRetVal = sl_WlanSet(SL_WLAN_CFG_GENERAL_PARAM_ID,WLAN_GENERAL_PARAM_OPT_STA_TX_POWER, 1, (unsigned char*)ucPower); ASSERT_ON_ERROR(lRetVal); // 将PM政策设为正常 lRetVal = sl_WlanPolicySet(SL_POLICY_PM, SL_NORMAL_POLICY, NULL, 0); ASSERT_ON_ERROR(lRetVal); // 取消mDNS服务 lRetVal = sl_NetAppMDNSUnRegisterService(0,0); ASSERT_ON_ERROR(lRetVal); // 移除所有过滤器 memset(RxFilterIdMsak.FilterIdMask, 0xFF, 8); lRetVal = sl_WlanRxFilterSet(SL_REMOVE_RX_FILTER, (_u8*)&RxFilterIdMsak,sizeof(_WlanRxFilterOperationCommandBuff_t)); ASSERT_ON_ERROR(lRetVal); // 停止 lRetVal = sl_Stop(SL_STOP_TIMEOUT); ASSERT_ON_ERROR(lRetVal);

// 初始化变量 InitializeAppVariables(); return lRetVal; // Success}

Kevin Qiu1:

回复 HUGH HUGH:

标记的地方需要屏蔽掉

TI 诚邀您参加全新设计的产品页面测试,参加测试即可享有 TI 购物 9 折优惠码,点击加入 EP产品页面测试报名,名额有限。感谢您的参与!

如果回答解决了您的疑问,请帮忙确认答案,谢谢

 

HUGH HUGH:

回复 Kevin Qiu1:

没有用,我主要是想修改UDP客户端连接本机的远程IP地址,不知道是不是修改这个

Kevin Qiu1:

回复 HUGH HUGH:

按下图方法修改就可以了

在串口调试助手中可以看到已经修改成功了

HUGH HUGH:

回复 Kevin Qiu1:

你试试可不可以修改为192.168.16.16

Kevin Qiu1:

回复 HUGH HUGH:

例程默认是192.168.1.x这种,具体请看手册:www.ti.com/…/swru368b.pdf10.6节

赞(0)
未经允许不得转载:TI中文支持网 » CC3200 AP模式下 设置本地IP 一直报错
分享到: 更多 (0)