微波EDA网,见证研发工程师的成长!
首页 > 研发问答 > 无线和射频 > TI无线射频设计 > cc3200使用TI-RTOS,创建任务扫描网络不能获取正确的RSSI

cc3200使用TI-RTOS,创建任务扫描网络不能获取正确的RSSI

时间:12-23 整理:3721RD 点击:

使用cc3200例程scan-polic可以扫描网络,能够获取正确的ssid和rssi,但当使用TI-RTOS时,创建任务运行WlanScan时,不能获取正确的RSSI,而ssid第一个是对的,下面的都是空的。请TI的专家指导下,谢谢!

main函数如下:硬件初始化代码略去

lRetVal = VStartSimpleLinkSpawnTask(SPAWN_TASK_PRIORITY);
if(lRetVal < 0)
{
ERR_PRINT(lRetVal);
Message(" VStartSimpleLinkSpawnTask error\r\n");
LOOP_FOREVER();
}
lRetVal = osi_TaskCreate(WlanScan,
(const signed char *)"wlan",
OSI_STACK_SIZE,
NULL,
1,
NULL );
if(lRetVal < 0)
{
ERR_PRINT(lRetVal);
Message(" osi_TaskCreate error\r\n");
LOOP_FOREVER();
}
osi_start();

}

扫描函数如下:

void WlanScan(void *pvParameters)
{

long lRetVal = -1;

unsigned short ucIndex;
unsigned char ucpolicyOpt;
union
{
unsigned char ucPolicy[4];
unsigned int uiPolicyLen;
}policyVal;
InitializeAppVariables();

lRetVal = ConfigureSimpleLinkToDefaultState();
if(lRetVal < 0)
{
if (DEVICE_NOT_IN_STATION_MODE == lRetVal)
{
UART_PRINT("Failed to configure the device in its default state\n\r");
}

}

UART_PRINT("Device is configured in default state \n\r");

lRetVal = sl_Start(0, 0, 0);
if (lRetVal < 0 || ROLE_STA != lRetVal)
{
UART_PRINT("Failed to start the device \n\r");

}

UART_PRINT("Device started as STATION \n\r");

ucpolicyOpt = SL_CONNECTION_POLICY(0, 0, 0, 0,0);
lRetVal = sl_WlanPolicySet(SL_POLICY_CONNECTION , ucpolicyOpt, NULL, 0);
if(lRetVal != 0)
{
GPIO_IF_LedOn(MCU_EXECUTE_FAIL_IND);
UART_PRINT("Unable to clear the Connection Policy\n\r");

}

ucpolicyOpt = SL_SCAN_POLICY(1);

policyVal.uiPolicyLen = 10;

lRetVal = sl_WlanPolicySet(SL_POLICY_SCAN , ucpolicyOpt,
(unsigned char*)(policyVal.ucPolicy), sizeof(policyVal));
if(lRetVal!=0)
{
UART_PRINT("Unable to set the Scan Policy\n\r");

}
MAP_UtilsDelay(8000000);
while(1)

{
ucIndex = 0;
memset(netEntries, 0, sizeof(netEntries));

lRetVal = sl_WlanGetNetworkList(ucIndex, (unsigned char)WLAN_SCAN_COUNT,
&netEntries[ucIndex]);
if(lRetVal==0)
{

UART_PRINT("Unable to retreive the network list\n\r");
return lRetVal;
}

for(ucIndex=0;ucIndex<lRetVal;ucIndex++)
{
UART_PRINT("ssid:%s\n\r",netEntries[ucIndex].ssid);
UART_PRINT("rssi:%d\n\r",netEntries[ucIndex].rssi);
}

MAP_UtilsDelay(8000000);
}

}

请问使用scan_policy例程为什么扫描到的结果中RSSI值是空的

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top