adafruit / Adafruit_nRF52_Arduino

Adafruit code for the Nordic nRF52 BLE SoC on Arduino
Other
623 stars 497 forks source link

The speed of throughput is very slow #636

Closed ChenRoss closed 3 years ago

ChenRoss commented 3 years ago

I have two nRF52832. One is peripheral with image_eink_transfer.ino and connects to a 2.9 inch epaper. Another one is central with central_throughput.ino but i don't use the UART just send the image directly as below

if ( clientUart.discovered() )
{
  uint8_t Send_HEAD[8] = {0x21, 0x49, 0x18, 0x28, 0x01, 0x80, 0x00, 0x00};
  clientUart.write( &Send_HEAD[0], 8 );
  uint8_t Send_IMAGE[200] = {0};
  clientUart.write( &Send_IMAGE[0], 64 );     
  for(uint32_t i=0; i<568; i++)
  {
    clientUart.write( &Send_IMAGE[0], 200 );
  }
}

It takes about 42 second to send the image totally 113672 bytes. But if i delete the code if ( !conn->getWriteCmdPacket() ) break; in the write function in BLEClientCharacteristic.cpp. And the code above changes as below

if ( clientUart.discovered() )
{
  uint8_t Send_HEAD[8] = {0x21, 0x49, 0x18, 0x28, 0x01, 0x80, 0x00, 0x00};
  clientUart.write( &Send_HEAD[0], 8 );
  delay(5);
  uint8_t Send_IMAGE[200] = {0};
  clientUart.write( &Send_IMAGE[0], 64 );
  delay(5);     
  for(uint32_t i=0; i<568; i++)
  {
    clientUart.write( &Send_IMAGE[0], 200 );
    delay(10);
  }
}

It takes about 5.7 second to send the image. It seems that the getWriteCmdPacket() takes too much time. I hope the speed can be as fast as the Bluefruit Connect APP. Is there any suggestion to increase the speed.

hathach commented 3 years ago

closed since it is more like an question than report