在外围模式处理关贸总协定错误

Learn MoreFAQsTutorials

6 posts / 0 new
Last post
ltdev
Offline
Last seen:3 weeks 4 days ago
加入:2018-11-12 09:19
在外围模式处理关贸总协定错误

Hi we worked to DA14585 with peripheral mode. We use ble_app_peripheral_example in SDK. In the example we deleted service-2, service-3 and excluded DISS. We habe only 1 service and 1 characterictic with PERM(WR, ENABLE) | PERM(WRITE_REQ, ENABLE).

Our service definition like that

const struct attm_desc_128 custs1_att_db[CUSTS1_IDX_NB] =
{
/*************************
* Service 1 configuration
*************************
*/

// Service 1 Declaration
[SVC1_IDX_SVC] = {(uint8_t*)&att_decl_svc, ATT_UUID_128_LEN, PERM(RD, ENABLE),
sizeof(custs1_svc1), sizeof(custs1_svc1), (uint8_t*)&custs1_svc1},

// Long Value Characteristic Declaration
[SVC1_IDX_LONG_VALUE_CHAR] = {(uint8_t*)&att_decl_char, ATT_UUID_16_LEN, PERM(RD, ENABLE),
0, 0, NULL},

// Long Value Characteristic Value
[SVC1_IDX_LONG_VALUE_VAL] = {SVC1_LONG_VALUE_UUID_128, ATT_UUID_128_LEN, PERM(WR, ENABLE) | PERM(WRITE_REQ, ENABLE),
400, 0, NULL},

};

We compiled application and load the da14585. Then for test we connect to our device. (with a android phone with nrf connect test application) We can write from client device to server device (in this case server da14585) various length messages. 5 bytes, 20 bytes, 200 bytes, 270 bytes that all tests ok. But if we want to write more than 285 bytes; our test application ( nrf connect) disconnected from DA14585 (with GATT_ERROR and GATT_CONN_TIMEOUT) and DA14585 doesn't sense this case.

Questions :

- How can i sense this case in DA14585 ?

- how can i increment GATT_CONN_TIMEOUT ? ( i increased/decreased Supervision timeout in user_config.h but don't change anything)

Thank you...

Device:
PM_Dialog
Offline
Last seen:5 days 22 hours ago
Staff
加入:2018-02-08 11:03
Hi ltdev,

Hi ltdev,

I assume that this question is related with the below forum ticket :

https://support.dialog-semiconductor.com/forums/post/dialog-smartbond-bluetooth-low-energy-%E2%80%93-software/gatt-peripheral-mode-write-char-size

  1. Please run the application code in debug mode. Can you please check if the code freezes? For example, if the WDOG expires or if you are getting any assertion.
  2. Add a break point into the disconnection callback - user_app_connection(). Once the device is disconnected from the mobile phone, does the breakpoint hit? If yes, the reason item of gapc_disconnect_ind scructure indicated the reason of the disconnection. What is its value?

Thanks, PM_Dialog

ltdev
Offline
Last seen:3 weeks 4 days ago
加入:2018-11-12 09:19
Hi;

Hi;

- We have only uart on our custom board. So that we can't debug it with jtag.

- I add some printf messages in user_app_connection and user_app_disconn

{

// Service 1 Declaration
[SVC1_IDX_SVC] = {(uint8_t*)&att_decl_svc, ATT_UUID_128_LEN, PERM(RD, ENABLE),
sizeof(custs1_svc1), sizeof(custs1_svc1), (uint8_t*)&custs1_svc1},

// Long Value Characteristic Declaration
[SVC1_IDX_LONG_VALUE_CHAR] = {(uint8_t*)&att_decl_char, ATT_UUID_16_LEN, PERM(RD, ENABLE),
0, 0, NULL},

// Long Value Characteristic Value
[SVC1_IDX_LONG_VALUE_VAL] = {SVC1_LONG_VALUE_UUID_128, ATT_UUID_128_LEN, PERM(WR, ENABLE) | PERM(WRITE_REQ, ENABLE),
400, 0, NULL},

};

in the beginnin we have 2 problems

1- When i define the structure that;

{

// Service 1 Declaration
[SVC1_IDX_SVC] = {(uint8_t*)&att_decl_svc, ATT_UUID_128_LEN, PERM(RD, ENABLE),
sizeof(custs1_svc1), sizeof(custs1_svc1), (uint8_t*)&custs1_svc1},

// Long Value Characteristic Declaration
[SVC1_IDX_LONG_VALUE_CHAR] = {(uint8_t*)&att_decl_char, ATT_UUID_16_LEN, PERM(RD, ENABLE),
0, 0, NULL},

// Long Value Characteristic Value
[SVC1_IDX_LONG_VALUE_VAL] = {SVC1_LONG_VALUE_UUID_128, ATT_UUID_128_LEN, PERM(WR, ENABLE) | PERM(WRITE_REQ, ENABLE),
50, 0, NULL},

};

In this case i try to write 51 bytes to characteristic i get ATTR_LEN_ERR. After thar i changed 50 bytes to 400 bytes. And that problem solved.

2-) After solved problem-1 i define my service structure like that

{

// Service 1 Declaration
[SVC1_IDX_SVC] = {(uint8_t*)&att_decl_svc, ATT_UUID_128_LEN, PERM(RD, ENABLE),
sizeof(custs1_svc1), sizeof(custs1_svc1), (uint8_t*)&custs1_svc1},

// Long Value Characteristic Declaration
[SVC1_IDX_LONG_VALUE_CHAR] = {(uint8_t*)&att_decl_char, ATT_UUID_16_LEN, PERM(RD, ENABLE),
0, 0, NULL},

// Long Value Characteristic Value
[SVC1_IDX_LONG_VALUE_VAL] = {SVC1_LONG_VALUE_UUID_128, ATT_UUID_128_LEN, PERM(WR, ENABLE) | PERM(WRITE_REQ, ENABLE),
400, 0, NULL},

};

In this case i can write to characteristic up to 285 bytes. When i was try to write more than 285 bytes; my client device (in test case nrf connect application on android) got GATT_TIMEOUT_ERR and disconnected. But my server device (DA14585 custom board) dont sense this disconnected state. So that dont start advertise again. And i can not connect it again.

I hope that message clearly.

Respect...

PM_Dialog
Offline
Last seen:5 days 22 hours ago
Staff
加入:2018-02-08 11:03
Hi ltdev,

Hi ltdev,

Are you booting from an external SPI flash or from the System-RAM?

If you are booting from System-RAM and the device does nothing, this means that is frozen into an assertion, or the WDOG is expired or an NMI has been occurred.

You can verify this by booting from the SPI flash and you will see that the device reboots.

You should run the project somehow in debug mode and try to find where the code freezes. Otherwise we cannot know what the root cause of the issue is.

Do you have any of Dialog DKs? Since you don’t have a JTAG interface on you board, you can use any of the Dialog DK. All DA145xx Development Kits contain a Segger J-Link device that provides Serial Wire Debug (SWD) capability.

http://lpccs-docs.dialog-semiconductor.com/Tutorial_SDK6/debug_probe.html

Thanks, PM_Dialog

ltdev
Offline
Last seen:3 weeks 4 days ago
加入:2018-11-12 09:19
Hi i solved the the problem

Hi i solved the the problem without j-link

Thank you

PM_Dialog
Offline
Last seen:5 days 22 hours ago
Staff
加入:2018-02-08 11:03
Hi ltdev,

Hi ltdev,

Glad that you solve this issue. If you have any other follow up question, please create a new forum post.

Thanks, PM_Dialog