Due to high demand expect some shipping delays at this time, orders may not ship for 3-4 business days. On MLK Day no orders will be shipped.
0

FEATHER NRF52840: TRANSMIT LARGE FILES OVER BLE
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

FEATHER NRF52840: TRANSMIT LARGE FILES OVER BLE

by matead on Wed Dec 08, 2021 5:29 am

Hi. How can I transfer a file of 2,101 bytes over Bluetooth Low-Energy? I've tried using something like

Code: Select all | TOGGLE FULL SIZE
clientUart.print((char *)INCLUDED_DATA);
but it doesn't seem to like that (possible buffer overflow I assume).
Any suggestions?

Thanks.

matead
 
Posts: 6
Joined: Tue Oct 26, 2021 12:31 am

Re: FEATHER NRF52840: TRANSMIT LARGE FILES OVER BLE

by adafruit_support_mike on Wed Dec 08, 2021 8:41 pm

Each BLE packet can hold 20 bytes of data. Try splitting the data into chunks that size and sending them one at a time.

adafruit_support_mike
 
Posts: 63928
Joined: Thu Feb 11, 2010 2:51 pm

Re: FEATHER NRF52840: TRANSMIT LARGE FILES OVER BLE

by matead on Wed Dec 08, 2021 11:12 pm

Ah right. That makes sense. Hence,

Code: Select all | TOGGLE FULL SIZE
      if ( Serial.available() )
      {
        delay(2); // delay a bit for all characters to arrive
       
        char str[20+1] = { 0 };
        Serial.readBytes(str, 20);
       
        clientUart.print( str );
      }
20 bytes plus 1 for the NULL terminator. I will design a protocol to handle the packets so I can send >20 bytes.

Thanks.

matead
 
Posts: 6
Joined: Tue Oct 26, 2021 12:31 am

Re: FEATHER NRF52840: TRANSMIT LARGE FILES OVER BLE

by adafruit_support_mike on Fri Dec 10, 2021 4:46 pm

Glad to help. Happy hacking!

adafruit_support_mike
 
Posts: 63928
Joined: Thu Feb 11, 2010 2:51 pm

Please be positive and constructive with your questions and comments.