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

Changing NRF_SDH_BLE_GATT_MAX_MTU_SIZE causes an error.

I am programming using the glucose service example source.
The example source does not send any context data, so I added
However, when testing with nRF toolbox, I noticed that NRF_ERROR_RESOURCES error occurs after calling sd_ble_gatts_hvx.
Occurs when calling RACP_OPERATOR_ALL.
This is fine for the first call, but doesn't always work for the second call.
When calling the first RACP_OPERATOR_ALL, about 500 NRF_ERROR_RESOURCES occurs while transmitting about 60 data, and when calling the second RACP_OPERATOR_ALL, NRF_ERROR_RESOURCES always occurs.
So I am trying to change NRF_SDH_BLE_GAP_EVENT_LENGTH and NRF_SDH_BLE_GATT_MAX_MTU_SIZE in sdk_config.h.
However, after changing these, an NRF_ERROR_NO_MEM error occurs in the atErr_code = nrf_sdh_ble_enable (& ram_start) section of ble_stack_init.

Can you tell me the solution to the overall situation?

  • This only happens in the nRF toolbox for Android and the NRF_ERROR_RESOURCES in the nRF toolbox for iOS. However, multiple calls to RACP_OPERATOR_ALL can send data.

  • What are the event length and MTU size you are using n your sdk_config.h?

    The NRF_ERROR_RESOURCES is based on TX buffer queue and could be increased from default as shown here.

    Do you have specific limitations on how small the MTU size can be?

  • I changed to below...

    #define NRF_SDH_BLE_GAP_EVENT_LENGTH 10
    #define NRF_SDH_BLE_GATT_MAX_MTU_SIZE 100

    This change causes an error.

    So I did not change the event handler and MTU size.

    and As you said, I changed hvn_tx_queue_size.

    ble_cfg_t ble_cfg;
    memset(&ble_cfg, 0, sizeof ble_cfg);
    ble_cfg.conn_cfg.conn_cfg_tag = APP_BLE_CONN_CFG_TAG;
    ble_cfg.conn_cfg.params.gatts_conn_cfg.hvn_tx_queue_size = 10;
    Err_code = sd_ble_cfg_set(BLE_CONN_CFG_GATTS, &ble_cfg, ram_start);
    APP_ERROR_CHECK(Err_code);

    However, an error also occurs in sd_ble_enable.

    And I have no limit on the MTU size.

    I need to send up to 500EA GLS Measurement and Context data.

  • When i applied your changes, then i got some debug logs on the UART as below

    I changed the start of the RAM as below, everything worked normally after that.

    RAM_START=0x200028E0
    RAM_SIZE=0xd720
    
    

    FYI,

    I tested this on nRF52832, so the numbers might be different for you since you are using nRF52810 and a different softdevice.

  • Thank you.
    I am using SDK Version 15.0.0. I tried to modify RAM_SIZE as you told me, but I didn't.

    So I solved it as follows.
    I'm using IAR EWARM.

    RAM_START of nrf_sdh_ble.c has not been changed.
    RAM_START = 0x20000000

    In the ble_app_gls_iar_nRF5x.icf file, the following changes were made:

    //define symbol __ICFEDIT_region_RAM_start__   = 0x20001b48;
    define symbol __ICFEDIT_region_RAM_start__   = 0x20001E30;
    define symbol __ICFEDIT_region_RAM_end__     = 0x20005fff;

    There is still NRF_ERROR_RESOURCES, but it has decreased a lot.

    How do I know the right size of the queue size? If set too large, it will malfunction.

Related