我现在先移植CC3100驱动,再基于CC3200中tcp_socket代码进行修改,进行测试。(CC3100+Tiva能够正常联网,CC3100驱动移植是基于CC3100的SDk进行的)
目前遇到的问题是:
1、在初始化变量后,调用ConfigureSimpleLinkToDefaultState()函数,程序移植在while中死循环,不能获取IP地址。这是什么原因导致的呢?
2、 如果将这段代码注释掉,直接调用后面的sl_DevGet()函数,获取设备版本信息,获取的结果也不太正确,并且会调用SimpleLinkGeneralEventHandler()函数,直至最后返回错误代码。以上的问题是驱动移植有问题吗?如果是,为什么sl_start()能够正常返回值2呢?
// If the device is not in station-mode, try configuring it in station-mode if (ROLE_STA != lMode)
{
if (ROLE_AP == lMode)
{
// If the device is in AP mode, we need to wait for this event // before doing anything while(!IS_IP_ACQUIRED(g_ulStatus))
{
#ifndef SL_PLATFORM_MULTI_THREADED
_SlNonOsMainLoopTask();#endif
}
}
// Switch to STA role and restart lRetVal = sl_WlanSetMode(ROLE_STA);
ASSERT_ON_ERROR(lRetVal);
lRetVal = sl_Stop(0xFF);
ASSERT_ON_ERROR(lRetVal);
lRetVal = sl_Start(0, 0, 0);
ASSERT_ON_ERROR(lRetVal);
// Check if the device is in station again if (ROLE_STA != lRetVal)
{
// We don't want to proceed if the device is not coming up in STA-mode return DEVICE_NOT_IN_STATION_MODE;
}
}
Viki Shi:
请问是移植到什么平台?
A A4:
回复 Viki Shi:
基于RISCV的Hifive1开发板上
A A4:
回复 Viki Shi:
如果我不调用ConfigureSimpleLinkToDefaultState()函数,直接写以下代码,会输出错误:GENERAL EVENT[GENERAL EVENT] – ID=[-127] Sender=[0] 并且sl_Start 返回值为0,sl_WlanDisconnect返回值为-100;
if (_initialized) {return 1;}int iRet = sl_Start(0, 0, 0);printf("sl_Start iRet : %d \r\n",iRet);if (iRet==ROLE_STA_ERR || iRet==ROLE_AP_ERR || iRet==ROLE_P2P_ERR) {return 0;}
if (iRet != ROLE_STA) {sl_WlanSetMode(ROLE_STA);sl_Stop(0);sl_Start(0, 0, 0);}iRet = sl_WlanDisconnect();printf("sl_WlanDisconnect iRet : %d \r\n",iRet);
Yonghua Pan:
回复 A A4:
操作系统是什么,你移植的修改是在哪里,应该只需要改user.h就可以了的。
TI中文支持网


