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 ?

Parents
  • Hi,

    For the S132 variant, only version 5.1.0 has been production tested on nRF52810, other S132 versions would not be recommended to use on the nRF52810.

    If your requirement is S112 + DLE, I would instead recommend that you use S113 v7.0.1 / v7.2.0. 

    Support for S113 was first added in SDK 16.

    You can download S113 here:

    https://www.nordicsemi.com/Software-and-tools/Software/S113

  • Okay I implemented S113 in place of S112 and am also able to extend data length to (ATT_MTU+4) bytes (but not beyond that like 247 bytes, why? )
    Also , I'm transmitting PCM data from the PDM peripheral of nRF52810. Output data rate is 16000 sps which I want to stream over BLE. I use 50ms connection interval and 207bytes data length(ATT_MTU=200+3) but after first ~60 application frames (consisting of 200 bytes data) I keep loosing around 15-20 frames every 7 consecutive frames. This pattern remains same with any throughput I set the BLE for. What could be the reason ? The master (receiver) here is the nRF connect desktop app.
    Given, SD is S113, SDk is 16.0.0, SoC is nRF52810, what is the max. throughput I can have ? My sample output rate is 16000Hz, bit depth is 16 bits, channel is mono; bit-rate according to this = 16000*16*1 bps = 256000bps = 256Kbps. Given the above parameters settings I've kept, I should easily be getting around 600-700Kbps, then why am I loosing data ?

  • Hi,

    The nRF5 SDK v15.2.0 uses SoftDevice version 6.1.0 by default. You can still use SDK 15.2.0, and then migrate to use SoftDevice version 7.0.1. There are many API changes from SoftDevice v5 to v6, but very few from v6 to v7. S113 v7.0.1 comes with a migration document. I recommend migrating to use S113 v7.

    Okay I implemented S113 in place of S112

    Great!

    (but not beyond that like 247 bytes, why? )

    Did you set NRF_SDH_BLE_GATT_MAX_MTU_SIZE to 247 ?

    In order to use DLE, you need to increase the NRF_SDH_BLE_GAP_DATA_LENGTH config in sdk_config.h

    Remember to set these preprocessor defines:

    NRF_SD_BLE_API_VERSION=7

    S113

    Also, remember to point to the new SD headers files in the "User Include Directories".

    From SES:

    You might also want to take the following files from SDK 16.0.0, and use them to replace the ones used in SDK 15.2.0:

    nrf_sdh_ble.c
    nrf_ble_gatt.c
    ble_conn_state.c
    ble_advertising.c

  • You might also want to take the following files from SDK 16.0.0, and use them to replace the ones used in SDK 15.2.0

    I swapped the entire SDK files. 

    NRF_SDH_BLE_GATT_MAX_MTU_SIZE

    Got it. I set it to 203.


    Also , I'm transmitting PCM data from the PDM peripheral of nRF52810. Output data rate is 16000 sps which I want to stream over BLE. I use 50ms connection interval and 207bytes data length(ATT_MTU=200+3) but after first ~60 application frames (consisting of 200 bytes data) I keep loosing around 15-20 frames every 7 consecutive frames. This pattern remains same with any throughput I set the BLE for. What could be the reason ? The master (receiver) here is the nRF connect desktop app.
    Given, SD is S113, SDk is 16.0.0, SoC is nRF52810, what is the max. throughput I can have ? My sample output rate is 16000Hz, bit depth is 16 bits, channel is mono; bit-rate according to this = 16000*16*1 bps = 256000bps = 256Kbps. Given the above parameters settings I've kept, I should easily be getting around 600-700Kbps, then why am I loosing data ?

    Please help me out with this. This is the real need for me to solve.

Reply
  • You might also want to take the following files from SDK 16.0.0, and use them to replace the ones used in SDK 15.2.0

    I swapped the entire SDK files. 

    NRF_SDH_BLE_GATT_MAX_MTU_SIZE

    Got it. I set it to 203.


    Also , I'm transmitting PCM data from the PDM peripheral of nRF52810. Output data rate is 16000 sps which I want to stream over BLE. I use 50ms connection interval and 207bytes data length(ATT_MTU=200+3) but after first ~60 application frames (consisting of 200 bytes data) I keep loosing around 15-20 frames every 7 consecutive frames. This pattern remains same with any throughput I set the BLE for. What could be the reason ? The master (receiver) here is the nRF connect desktop app.
    Given, SD is S113, SDk is 16.0.0, SoC is nRF52810, what is the max. throughput I can have ? My sample output rate is 16000Hz, bit depth is 16 bits, channel is mono; bit-rate according to this = 16000*16*1 bps = 256000bps = 256Kbps. Given the above parameters settings I've kept, I should easily be getting around 600-700Kbps, then why am I loosing data ?

    Please help me out with this. This is the real need for me to solve.

Children
  • What value are you using for NRF_SDH_BLE_GAP_EVENT_LENGTH ? 

    If it's low, then try to increase it.

    The data is sent using the function sd_ble_gatts_hvx(). Check if it's retuning any error-codes.

  • NRF_SDH_BLE_GAP_EVENT_LENGTH  is set as 6. What exactly does it denote ?

    Check if it's retuning any error-codes.

    I ran a counter.


    if ((err_code != NRF_SUCCESS) &&
    (err_code != NRF_ERROR_INVALID_STATE) &&
    (err_code != NRF_ERROR_RESOURCES) &&
    (err_code != (uint32_t)BLE_ERROR_GATTS_SYS_ATTR_MISSING) )
    {
    APP_ERROR_HANDLER(err_code);
    }

    if(err_code != NRF_SUCCESS)
    {
    SRV_BLE_state.txErrorCnt++;

    }

    And it indeed increments 'txErrorCnt' many times over the course of transmission. And when I broke the flow at 'txErrorCnt' the error code was 19(0x13) which is NRF_ERROR_RESOURCES. What does it mean and please suggest how to get over it ?

  • NRF_SDH_BLE_GAP_EVENT_LENGTH  is set as 6. What exactly does it denote ?

    NRF_SDH_BLE_GAP_EVENT_LENGTH is the time set aside for the connection on every connection interval in 1.25 ms units. It also indirectly sets the SoftDevice buffer size.

    NRF_ERROR_RESOURCES. What does it mean and please suggest how to get over it ?

    It means that too many notifications are queued, and that the internal SoftDevice buffer is full. If you get this error, then it means that you were not able to queue your packet.

    If you are using 50ms connection interval, I suggest setting NRF_SDH_BLE_GAP_EVENT_LENGTH to 40. (40x1.25=50). After changing this, you will likely need to allocate more RAM to the SoftDevice.

  • I suggest setting NRF_SDH_BLE_GAP_EVENT_LENGTH to 40

    I did this but it seemed to make no difference.

    After changing this, you will likely need to allocate more RAM to the SoftDevice

    Also I did not require to do this. This was my RAM start address before as well as after changing the above value to 40: '0x20003F38'

Related