Merging hids_keyboard with ble_uart examples

Hello DevZone, I am trying to combine the ble_app_uart with the ble_app_hids_keyboard example.

I have added the necessary libraries from the the uart code into the HIDS code, added include directories in the linker under "common" and the projects builds no issue. When I run it I get:

<error> app: ERROR 7 [NRF_ERROR_INVALID_PARAM]

which directs me to:  advertising_init(), more specifically:

err_code = ble_advertising_init(&m_advertising, &init);

I am snagged here.

I have defined my UUIDs at the top as such:

static ble_uuid_t m_adv_uuids[] = {{BLE_UUID_HUMAN_INTERFACE_DEVICE_SERVICE, BLE_UUID_TYPE_BLE},
                                                        {BLE_UUID_NUS_SERVICE, NUS_SERVICE_UUID_TYPE}};

and I have adjusted the number of vendor specific UUIDs in the sdk_config.h

#define NRF_SDH_BLE_VS_UUID_COUNT 1

I have also made adjustments to the RAM start and RAM size in the linker:

<warning> nrf_sdh_ble: Insufficient RAM allocated for the SoftDevice.
<warning> nrf_sdh_ble: Change the RAM start location from 0x20002220 to 0x20002230.
<warning> nrf_sdh_ble: Maximum RAM size for application is 0xDDD0.
<error> nrf_sdh_ble: sd_ble_enable() returned NRF_ERROR_NO_MEM.
<error> app: ERROR 4 [NRF_ERROR_NO_MEM] at

Any suggestions as to where to go from here?

Thank you in advance.

Parents
  • I figured out that I don't need to put {BLE_UUID_NUS_SERVICE, NUS_SERVICE_UUID_TYPE} inside of m_adv_uuids[]

    My hunch is that it overflows the advertising packet of 31 bytes for some reason?

    The math doesn't add up:

    HID UUID = 16bit = 2 byte

    NUS UUID = 128bit = 16 byte

    TOTAL = 18 bytes....13 bytes remaining....perhaps there is more in there that I am aware of.

    The issue I am having now is that my UART Service is not discovered after the Central and Peripheral Pair.

    nRF52, SDK 15.2, SES, Soft Device 6.1.0 is my setup

    Cheers.

Reply
  • I figured out that I don't need to put {BLE_UUID_NUS_SERVICE, NUS_SERVICE_UUID_TYPE} inside of m_adv_uuids[]

    My hunch is that it overflows the advertising packet of 31 bytes for some reason?

    The math doesn't add up:

    HID UUID = 16bit = 2 byte

    NUS UUID = 128bit = 16 byte

    TOTAL = 18 bytes....13 bytes remaining....perhaps there is more in there that I am aware of.

    The issue I am having now is that my UART Service is not discovered after the Central and Peripheral Pair.

    nRF52, SDK 15.2, SES, Soft Device 6.1.0 is my setup

    Cheers.

Children
No Data
Related