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

combining central and peripheral

Hi,

my application is normally a BLE scanner, listening for beacons. This runs OK.

Now, I tried to add a tested piece of connectable gap/gatt firmware, that runs fine in another application. The idea is to have the processor check a pushbutton at power-up. Normally the processor will call "sd_ble_gap_scan_start" to begin scanning, but if the button is pressed it calls the standard gap/gatt initialisation to start advertising:

  flash_timer_init();
  observer_init();
  gap_params_init();
  gatt_init();
  services_init();
  advertising_init();
  conn_params_init();
  peer_manager_init();

As I mentioned, this gap/gatt software works fine in another application, but here it crashes at the first call to "sd_ble_uuid_vs_add" with error_code 203995, which does not tell me how to fix it.

Is there possibly a conflict between central and peripheral, or a config setting that needs changing?

thx,

Henk

  • Hi,

    203995 does not seem like an expected error code from sd_ble_uuid_vs_add, are you sure this is the correct error code?

    Have you changed the sdk_config.h file (NRF_SDH_BLE_VS_UUID_COUNT) and project memory config to allow space for the vendor-specific UUID? 

    Which SDK version are you using? Can you upload your project for us to reproduce and debug the error?

    Best regards,
    Jørgen

  • Hi Jorgen,

    thanks for your support.

    The actual error code seems to change with software modifications, but is always high. Here is a recent one:

    <error> app: ERROR 203971 [Unknown error code] at C:\Nordic\nRF5_SDK_16.0.0_98a08e2\531904\src-eml-ble\rev000\EBTgap.c:278

    PC at: 0x00031B11

    <error> app: End of error report

    The code from line 275 onwards is:

      char_uuid.uuid = cstm_uuid;
      ces_handles.ces_short_uuid[char_no] = cstm_uuid; // for quick look-up of handle
      sd_ble_uuid_vs_add(&base_uuid, &char_uuid.type);
      APP_ERROR_CHECK(err_code);

    I copied the config settings from the app with the original gap/gatt firmware:

    #define NRF_SDH_BLE_ENABLED 1
    #define NRF_SDH_BLE_GAP_DATA_LENGTH 27
    #define NRF_SDH_BLE_PERIPHERAL_LINK_COUNT 1
    #define NRF_SDH_BLE_CENTRAL_LINK_COUNT 1
    #define NRF_SDH_BLE_TOTAL_LINK_COUNT 1
    #define NRF_SDH_BLE_GAP_EVENT_LENGTH 800
    #define NRF_SDH_BLE_GATT_MAX_MTU_SIZE 583
    #define NRF_SDH_BLE_GATTS_ATTR_TAB_SIZE 5128
    #define NRF_SDH_BLE_VS_UUID_COUNT 1
    #define NRF_SDH_BLE_SERVICE_CHANGED 0

    The project is fairly large, with a uart interface to wirepas where proprietory data is transferred. I cannot share that part, but if needed, I can make a reduced version with just the scanner and the gap/gatt parts for you to examine. For now, the complete config file is uploaded to  sdk_config.h

    thx, Henk

  • From the code you posted, it looks like you are not assigning the error code to the err_code variable. What you are seeing is most likely garbage from RAM. Please change your code to this:

    err_code = sd_ble_uuid_vs_add(&base_uuid, &char_uuid.type);
    APP_ERROR_CHECK(err_code);

  • Hi Jorgen,

    I can't believe I missed that, shame on me ;-)

    Thanks for your support,

    Henk

Related