Quantcast
Channel: 蓝牙论坛 - 最近的话题
Viewing all articles
Browse latest Browse all 7485

cc2541测试传输速率

$
0
0

我想用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 progress
      if ( 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 read
        attReadReq_t req;
        
        req.handle = simpleBLECharHdl;
        status = GATT_ReadCharValue( simpleBLEConnHandle, &req, simpleBLETaskId );
      }
      
      if ( status == SUCCESS )
      {
        simpleBLEProcedureInProgress = TRUE;
        simpleBLEDoWrite = !simpleBLEDoWrite;
      }
    }

Viewing all articles
Browse latest Browse all 7485

Trending Articles