Custom Service Setup in Central in nRF Connect SDK

i am working with NRF52840 and i am using nRF Connect SDk.

can i get the help/documentation or guide to add the custom service.

can anyone compare and explain with nRF_SDK_17.0.2.

Parents
  • Hi

    I'm sorry, that wasn't the best explanation. Since the nus_client.c file does not have a gatt_discover() function in the driver file you need to edit this in your main.c file instead to use the custom UUID. The central_uart samples main.c file has a gatt_discover() function that is looking for the NUS service specifically, so you need to either replace this with or add your custom service UUID here.

    Unfortunately we do not have a specific walkthrough for the central side, as it is conceptually similar to how it's done on the peripheral side.

    Best regards,

    Simon

Reply
  • Hi

    I'm sorry, that wasn't the best explanation. Since the nus_client.c file does not have a gatt_discover() function in the driver file you need to edit this in your main.c file instead to use the custom UUID. The central_uart samples main.c file has a gatt_discover() function that is looking for the NUS service specifically, so you need to either replace this with or add your custom service UUID here.

    Unfortunately we do not have a specific walkthrough for the central side, as it is conceptually similar to how it's done on the peripheral side.

    Best regards,

    Simon

Children
  • Thank you  , i have completed that part but stuck after discovering the service.
    The discovery get completed and then while processing the following line 

    bt_gatt_dm_data_print(dm);
    
    bt_nus_handles_assign(dm, nus);
    bt_nus_subscribe_receive(nus);
    
    bt_gatt_dm_data_release(dm);
    k_sleep(K_SECONDS(10));
    //bt_gatt_dm_continue(dm,context);

    I get the following errors and then device reset,

    [00:00:31.800,567] <err> os: ***** MPU FAULT *****
    [00:00:31.800,598] <err> os: Data Access Violation
    [00:00:31.800,598] <err> os: MMFAR Address: 0x4
    [00:00:31.800,628] <err> os: r0/a1: 0x0000001a r1/a2: 0x00000000 r2/a3: 0x0001537b
    [00:00:31.800,628] <err> os: r3/a4: 0x00015379 r12/ip: 0x000000d7 r14/lr: 0x00010d9b
    [00:00:31.800,659] <err> os: xpsr: 0x01000000
    [00:00:31.800,659] <err> os: Faulting instruction address (r15/pc): 0x00010da8
    [00:00:31.800,689] <err> os: >>> ZEPHYR FATAL ERROR 0: CPU exception on CPU 0
    [00:00:31.800,720] <err> os: Current thread: 0x20001d98 (BT RX)

Related