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

cc2541测试传输速率

我想用CC2541两块开发板之间测试蓝牙的传输速率。

在TI提供的simpleBLECentral.c函数中,做了如下修改。即在主从机建立连接之后,通过拨动五向开关往上拨,让主机去发送字节给从机。

每次看LCD屏上的信息,都说我只写成功一次,从机char1中的数据为65,即‘A’。之后的写入全部都失败。我也修改过connection interval,采用过4*1.25ms,10*1.25ms,100*1.25ms,1000*1.25ms这几个值,最多只能写入成功一次,有时候一次都不成功,我想请问是因为什么,造成了这个原因?我应该修改哪里,才可以完成我的测试?

else if ( simpleBLEState == BLE_STATE_CONNECTED &&simpleBLECharHdl != 0 &&simpleBLEProcedureInProgress == FALSE ){uint8 status;uint16 sta_times=0;// Do a read or write as long as no other read or write is in progressif ( simpleBLEDoWrite ){int j;attWriteReq_t req;req.handle = simpleBLECharHdl;req.len = 1;req.sig = 0;req.cmd = 0;for(j = 0; j<20; j++){req.value[0] = 'A'+j;status = GATT_WriteCharValue( simpleBLEConnHandle, &req, simpleBLETaskId );  
			if(status == SUCCESS)
				sta_times++;}LCD_WRITE_STRING_VALUE( "****", req.value[0], 10, HAL_LCD_LINE_4 );system_time = osal_GetSystemClock();
		key_time = system_time - key_time;
		LCD_WRITE_STRING_VALUE( "**aa**", key_time, 10, HAL_LCD_LINE_5 );
		LCD_WRITE_STRING_VALUE( "**aa**", system_time, 10, HAL_LCD_LINE_6 );
		LCD_WRITE_STRING_VALUE( "sta_times", sta_times, 10, HAL_LCD_LINE_7 );
		key_time = system_time;}else{// Do a readattReadReq_t req;req.handle = simpleBLECharHdl;status = GATT_ReadCharValue( simpleBLEConnHandle, &req, simpleBLETaskId );}if ( status == SUCCESS ){simpleBLEProcedureInProgress = TRUE;simpleBLEDoWrite = !simpleBLEDoWrite;}}
kqian0327:

你好,

我们之前有测试过,以下供你参考使用:

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.

Zip File

The Zip file contains a Frontline BPA500 sniffer capture and the modified SimpleBLEPeripheral.c source file.You must add

#define SBP_BURST_EVT0x0008

to the simpleBLEPeripheral.h file in order to compile this new project in the standard SimpleBLEPeripheral project.File:Cc2540 throughput 10ms 20byte notifications.zip – Zip file link 

Sniffer Screen Shot

Cc2540 throughput 10ms 20byte notify.jpg

相关链接见下面地址:

http://processors.wiki.ti.com/index.php/CC2540_Data_Throughput

feng pan:

回复 kqian0327:

你好,kqian0327

     感谢你提供的这丰富的信息,这帮我省去了很多麻烦,谢谢你

     另外,我其实想测试的是,central向peripheral发送数据的速率,我贴出的代码也是基于central程序的改变。尝试从central往peripheral写的时候,用GATT_WriteCharValue函数,除了第一次写入成功,之后都写入失败,返回的status值为22,即blePending,waiting状态。我想知道应该怎么改写我的那段代码,来获得比较准确的主向从写入速率。

     再次感谢您的回复

kqian0327:

回复 feng pan:

你好,

首先如果我的答案可以帮到你,请帮我确认已经有帮到你。

另外你说的你的代码问题,你可以参考附件里面的代码,一步一步的去排查问题点。

feng pan:

回复 kqian0327:

你提供的是从机往主机notify的速率和代码,我想测试的是主机往从机write的速率,我贴出的代码也是central的代码。

赞(0)
未经允许不得转载:TI中文支持网 » cc2541测试传输速率
分享到: 更多 (0)