how can i get the number BLE TX re transmissions

hello Nordic

i am working with nrf52832 and nrf52840 socs, with ncs v2.1.0

i would like to know how many of the BLE packets i am sending has to be resent (and if it is possible to know the reason of resent, in case there is another reason beside packet missed some bytes/bits on the OTA way, that would be great as well ) 

any idea how can i get that info ?

also another question, if i move (with BLE 4.2 and above) to extended length packets, to increase throughput, should there be more resent packets since the risk of loosing data in a larger packet is greater ?

hope to read you soon

best regards

Ziv

Parents
  • hi Sigurd

    You can get this info as an QoS Connection Event Report.

    i looked at the link you added and i have some questions, 

    1. if i want the count of re-transmission i actually need to sum the count of naks, crc fails and rx timeouts ? is there a better way to get how many BLE packets i sent more then once ? 

    2. when referring to event counter, does it counts number of connection event with in an established connection ? and does the above counts are counted within a connection event or throughout all the time the 2 devices are connected ? 

    one clarification, i m tx'ing a lot of data so in one connection session i will probably have many BLE connection events  

    3. if i can get the number of connection events, is it possible for me from one side (peripheral) to dictates / ask for a longer connection event in order to have less connection intervals and so more throughput ?

    4. at some point i will move to BLE 4.2 or above on the non Nordic central and then i will be able to use extended BLE packet length, sending bigger packets, might result in more packets needed to be resend cause bigger packets may have greater risk of missing some data on transmission ?

    hope to read you soon

    best regards

    Ziv

  • Hi,            

    Set CONFIG_BT_LL_SW_SPLIT=n

    this much i know,  but the the whole API used on our BLE comm module will have to change now 

    and my question is is there some API correlation doc to switch to softdevice controller from zephyr controller ?

    - what modules are used in softdevice that correlate and if i try to deep dive into my current zephyr controller APIs until i get to an NCS ones, could i just use them directly ? (not sure you can answer that but i am trying Slight smile )

     - where can i find some comparison between the 2 BLE stacks cause changing the BLE stacks may change much more things in the connection and throughput etc. 

    also i need to know if by moving to softdevice controller i am loosing some zephyr's controller features ? 

    and lastly is it actually preferable to move to softdevice controller from currently implemented zephyr controller assuming we are going to keep on working with nrf52832 and nrf52840 for a list few more years ? what are the pros and cons of that transition ?

    hope to read you soon

    best regards

    Ziv                           

  • ziv123 said:
    this much i know,  but the the whole API used on our BLE comm module will have to change now 

    I don't see why, Both the SoftDevice Controller and the Zephyr Controller, uses the Zephyr Bluetooth Host, and the Zephyr Bluetooth Host API can be used by both controllers.

    ziv123 said:
    also i need to know if by moving to softdevice controller i am loosing some zephyr's controller features ? 

    I'm not aware of any features you might lose. Is there anything you have in mind ?

    ziv123 said:
    and lastly is it actually preferable to move to softdevice controller from currently implemented zephyr controller assuming we are going to keep on working with nrf52832 and nrf52840 for a list few more years ? what are the pros and cons of that transition ?

    The SoftDevice Controller is the recommended controller. It's what we test and qualify. 

  • I don't see why, Both the SoftDevice Controller and the Zephyr Controller, uses the Zephyr Bluetooth Host, and the Zephyr Bluetooth Host API can be used by both controllers.

    if i change to =n (only that change) then i get:

    ASSERTION FAIL [((((prio)) == 10 && z_is_idle_thread_entry((entry))) || (((10 - 1) >= ((-5))) && ((prio)) >= ((-5)) && ((prio)) <= (10 - 1)))] @ WEST_TOPDIR/zephyr/kernel/thread.c:536
    00> 
    00>   invalid priority (10); allowed range: 9 to -5
    00> 
    00> [00000001] <err> os: ***** USAGE FAULT *****
    00> [00000001] <err> os:   Attempt to execute undefined instruction
    00> [00000001] <err> os: r0/a1:  0x00008001  r1/a2:  0x20022b40  r2/a3:  0x0004ae97
    00> [00000001] <err> os: r3/a4:  0x20026c30 r12/ip:  0x00000000 r14/lr:  0x0003ed4b
    00> [00000001] <err> os:  xpsr:  0x61000000
    00> [00000001] <err> os: s[ 0]:  0x00000000  s[ 1]:  0x00000000  s[ 2]:  0x00000000  s[ 3]:  0x00000000
    00> [00000001] <err> os: s[ 4]:  0x00000000  s[ 5]:  0x00000000  s[ 6]:  0x00000000  s[ 7]:  0x00000000
    00> [00000001] <err> os: s[ 8]:  0x00000000  s[ 9]:  0x00000000  s[10]:  0x00000000  s[11]:  0x00000000
    00> [00000001] <err> os: s[12]:  0x00000000  s[13]:  0x00000000  s[14]:  0x00000000  s[15]:  0x00000000
    00> [00000001] <err> os: fpscr:  0x00000000
    00> [00000001] <err> os: r4/v1:  0x200055c8  r5/v2:  0x00000388  r6/v3:  0x00000000
    00> [00000001] <err> os: r7/v4:  0x20022b50  r8/v5:  0x0003ca55  r9/v6:  0x0000000a
    00> [00000001] <err> os: r10/v7: 0x00000000  r11/v8: 0x00000000    psp:  0x20022ad8
    00> [00000001] <err> os: EXC_RETURN: 0xffffffed
    00> [00000001] <err> os: Faulting instruction address (r15/pc): 0x0003ed4a
    00> *** Booting Zephyr OS build v3.1.99-ncs1  ***
    00> I: Reset Reason, RESETREAS=0x4
    00> I: Reset Causes: 
    00> I:  Software
    00> I: GNU Build ID: 80e5e918576521287483c25ad58831d4437782b8

    in my init flow

    any idea why this is ?

    maybe it has something to do with me working with pm_static and maybe the softdevice needs to be given some defined specific place ?

    hope to read you soon

    best regards

    Ziv 

  • ok the problem i mentioned here is solve

    needed to increase config 'CONFIG_NUM_PREEMPT_PRIORITIES'  from =10 to =15 

    cause it ASSERTED here on the thread creation 
    void hci_ecdh_init(void)
    {
    #if !defined(CONFIG_BT_CTLR_ECDH_IN_MPSL_WORK)
    	k_poll_signal_init(&ecdh_signal);
    
    	k_thread_create(&ecdh_thread_data, ecdh_thread_stack,
    			K_KERNEL_STACK_SIZEOF(ecdh_thread_stack), ecdh_thread,
    			NULL, NULL, NULL, K_PRIO_PREEMPT(10), 0, K_NO_WAIT);
    	k_thread_name_set(&ecdh_thread_data, "BT CTLR ECDH");
    #else
    with the mentioned error
    ASSERTION FAIL [((((prio)) == 10 && z_is_idle_thread_entry((entry))) || (((10 - 1) >= ((-5))) && ((prio)) >= ((-5)) && ((prio)) <= (10 - 1)))] @ WEST_TOPDIR/zephyr/kernel/thread.c:536
    00> 
    00>   invalid priority (10); allowed range: 9 to -5
    1. however, i added a counter to each callback, which as for i understand is called ofr each connection event, but the count set at 14371 but the 'evt->event_counter' gives 2937412, so what does it count and what each entry to the callback represents ?
    this is my callback, a small modification from the llpm sample
    static bool on_vs_evt(struct net_buf_simple *buf)
    {
        uint8_t                                      code;
        sdc_hci_subevent_vs_qos_conn_event_report_t *evt;
        e_counter++;
        code = net_buf_simple_pull_u8(buf);
        if (code != SDC_HCI_SUBEVENT_VS_QOS_CONN_EVENT_REPORT)
        {
            return false;
        }
    
        evt = (void *)buf->data;
        con_event_info.nak_count += evt->nak_count;
        con_event_info.crc_err_count += evt->crc_error_count;
        con_event_info.timeout_disconnection_count += evt->rx_timeout;
    
        con_event_info.con_event_count += evt->event_counter;
    
        return true;
    }
    2. moving to softdevice controller increased ram take by 5% and also flash take, is there a way to configure for use only feature or something to decrease the memory take ?
    hope to read you soon
    best regards
    ziv
  • Hi,

    1)

    ziv123 said:
    1. however, i added a counter to each callback, which as for i understand is called ofr each connection event, but the count set at 14371 but the 'evt->event_counter' gives 2937412, so what does it count and what each entry to the callback represents ?

    You don't need to do any increment for the event_counter yourself. The event will give you the event_counter directly.

    2) Will be covered here:  reduce RAM and flash take by softdevice controller 

