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

integrating the throughput example into the ble_cli example

Is there a way to create a command that gets throughput information from a device in the ble_app_interactive example? I want to get the throughput of a peripheral device once it is connected. 

Parents
  • Hi,

    Do you want to measure throughput for transmit or receive? You may create a new repeated timer instance with the app timer library included in the example and count the number of received/transmitted bytes per time unit. It might be easier than trying to port code from the throughput example.

  • Vidar,

    Thank you for your reply! I am now printing the rssi value of peripheral devices in the device display command in the command-line interface. I would like to print the throughput value next to the rssi value to receive. 

    I understand that the devices will probably need to be connected in order to read the throughput, so should I move the rssi print to another spot with the throughput? Can I incorporate the app timer library in with the cli example?

  • You need to be connected to measure throughput, as you said. You also have to explicitly enable RSSI sampling to get RSSI samples while connected, unlike scan mode (RSSI get sample / RSSI for connections with event filter).

    The app timer is already included in the project so that you can easily create a new timer instance. I used the same approach to measure throughput with the ble_app_uart example for another case. Including the code here in case it helps.

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    /**
    * Copyright (c) 2014 - 2018, Nordic Semiconductor ASA
    *
    * All rights reserved.
    *
    * Redistribution and use in source and binary forms, with or without modification,
    * are permitted provided that the following conditions are met:
    *
    * 1. Redistributions of source code must retain the above copyright notice, this
    * list of conditions and the following disclaimer.
    *
    * 2. Redistributions in binary form, except as embedded into a Nordic
    * Semiconductor ASA integrated circuit in a product or a software update for
    * such product, must reproduce the above copyright notice, this list of
    * conditions and the following disclaimer in the documentation and/or other
    * materials provided with the distribution.
    *
    * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
    * contributors may be used to endorse or promote products derived from this
    * software without specific prior written permission.
    *
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

  • Thanks so much, Vidar! This helps Slight smile Where should I go to enable RSSI sampling while connected using the throughput example? I want the RSSI, from one semiconductor to the other, to print out underneath the final throughput value.  

Reply
  • Thanks so much, Vidar! This helps Slight smile Where should I go to enable RSSI sampling while connected using the throughput example? I want the RSSI, from one semiconductor to the other, to print out underneath the final throughput value.  

Children
  • Glad you found it helpful:) You can call sd_ble_gap_rssi_start() when the connection has been established to enable RSSI sampling, but keep in mind that the RSSI can vary a lot between packets so I think it would make sense to print out an average RSSI value underneath the final throughput number.

  • Hello Ella;

    Could you please tell me how can you measure the throughput and rssi at the same time, I have tried for sereval days to do this but failed,  

    I just use the SEGGER open the project as below, this project can do throughput test

    then I put the code below (I find them on the Internet) in to the main.c

    bu it doesn't work, no rssi data was printed

  • Maybe you've done it already but the on_ble_evt() function needs to be registered as an observer like nrf_ble_amtc_on_ble_evt and nrf_ble_amts_on_ble_evt in order for it to receive events from the Softdevice Another alternative is to use the existing BLE event handler in amts.c.

    E.g., A simple approach. Print RSSI every time it changes with more than 10dB: 

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    diff --git a/examples/ble_central_and_peripheral/experimental/ble_app_att_mtu_throughput/amts.c b/examples/ble_central_and_peripheral/experimental/ble_app_att_mtu_throughput/amts.c
    index 3810e21..bb3b250 100644
    --- a/examples/ble_central_and_peripheral/experimental/ble_app_att_mtu_throughput/amts.c
    +++ b/examples/ble_central_and_peripheral/experimental/ble_app_att_mtu_throughput/amts.c
    @@ -66,7 +66,12 @@ static void char_notification_send(nrf_ble_amts_t * p_ctx);
    */
    static void on_connect(nrf_ble_amts_t * p_ctx, ble_evt_t const * p_ble_evt)
    {
    + uint32_t err_code;
    +
    + err_code = sd_ble_gap_rssi_start(p_ble_evt->evt.gap_evt.conn_handle, 10, 0);
    + APP_ERROR_CHECK(err_code);
    p_ctx->conn_handle = p_ble_evt->evt.gap_evt.conn_handle;
    +
    }
    @@ -145,6 +150,10 @@ void nrf_ble_amts_on_ble_evt(ble_evt_t const * p_ble_evt, void * p_context)
    on_tx_complete(p_ctx);
    break;
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

  • Thanks very much, I finally get the RSSI successfully .