微波EDA网,见证研发工程师的成长!
首页 > 研发问答 > 无线和射频 > TI蓝牙设计交流 > CC2541通知GATT_Notification频率可以达到多快

CC2541通知GATT_Notification频率可以达到多快

时间:10-02 整理:3721RD 点击:

我在SimpleBLEPeripheral.c的performPeriodicTask周期性的上报数据,当设置时间为每秒上报一次,可以正常上报数据,但是当设置上报时间间隔为100ms的时候,上报一小会儿,就直接死机了,请问这个应该是什么问题啊?其实我是希望每10ms上报一次数据的。

下面是上报函数代码:

static uint8 commDataNoti(uint8 *buf,uint16 len)
{
gattAttribute_t *pAttr;
attHandleValueNoti_t noti;
uint16 sendOffset = 0;
uint8 rtnVal = FAILURE;

pAttr = ColaProfileGetAttr();
noti.handle = pAttr->handle;

//循环发送
while(sendOffset < len)
{
uint16 nlen = ((len - sendOffset) > 20) ? 20 : (len - sendOffset);
noti.pValue = (uint8 *)GATT_bm_alloc( 0, ATT_HANDLE_VALUE_NOTI,
GATT_MAX_MTU, &nlen );
noti.len = nlen;
if(noti.pValue != NULL)
{
osal_memcpy(noti.pValue,buf + sendOffset,nlen);
if(!GATT_Notification(0,&noti,FALSE))
{
sendOffset += nlen;
rtnVal = SUCCESS;
}
else
{
rtnVal = FAILURE;
GATT_bm_free((gattMsg_t *)&noti, ATT_HANDLE_VALUE_NOTI);
}
}
}

return rtnVal;
}

请各位大神帮忙分析一下,问题出在哪里?

GATT_Notification这个函数返回22,0x16代表blePending,这个说明真的不能发送频率那么高吗?可有可解之法?

你好,

请参考TI的的参考例程,最快可以做到5.9kbps的速率。

CC2540 Data Throughput


This is example modification of CC2540 SimpleBLEPeripheral application to measure user data throughput. Initial testing shows we can reach 5.9K bytes per second. This is using a 10ms connection interval and 20 user data bytes sent in GATT notifications. 4 notifications are sent every 7ms, based on an OSAL timer. When sending the notifications, a check is made to see if a buffer is available. In all, 1000 notifications are sent. This is 20K bytes, which are sent over 3.35 seconds. 

The project is configured to send a burst of 1000 packets with 20 bytes of data in each one when the left button is pushed on the CC2540 MiniDK keyfob.

Cc2540 throughput 10ms 20byte notify.jpg

链接如下:http://processors.wiki.ti.com/index.php/CC2540_Data_Throughput

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

网站地图

Top