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

    Seeing as you're using the ble_app_pwr_profiling example, how are you handling the BLE_GAP_EVT_DISCONNECTED in your ble_evt_handler? By default, the ble_app_pwr_profiling example is handling it by going to system OFF mode upon a disconnection, which might be why your device doesn't start advertising upon a disconnect. Try handling the disconnect event like the ble_app_uart example does, as that example does start advertising automatically upon a disconnect.

    Best regards,

    Simon

Reply
  • Hi Thomas

    Seeing as you're using the ble_app_pwr_profiling example, how are you handling the BLE_GAP_EVT_DISCONNECTED in your ble_evt_handler? By default, the ble_app_pwr_profiling example is handling it by going to system OFF mode upon a disconnection, which might be why your device doesn't start advertising upon a disconnect. Try handling the disconnect event like the ble_app_uart example does, as that example does start advertising automatically upon a disconnect.

    Best regards,

    Simon

Children
  • Hi Simon,

    Cheers for that, it makes perfect sense. So I have now changed, my ble_evt_handler with the disconnected case to:

    case BLE_GAP_EVT_DISCONNECTED:
                err_code = sd_ble_gap_disconnect(m_conn_handle, BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION);
                err_code = ble_advertising_restart_without_whitelist(&advertising_mod);
                    if (err_code != NRF_ERROR_INVALID_STATE)
                    {
                        APP_ERROR_CHECK(err_code);
                    }
                    GATT_CONNECTED = false;//Enable the live advertising
                break;

    This is similar to the UART example you suggested. However, I changed the parameter to advertising_mod from m_advertising. This was due to a compile error stating it was undefined and recommending advertising_mod.

    This still causes a fatal error on disconnect. This error comes from the uarte_evt_handler going to the fifo m_event_handler(&app_uart_event);

    This happens a few seconds after I press disconnect on the app.

    I have also tried using advertising_start();

    That functionality looks like below:

    static void advertising_start(void)
    {
        ret_code_t err_code;
    
        err_code = sd_ble_gap_adv_start(m_adv_handle, APP_BLE_CONN_CFG_TAG);
        APP_ERROR_CHECK(err_code);
    }
    

    However, this does also not work.

Related