Add More services / Characteristics to BLE_APP_PERIPHERAL

⚠️
Hi there.. thanks for coming to the forums. Exciting news! we’re now in the process of moving to our new forum platform that will offer better functionality and is contained within the main Dialog website. All posts and accounts have been migrated. We’re now accepting traffic on the new forum only - please POST any new threads at//www.xmece.com/support. We’ll be fixing bugs / optimising the searching and tagging over the coming days.
9 posts / 0 new
Last post
rajucoolsuraj
Offline
Last seen:5 months 2 weeks ago
加入:2018-12-12 16:09
Add More services / Characteristics to BLE_APP_PERIPHERAL

Hello Dialog,
I am experimenting with BLE_APP_PERIPHERAL and have included a service SVC4 (total 4 services) and one charactertistic (CHAR1);
On compiling the application and debugging,

1. Characteristic declaration "DECL" can be included

2. On adding the characteristic "Value" - the device does not advertise (based on power profiler) though the program runs in Debug mode.

May I know the steps to make changes in SDK6.0.10 for BLE_APP_PERIPHERAL or any other to increase characteristics to atleast 10 in my SVC4 .

Thanks, looking forward for your reply ASAP.

Device:
PM_Dialog
Offline
Last seen:1 day 5 hours ago
Staff
加入:2018-02-08 11:03
Hi rajucoolsuraj,

Hi rajucoolsuraj,

The most possible reason why the device stops advertising is why the code might ger stuck somewhere. Could you please run it in debug mode and hot attached the debugger? Does the code gets stuck somewhere, for example in NMI or WDOG handler or in any assertion?

Thanks, PM_DIalog

rajucoolsuraj
Offline
Last seen:5 months 2 weeks ago
加入:2018-12-12 16:09
Hello Dialog,

Hello Dialog,

May I know the process on how to hot attach debugger?

Thanks

rajucoolsuraj
Offline
Last seen:5 months 2 weeks ago
加入:2018-12-12 16:09
[SVC4_IDX_SVC]
[SVC4_IDX_SVC] = {(uint8_t*)&att_decl_svc, ATT_UUID_128_LEN, PERM(RD, ENABLE), sizeof(custs1_svc4), sizeof(custs1_svc4), (uint8_t*)&custs1_svc4}, // Data Characteristic Declaration [SVC4_IDX_DATA_CHAR] = {(uint8_t*)&att_decl_char, ATT_UUID_16_LEN, PERM(RD, ENABLE), 0, 0, NULL}, // Data Characteristic Value [SVC4_IDX_DATA_VAL] = { SVC4_DATA_UUID_128, ATT_UUID_128_LEN, PERM(RD, ENABLE) sizeof(struct data_t) , 0, NULL}, // Data Characteristic Configuration descriptor [SVC4_IDX_DATA_NTF_CFG] = { (uint8_t*)&att_desc_cfg, ATT_UUID_16_LEN, PERM(RD, ENABLE) | PERM(WR, ENABLE), sizeof(uint16_t), 0, NULL}, // Data Characteristc User Description [SVC4_IDX_DATA_USER_DESC] = { (uint8_t*)&att_desc_user_desc, ATT_UUID_16_LEN, PERM(RD, ENABLE), sizeof(DEF_SVC4_DATA_USER_DESC) - 1, sizeof(DEF_SVC4_DATA_USER_DESC) - 1, DEF_SVC4_DATA_USER_DESC}, // Characteristic Declaration [SVC4_IDX_CHAR] = {(uint8_t*)&att_decl_char, ATT_UUID_16_LEN, PERM(RD, ENABLE), 0, 0, NULL}, // Characteristic Value [SVC4_IDX_VAL] = { SVC4_UUID_128, ATT_UUID_128_LEN, PERM(RD, ENABLE), DEF_SVC4_CHAR_LEN, 0, NULL}, // Characteristic User Description [SVC4_IDX_USER_DESC] = {(uint8_t*)&att_desc_user_desc, ATT_UUID_16_LEN, PERM(RD, ENABLE), sizeof(DEF_SVC4_USER_DESC) - 1, sizeof(DEF_SVC4_USER_DESC) - 1, DEF_SVC4_USER_DESC},

Hello Dialog,
There seems to be a peculiar behavior with a characteristic.

I have been trying to debug the code example above-

When CCCD is added into DB for Data Characteristic; the device does not advertise.

On commenting out the CCCD attribute of Data Char; the device begins to advertise.

为什么奇怪的行为?

问候

Raju

rajucoolsuraj
Offline
Last seen:5 months 2 weeks ago
加入:2018-12-12 16:09
Hello Dialog,

Hello Dialog,
The CCCD declaratio needs the right permission,
Hence, the behavior.

Thanks

Raju

PM_Dialog
Offline
Last seen:1 day 5 hours ago
Staff
加入:2018-02-08 11:03
Hi rajucoolsuraj,

Hi rajucoolsuraj,

The device stops advertising because the code gets stuck somewhere dues to the WDOG or NMI or into any assertion due to memory allocation failure. As I have mentioned in my previous post, it would be very helpful to run the firmware with the debugger hot attached. Following this way you could identify the reason why the code stacks. For example, if the reason is the WDOG expiration, the WDOG handler will be triggered. In order to learn how to attach the debugger, please read theTutorial 8: Debugging methodstutorial.

Thanks, PM_Dialog

rajucoolsuraj
Offline
Last seen:5 months 2 weeks ago
加入:2018-12-12 16:09
The code was configured

The code was configured incorrectly.
Its working now.
Thanks for the debugging link.

问候

Raju

PM_Dialog
Offline
Last seen:1 day 5 hours ago
Staff
加入:2018-02-08 11:03
Hi rajucoolsuraj,

Hi rajucoolsuraj,

Glad that you figured your issue out and thanks for accepting my answer.

Thanks, PM_Dialog

PM_Dialog
Offline
Last seen:1 day 5 hours ago
Staff
加入:2018-02-08 11:03
Hi abc1724,

Hi abc1724,

In SDK5.0.4 there are 2 custom services available and you could find them under sdk\ble_stack\profiles\custom\custs SDK path. For example, in the ble_app_peripheral example, only the custom service 1 is implemented. In order to add the second service, you should do the following steps:

  • import to your project the custs2 / custs2_task under sdk_profiles folder
  • #include "custs2.h" into user_profiles_config.h’
  • #define EXCLUDE_DLG_CUSTS2 (0) into user_modules_config.h
  • Then, follow the implementation of custom service 1. Please check theTutorial 3 : Building Custom Profilestutorial form our support port. This might help you!

如果你想创建一个第三定制服务, there is no provision by the SDK and you should do it by yourself. It’s not a straight-forward implementation, as couple of SDK part mast be modified. Please find a tutorial regarding custom 1 service.

//www.xmece.com/sites/default/files/training_02_custom_profile_example_v1.2_0_0.pdf

However, if you are starting a new design or project, we recommend to start with our newest Smartbond device named DA14531. The SDK is much improved, we have a lot of code examples and improved documentation, and there is also software roadmap support. There is not any software roadmap support for DA14580 product family and SDK5.

If you have any follow up question, I would suggest you to create a new forum thread.

Thanks, PM_Dialog