TI中文支持网
TI专业的中文技术问题搜集分享网站

CC26x2搜索 死机

您好:

使用CC2652R1测试central工程,使一直处于扫描状态,出现死机。

修改内容为:在static void SimpleCentral_init(void)函数的最后一句添加GapScan_enable(0, 0, 0);。其他没有修改任何地方。

死机时出现的现象为:

请问这是什么原因,谢谢。

Kevin Qiu1:

看下关于这个函数的说明, 注意duration 持续时间应为大于GapScan_setPhyParams设置的扫描间隔时间
,设为0就会出现问题/*** Start scanning.** If duration is zero period shall be ignored and the scanner will continue* scanning until @ref GapScan_disable is called.* If period is zero and duration is non-zero, the scanner will scan once* until duration has expired or @ref GapScan_disable is called.* If both the duration and period are non-zero, the scanner will continue* scanning periodically until @ref GapScan_disable() is called.** @param period - Scan period. Ignored if duration is zero. 1.28 sec unit.*Range: 0x00-0xffff, where 0x00 is continuously scanning.* @param duration - Scan duration. 10 ms unit. The time of duration shall be*greater than the time of scan interval set by @ref GapScan_setPhyParams.*Range: 0x00-0xffff, where 0x00 is continuously scanning.* @param maxNumReport - If non-zero, the list of advertising reports (the number*of which is up to maxNumReport) will be generated and come with*@ref GAP_EVT_SCAN_DISABLED.** @return @ref SUCCESS* @return @ref bleNotReady* @return @ref bleInvalidRange* @return @ref bleMemAllocError* @return @ref bleAlreadyInRequestedMode* @return @ref bleIncorrectMode*/
status_t GapScan_enable(uint16_t period, uint16_t duration,uint8_t maxNumReport);

user4020443:

回复 Kevin Qiu1:

谢谢,如果我改为GapScan_enable(2, 100, 0);,扫描间隔为800(500ms),这样的话,只会扫描一次。但是如果按照说明应该是1.28*2秒周期扫描才对吗?

Kevin Qiu1:

回复 user4020443:

是的,但是还要看扫描窗口,扫描窗口=扫描间隔的话也是在一直扫描,所以在例程中用的是
GapScan_enable(0,DEFAULT_SCAN_DURATION,0)

user4020443:

回复 Kevin Qiu1:

但是定时执行GapScan_enable(0,DEFAULT_SCAN_DURATION,0)函数,参数采用默认参数,就会死机

user4020443:

回复 Kevin Qiu1:

scan interval和scan window都是800(500ms),duration是100(1000ms),但是为什么GapScan_enable(2, 100, 0);只扫描一次就结束了?

Kevin Qiu1:

回复 user4020443:

你想实现什么功能,扫描连接从机的话直接用例程就行了,不需要修改

user4020443:

回复 Kevin Qiu1:

我想用multirole主从一体这个工程,能够连接上一次连接的从机,并且能够连接2个从机。直接可以用multirole这个工程就能实现吗?

Kevin Qiu1:

回复 user4020443:

可以的,multirole例程最多可以连接8个从机

user4020443:

回复 Kevin Qiu1:

谢谢,但是我关注点不是在连接多少个从机,而是要连接上一次连接的从机,也就是我必须要一直去扫描,但是就是一直去扫描的时候就会死机。我的关注点在于要一直扫描不会出现死机问题。麻烦了

Kevin Qiu1:

回复 user4020443:

换个方法试试,主机扫描结束后,应用层任务会收到响应的事件通知,你可以在这个事件通知的处理中重新开启扫描,这样就实现了循环扫描了,不过扫描功耗很高,不同于从机的广播。

赞(0)
未经允许不得转载:TI中文支持网 » CC26x2搜索 死机
分享到: 更多 (0)