Reply Children
  • You don't need to do any increment for the event_counter yourself. The event will give you the event_counter directly.

    i am trying to understand the diff between the values 

    if the event_counter is increment by 1 each time the callback is called the 2 values (mt counter and the event_counter) should have been equal ???

  • Hi,

    ziv123 said:
    i am trying to understand the diff between the values 


    What values do you mean now?

    evt->event_counter  ,  con_event_info.con_event_count , e_counter ?

  • e_counter  vs  evt->event_counter

    volatile uint32_t e_counter = 0;
    static bool       on_vs_evt(struct net_buf_simple *buf)
    {
        uint8_t                                      code;
        sdc_hci_subevent_vs_qos_conn_event_report_t *evt;
        e_counter++;
        code = net_buf_simple_pull_u8(buf);
        if (code != SDC_HCI_SUBEVENT_VS_QOS_CONN_EVENT_REPORT)
        {
            return false;
        }
    
        evt = (void *)buf->data;
        con_event_info.nak_count += evt->nak_count;
        con_event_info.crc_err_count += evt->crc_error_count;
        con_event_info.timeout_disconnection_count += evt->rx_timeout;
    
        con_event_info.con_event_count = evt->event_counter;
    
        return true;
    }

    this are the printed values,

    /// print values on disconnection:
    static void disconnect(struct k_work *work)
    {
        LOG_INF("event log: naks %d, crc %d, timeouts %d, events %d", con_event_info.nak_count, con_event_info.crc_err_count,
                con_event_info.timeout_disconnection_count, con_event_info.con_event_count);
        con_event_info.nak_count = 0;
        con_event_info.crc_err_count = 0;
        con_event_info.timeout_disconnection_count = 0;
        con_event_info.con_event_count = 0;
    
        comm_mng_disconnect_ble_blocking();
    }
    
    //// output
    counter 9032 event log: naks 62, crc 9, timeouts 23, events 4423

    what can cause the diff ? 

    another question i have - is it possible to have the report start at some point after the connection between end point and node was established and not from the first moment of connection ? (i ask that in order to get better resolution of number of connection event and re transmissions at the stage of big data transfer which is not always start right at the start of the connection)

    hope to read you soon

    best regards

    Ziv

  • Hi,

    ziv123 said:
    what can cause the diff ? 

    Based on my testing, if the SDC e.g. dropped a connection event, i.e. it was blocked for some reason(see link below), you will not get the callback. But the connection event counter is still incremented internally. And next time you get the callback, it will show you the updated counter value that matches the current connection event number.

    https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrfxlib/softdevice_controller/doc/scheduling.html#timing-activities-and-priorities

    ziv123 said:
    another question i have - is it possible to have the report start at some point after the connection between end point and node was established and not from the first moment of connection ?

    Yes, you can enable/disable this reporting as needed.

  • Hi, 

    thanks, for the patient and help :) few more questions  

    Yes, you can enable/disable this reporting as needed.

    1. is there some example or place to look for how to enable it after a connection was establish and disable before a connection is terminated ?

    2. i got values when analysing my data transfer connection via different Rssi values while Node is also scanning for another device that is in it's white list. i am trying to understand what can i understand by the type of fails i get. 

    when having more then one device in the Node white list with rssi ~40 : i get around 8300 timeouts and ~330 naks but only ~12 crc fails. total connection events count ~11330

    when i have one device in the white list with same rssi, i get around 200 timeouts, ~350 naks and ~8crc. total connection events count ~ 5660

    with more then one device in Node white list but with rssi ~70 : ~8800 timeouts, ~560 naks (in compare to ~330), ~200 crc (in compare to ~12). total ~11820 

    i guess crc fail is caused by some bit miss but then what may be the reason to receive naks ?

    also what can i learn on the connection if i get so many timeouts on one state and much less on another state (rssi on both tests was the same), and what is the different causes for timeouts that explains the different values in comparison to the other two reasons ? 

    in all cases total data size transmitted is the same.so also when trying to calculate how many re transmission and how many total connection events it seems that there is no "gold" number of connection events to transfer a known size of data it varies a lot from case to case. is there something to learn from looking on how many re  transmissions and total connection events count ?

    hope to read you soon

    best regards

    Ziv

Related