Central device can not find 2 services(0x1001,0x0001)

asked 2017-09-11 10:51:12 +0200

Peripheral device has 2 services,but central can find only 1 service(0x1001). I want to find other service(0x0001) According to the message seems to be looking for 0x1001,but ! want to looking for every services.

I don not know why this program look for only 0x1001.

Incidentally Central program is based ble_app_uart_c.

Please tell me how to find every services.

I Hope to have a central sample program that handles multiple services

Message is Starting discovery of service with UUID 0x1001 on connection handle 0x0. Found service UUID 0x1001. Discovery of service with UUID 0x1001 completed with success on connection handle 0x0

edit retag flag offensive close delete report spam

Comments


uart_uuid.type = p_ble_nus_c -> uuid_type;
uart_uuid.uuid = 0x0001;
err_code = ble_db_discovery_evt_register (& uart_uuid);

Was added to the function ble_nus_c_init

A service of 0x0001 was also found

However, the message

"BLE_DB_DISC: DEBUG: Discovery of service wit [00000001] SDH: DEBUG: RAM start at 0x200020c8.

Reset is applied after.

Do not know why resetting will take place?

yamazaki seiji ( 2017-09-12 07:05:26 +0200 )editconvert to answer

Have you tested your peripheral with for example nRF Connect? Are you able to find both services there?

If you get a reset you probably have a call to APP_ERROR_CHECK() with an error code somewhere.

I'm not sure what SDK you are using, but you should turn off compiling optimizations, define DEBUG, and put a breakpoint in the app_error_handler(). Then you can see an error code, a line number and a file name.

See this for more information.

Petter Myhre ( 2017-09-12 10:58:03 +0200 )editconvert to answer

I found both services by LightBlue application of android. I will try to do your advise later. Thank you for your help.

yamazaki seiji ( 2017-09-12 11:12:35 +0200 )editconvert to answer

I knew the reason of reset. p_ble_nus_evt->handles is NULL in function ble_nus_c_evt_handler But I do not know why p_ble_nus_evt->handles is NULL.

yamazaki seiji ( 2017-09-13 11:18:54 +0200 )editconvert to answer

Exactly which function returns the error? ble_nus_c_handles_assign()?

Petter Myhre ( 2017-09-13 12:16:44 +0200 )editconvert to answer

Thank you for your reply. What I added is as follows.

■added

uart_uuid.type = p_ble_nus_c->uuid_type; uart_uuid.uuid = 0x0001;

err_code = ble_db_discovery_evt_register(&uart_uuid);

in function ble_nus_c_init

■added

else if (p_evt->evt_type == BLE_DB_DISCOVERY_COMPLETE &&
    p_evt->params.discovered_db.srv_uuid.uuid == 0x0001 &&
    p_evt->params.discovered_db.srv_uuid.type == p_ble_nus_c->uuid_type)
{
    .....

in function ble_nus_c_on_db_disc_evt

■added

uint16_t nus_rx_handle2;      /**< Handle of the NUS RX characteristic as provided by a discovery. */

to struct ble_nus_c_handles_t

I think there are other things I have to do, I do not know what it is.

Is there a sample source code for multiservice?

yamazaki seiji ( 2017-09-14 03:05:50 +0200 )editconvert to answer

I see. I'm not sure why it is NULL. It is a bit difficult to say without knowing what kind of modifications you have made to your code.

Petter Myhre ( 2017-09-14 14:19:36 +0200 )editconvert to answer

Would it be possible for you to share your complete project so I can test it here?

Petter Myhre ( 2017-09-15 10:00:33 +0200 )editconvert to answer

Yes, how can I send a file?

yamazaki seiji ( 2017-09-15 10:04:44 +0200 )editconvert to answer

Edit your question and use the paper clip icon. Please upload complete project. Also let me know which SDK and SoftDevice you are using.

Petter Myhre ( 2017-09-15 10:52:52 +0200 )editconvert to answer

Thank you for your help. SoftDevice is s132_nrf52_4.0.2_softdevice.hex. Please set ble_nus_c/ble_nus_c_toppan.[ch] to components\ble\ble_services . prg.zip

yamazaki seiji ( 2017-09-15 11:31:28 +0200 )editconvert to answer

Which SDK are you using?

Petter Myhre ( 2017-09-15 12:14:28 +0200 )editconvert to answer

I am using SDK is nRF5_SDK_13.0.0_04a0bfd.

I'm sorry, Correct the 186th line of the source code ble_nus_c_toppan.c as follows Please check.

if 0

To

if 1

yamazaki seiji ( 2017-09-19 03:09:26 +0200 )editconvert to answer

Thanks. Could you upload the complete project for the peripheral as well? So I can test them together?

Petter Myhre ( 2017-09-19 14:32:29 +0200 )editconvert to answer

I appreciate your help.

I will upload so please be kind.

yamazaki seiji ( 2017-09-20 03:13:23 +0200 )editconvert to answer