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

Trying to implement S132 SD with SDK 15.2.0 for nRF52810. Please help me understand few things.

I’m using nRF52810 in my design and for BLE communication I want to use Data Length Extension (DLE). Currently I’m using SDK v 15.2.0 , S112 and since DLE cannot take place in S112 but in S132, I came across that S132 has been production tested for nRF52810 SDK v14.2.0. Now since my design is currently implemented on 15.2.0, I don’t want to change my SDK version but at the same time use S132 for DLE.

Q1. Even though S132 with SDK 15.2.0 for nRF52810 is not production tested yet, can it still be implemented? If yes, what are the important considerations to keep in mind for the project to run as smoothly as it currently does with S112.

Q2. I followed shorturl.at/qrJQ7 article to see how to switch from S112 to S132 in my project and it compiled and linked successfully. I also debugged to figure out the start address of RAM and changed that in the linker file. But I’m getting a weird error (err_code=0x3002) i.e. BLE_ERROR_INVALID_CON_HANDLE as the return to the function 'sd_ble_gatts_service_add()' which is not even any of the return type for the function and if I take this function and call it somewhere else I get other errors like watchdog event. Could all this be in anyway related to compatibility between SDK 15.2.0 and S132 and is there something I need to correct in order to not get such errors ?

  • ble_conn_state.c
    ble_advertising.c

    ble-> components, I use the following files:

  • I did this but it seemed to make no difference.

    Did you get the same amount of NRF_ERROR_RESOURCES errors? 

    What device are you connected to ? 

    Could you try to decrease the connection interval, and see if that makes any difference ?

  • Did you get the same amount of NRF_ERROR_RESOURCES errors? 

    Well there were so many that I couldn;t really see that. But what what I've done right now is that I've placed the sd_ble_gatts_hvx() inside a do-while loop which will keep pushing data till it gets NRF_ERROR_RESOURCES until SUCCESS. 
    But when I use another Development Kit as master, a disconnection between peripheral and master occurs after transferring data for a short while probably because the rate at which application pushes the data (every 6ms) is more than SD can transmit at Data Length
    =27bytes. Can you please:
    1. Suggest if the do-while method is the right thing to do here for audio PCM data(DMA) ?
    2. How do I enable data length extension request (DLE) from the master to the peripheral. I'm using the uart central example as master. Which function should I use to send a DLE request to my peripheral device ? nrf_ble_gatt_data_length_set() doesn't seem to do the job.

    Also, why does the peripheral reset (and hence gets disconnected from the master) in a while (10-15 seconds) after continuously streaming data ? What could be the reason for that ?

    Regards

  • Hi,

    The GATT module will request a higher DLE value for you, based on the value of NRF_SDH_BLE_GAP_DATA_LENGTH. It can also be overridden by calling nrf_ble_gatt_data_length_set().

    Did you increase the value of NRF_SDH_BLE_GAP_DATA_LENGTH in sdk_config.h ?

    You should set it to 251:

    // <o> NRF_SDH_BLE_GAP_DATA_LENGTH   <27-251> 
    
    
    // <i> Requested BLE GAP data length to be negotiated.
    
    #ifndef NRF_SDH_BLE_GAP_DATA_LENGTH
    #define NRF_SDH_BLE_GAP_DATA_LENGTH 251
    #endif

    You can set NRF_LOG_DEFAULT_LEVEL to 4, and when the DLE is updated, you should see this in the log:

    <debug> nrf_ble_gatt: Data length updated to 251 on connection 0x0.

    Manish Kaul said:
    1. Suggest if the do-while method is the right thing to do here for audio PCM data(DMA) ?

    There is nothing wrong with it, but there are more robust ways to do it. It depends on the data rate.

    Manish Kaul said:
    Also, why does the peripheral reset (and hence gets disconnected from the master) in a while (10-15 seconds) after continuously streaming data ? What could be the reason for that ?

    Maybe an error code was passed into APP_ERROR_CHECK(). You should add DEBUG as a preprocessor symbol, it will prevent the chip from resetting, and you can check what function returned an error-code.

    What connection interval are you using now? 

    What is the value of NRF_SDH_BLE_GAP_EVENT_LENGTH ?

  • Did you increase the value of NRF_SDH_BLE_GAP_DATA_LENGTH in sdk_config.h ?

    You should set it to 251:

    Yes I did increase the value to 207 (exact size=3+4+200bytes of data) on the master and that enabled DLE exchange which wasn't happening earlier. Now this happens even without calling nrf_ble_gatt_data_length_set(). The GATT module apparently automatically updated the Data Length. However, in the peripheral NRF_SDH_BLE_GAP_DATA_LENGTH is still set to 251.

    you should see this in the log

    Yes, I've already done that and get this


    but there are more robust ways to do it. It depends on the data rate.

    Like what ways ? Can you please elaborate on this.
    Currently my MTU is 207 bytes, Data Length is also 207 bytes and if I sniff BLE packets notifications are sent using single packet of 207 bytes only (in some cases its fragmented into two, just few packets in the beginning sometimes). 

    Maybe an error code was passed into APP_ERROR_CHECK(). You should add DEBUG as a preprocessor symbol, it will prevent the chip from resetting, and you can check what function returned an error-code.

    Okay, I'll do that. But the disconnection part i've taken care of. It was basically mismatch in the connection parameters (conn interval) of the peripheral and master, which i guess was the reason for resetting of peripheral. Peripheral was 50ms while master was 7ms.

    What connection interval are you using now?

    50ms on both master and peripheral

    NRF_SDH_BLE_GAP_EVENT_LENGTH

    Master


    Peripheral

Related