This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Large data transfer over ble.

Hi,

I would like to have a system such as follows:

  • Taking sensor data storing it locally till around 100 samples (Once per second)
  • Log this data to the SD with a time stamp
  • Then storing this data to an external SD card. (Utilising the fatfs example code in the SDK) Around  2 Mbytes
  • I then want a mobile device to request this data.

What therefore, is the best way of transferring the data from the SD card to BLE to be picked up by the mobile application.

Do I need to set up a GATT connection and wait on a notification change that I set in the Nordic board?

If so is there an example of this or a good starting point.

Would this post be a good starting point? : https://devzone.nordicsemi.com/f/nordic-q-a/553/dealing-large-data-packet-s-through-ble

If so what example is good to work from. Thanks

Parents
  • Hi Thomas

    Thomas said:
    Then when press connect nothing is populated within the services menu also, I am chucking the data out to a RTT viewer. When I press connect I stop my live advertising Via a boolean that is set from the ble_evt_handler connected state. Then I can see the services.

    I'm not entirely sure what you mean here. Do you have to press connect twice for the device to connect to your central properly? The fact that it stops advertising when you connect makes sense, as it is connecting and won't be able to advertise during that process, as the nRF52 series only has one radio.

    As for the disconnect you are seeing, BLE_GATTS_EVT_TIMEOUT means that a peer failed to respond to an ATT request in time, and that makes the central disconnect from your peripheral. So somewhere your peripheral is ignoring an ATT request from the central which causes this disconnect. You can see ble_gatts_evt_timeout_t for more information on this disconnect reason.

    Best regards,

    Simon

  • Hi Simon,

    Sorry the confusion let me clarify.

    I can advertise whilst no connection is active and have changing adverts that works fine.

    Then from the main NRF connect screen when I see the list of devices I have the option to connect to the device as you would expect. From there I can see the services with the device. 

    However, when I then disconnect from this my advert does not come back and I get the aforementioned fatal error.

    I want my advertising to restart on a disconnect. I am not sure why this is not the case.

    In my main code I have the following:

     while (true)
        {
            if(GATT_CONNECTED == false)
            {
              // Get next gyte from FIFO
              while (app_uart_get(&c) != NRF_SUCCESS);
              string[pos] = c;
    
              // Assume that all strings end with \n. If end, print and start over.
              if (string[pos] == '\n')
              {
                  string[pos+1] = '\0';
                  NRF_LOG_INFO("Received string: \"%s\"", string);
                  sscanf( string, "%*d , %d , %*d , %d ", &T1_data_1,&T2_data_1);
                  NRF_LOG_INFO("T1 is:\"%d\"", T1_data_1);
                  NRF_LOG_INFO("T2 is:\"%d\"", T2_data_1);
                  pos = 0;
                  counter++;
                  idle_state_handle();
                  data_changed = true;
                  //converted_number =  toBinary(T1_data_1);
                  if(data_changed==true)
                  {
                    advertising_mod(counter,T1_data_1,T2_data_1,00,00,70,80,70,80);//Only have two temperature sensors
                    data_changed = false;
                  }
              }
              else
              {
                  pos++;
                
              }
           }
           else// GATT_CONNECTED = true
           {
               idle_state_handle();
           }
        }

    GATT_CONNECTED is a boolean I have created. I set this to true in the ble_evt_handler within the case BLE_GAP_EVT_CONNECTED case. And I also set it to false on the disconnected case.

    I am not sure why the advert itself does not restart. Note I am using a modified ble_app_pwr_profiling example.

Reply
  • Hi Simon,

    Sorry the confusion let me clarify.

    I can advertise whilst no connection is active and have changing adverts that works fine.

    Then from the main NRF connect screen when I see the list of devices I have the option to connect to the device as you would expect. From there I can see the services with the device. 

    However, when I then disconnect from this my advert does not come back and I get the aforementioned fatal error.

    I want my advertising to restart on a disconnect. I am not sure why this is not the case.

    In my main code I have the following:

     while (true)
        {
            if(GATT_CONNECTED == false)
            {
              // Get next gyte from FIFO
              while (app_uart_get(&c) != NRF_SUCCESS);
              string[pos] = c;
    
              // Assume that all strings end with \n. If end, print and start over.
              if (string[pos] == '\n')
              {
                  string[pos+1] = '\0';
                  NRF_LOG_INFO("Received string: \"%s\"", string);
                  sscanf( string, "%*d , %d , %*d , %d ", &T1_data_1,&T2_data_1);
                  NRF_LOG_INFO("T1 is:\"%d\"", T1_data_1);
                  NRF_LOG_INFO("T2 is:\"%d\"", T2_data_1);
                  pos = 0;
                  counter++;
                  idle_state_handle();
                  data_changed = true;
                  //converted_number =  toBinary(T1_data_1);
                  if(data_changed==true)
                  {
                    advertising_mod(counter,T1_data_1,T2_data_1,00,00,70,80,70,80);//Only have two temperature sensors
                    data_changed = false;
                  }
              }
              else
              {
                  pos++;
                
              }
           }
           else// GATT_CONNECTED = true
           {
               idle_state_handle();
           }
        }

    GATT_CONNECTED is a boolean I have created. I set this to true in the ble_evt_handler within the case BLE_GAP_EVT_CONNECTED case. And I also set it to false on the disconnected case.

    I am not sure why the advert itself does not restart. Note I am using a modified ble_app_pwr_profiling example.

Children
No Data
Related