Author Topic: Rfduino and Galaxy S3 File transfer  (Read 1408 times)


  • RFduino Jr. Member
  • **
  • Posts: 58
  • Karma: +0/-0
    • View Profile
Rfduino and Galaxy S3 File transfer
« on: July 27, 2015, 01:58:22 AM »
Hi all.

I want to enable my data logger based on the RFduino abble to send the logfiles (stored on SD card) to my phone.
I already got it so far, that i can send packets to the phone and receive them correctly (with checksum).

My problem is, that i'm only able to transfer one 20 byte packet correctly during each connection interval.
If i try to send more than 20 bytes (2 or more packets) the Phone recieves only garbage.
It seems the phone does mix up the received data in this case, like as if the next packet is received before
the last one is fully read.
I already tried connection intervals from 50 - 500 ms, all with the same result.

Can anyone point me out how this can be fixed?
I think it should be possible to send at least 3 packets to the phone in one connection interval.

Do i have to delay the sending on RFduino side?
Or may this be an issue on the phone side?

This is how my RFduino test code looks like at the moment :
(i ommitted the handshakeing code via OnReceive cause it already works correctly)

Code: [Select]
void loop()
  if (transferMode == true)
    if (transferACK == true)SendBlock();
    if (transferNACK == true)ResendBlock();

void SendBlock()
  transferACK = false;
  transferNACK = false;
  short cs;
  if (dataFile) {
    cnt = 0;
    memset(&sendBuffer, 0, 120);

    lastFilePosition = dataFile.position();
    while (dataFile.available() && cnt < 116-80) {

      sendBuffer[4+cnt] =;


    memcpy(&sendBuffer[0],&blocks,2); // copy block number to send array
    memcpy(&sendBuffer[2],&cs,2);       // copy chacksum to send array

    // send 6 blocks of data copped to 20 byte portions (this basically works correct, but only with one block at the moment)
    while(!RFduinoBLE.send((char*)&sendBuffer[0], 20));
    while(!RFduinoBLE.send((char*)&sendBuffer[20], 20));
    while(!RFduinoBLE.send((char*)&sendBuffer[40], 20));
    while(!RFduinoBLE.send((char*)&sendBuffer[60], 20));
    while(!RFduinoBLE.send((char*)&sendBuffer[80], 20));
    while(!RFduinoBLE.send((char*)&sendBuffer[100], 20));

    cnt = 0;
    transferACK = true;

  else {
    // if the file isn't open, pop up an error:
    RFduinoBLE_onReceive("AbortTransferFile____________________", 20);