FEATHER NRF52840: TRANSMIT LARGE FILES OVER BLE

For Adafruit customers who seek help with microcontrollers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
matead
 
Posts: 9
Joined: Tue Oct 26, 2021 12:31 am

FEATHER NRF52840: TRANSMIT LARGE FILES OVER BLE

Post by matead »

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

Code: Select all

clientUart.print((char *)INCLUDED_DATA);
but it doesn't seem to like that (possible buffer overflow I assume).
Any suggestions?

Thanks.

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: FEATHER NRF52840: TRANSMIT LARGE FILES OVER BLE

Post by adafruit_support_mike »

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

User avatar
matead
 
Posts: 9
Joined: Tue Oct 26, 2021 12:31 am

Re: FEATHER NRF52840: TRANSMIT LARGE FILES OVER BLE

Post by matead »

Ah right. That makes sense. Hence,

Code: Select all

      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.

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: FEATHER NRF52840: TRANSMIT LARGE FILES OVER BLE

Post by adafruit_support_mike »

Glad to help. Happy hacking!

Locked
Please be positive and constructive with your questions and comments.

Return to “Microcontrollers”