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

The communictaion is very low when sending many packets using delay

Hi

   I used the SDK 14.2, and download the android source code from guthub. Because I sent many packets(about 100 packets), so the delay should be set in the Android. I tried from 5ms ~ 20ms, and 20ms is ok and none packet lost. If I used 20ms delay, the communication was very slow.  I will list some code of Android and SDK 14.2 paraments.

Android

btnSend.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
byte[] value = new byte[20];//BLE send array
........
mService.writeRXCharacteristic(value);//write to BLE
try {

Thread.sleep(20);//delay 20ms
} catch (InterruptedException e) {

}

In SDK 14.2, BLE paraments is as following:
#define APP_BLE_OBSERVER_PRIO 3 /**< Application's BLE observer priority. You shouldn't need to modify this value. */
#define APP_BLE_CONN_CFG_TAG 1 /**< A tag identifying the SoftDevice BLE configuration. */
#define APP_ADV_INTERVAL 64*25*1 /**< The advertising interval (in units of 0.625 ms; this value corresponds to 40 ms). */
#define APP_ADV_TIMEOUT_IN_SECONDS BLE_GAP_ADV_TIMEOUT_GENERAL_UNLIMITED /**< The advertising time-out (in units of seconds). When set to 0, we will never time out. */
#define MIN_CONN_INTERVAL MSEC_TO_UNITS(50, UNIT_1_25_MS) /**< Minimum acceptable connection interval (0.5 seconds). */
#define MAX_CONN_INTERVAL MSEC_TO_UNITS(80, UNIT_1_25_MS) /**< Maximum acceptable connection interval (1 second). */
#define SLAVE_LATENCY 0 /**< Slave latency. */
#define CONN_SUP_TIMEOUT MSEC_TO_UNITS(4000, UNIT_10_MS) /**< Connection supervisory time-out (4 seconds). */
#define FIRST_CONN_PARAMS_UPDATE_DELAY APP_TIMER_TICKS(20000) /**< Time from initiating event (connect or start of notification) to first time sd_ble_gap_conn_param_update is called (15 seconds). */
#define NEXT_CONN_PARAMS_UPDATE_DELAY APP_TIMER_TICKS(5000) /**< Time between each call to sd_ble_gap_conn_param_update after the first call (5 seconds). */
#define MAX_CONN_PARAMS_UPDATE_COUNT 3 /**< Number of attempts before giving up the connection parameter negotiation. */

#define BUTTON_DETECTION_DELAY APP_TIMER_TICKS(50) /**< Delay from a GPIOTE event until a button is reported as pushed (in number of timer ticks). */

#define DEAD_BEEF 0xDEADBEEF /**< Value used as error code on stack dump, can be used to identify stack location on stack unwind. */


So, could you give me some advice? Thanks!

Parents
  • Hi,

    You have provided too little information for us to be able to tell what is happening.

    What is the "android source code" that you downloaded from Github? There are many source code projects for Android on github, both from us and from others.

    What is the nRF5 SDK v14.2 project? A modified or unmodified example? (Which one?) What characteristic are you writing to?

    What are the BLE roles of the device and of the smartphone running the android application? (Which one is peripheral, and which one is central?)

    What are the connection parameters that you get for the connection? (Connection parameters are decided by the central. Settings on the peripheral side is just a suggestion, which the central can choose to ignore if it wants to.)

    Regards,
    Terje

Reply
  • Hi,

    You have provided too little information for us to be able to tell what is happening.

    What is the "android source code" that you downloaded from Github? There are many source code projects for Android on github, both from us and from others.

    What is the nRF5 SDK v14.2 project? A modified or unmodified example? (Which one?) What characteristic are you writing to?

    What are the BLE roles of the device and of the smartphone running the android application? (Which one is peripheral, and which one is central?)

    What are the connection parameters that you get for the connection? (Connection parameters are decided by the central. Settings on the peripheral side is just a suggestion, which the central can choose to ignore if it wants to.)

    Regards,
    Terje

Children
No Data
Related