⚠️
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.
6 posts / 0 new
Last post
马里奥斯256
Offline
Last seen:1 year 10 months ago
Joined:2017-10-30 09:36
bytes transfered

Hello,
I am new to the ble data transfering. I am trying to send data from my da14585 to my mobile phone via reading a characteristic. When i initialiaze my array of chars over ~320 bytes, the program is stopped running. I get no warnings or errors when i build it. I would like to send 1-2 kilobytes of data.
Thank you in advance

Device:
MT_dialog
Offline
Last seen:3 months 3 days ago
Staff
Joined:2015-06-08 11:34
Hi marios256,

Hi marios256,

你想如何do that, and how exactly is that you do that when you mention that you initialize you array of chars over 320 bytes ? Perhaps your code ends up to a hardfault or in an NMI Handler, this should be easy to track if you run the device from keil and using the debugger. If you would like to have a readable characteristic the size of 250 bytes then you should declare that in the user_custs1_def.h file, for example you can try that with the ADC 2 characteristic, then if you would like to set that characteristic to a specific value you will have to send the CUSTS1_VAL_SET_REQ message with the appropriate configuration in the handle and the length field in the struct and send it, in order for the custom profile to set the value to the custom database.

Thanks MT_dialog

马里奥斯256
Offline
Last seen:1 year 10 months ago
Joined:2017-10-30 09:36
Hello,

Hello,
in the user_custs1_def.h file i initialized : #define DEF_USER_LED_STATE_CHAR_LEN 400 as an example. Then, in the user_custs1_impl.c I created this handler:
void app_adcval1_timer_cb_handler()
{
struct custs1_val_ntf_ind_req *req = KE_MSG_ALLOC_DYN(CUSTS1_VAL_NTF_REQ,
prf_get_task_from_id(TASK_ID_CUSTS1),
TASK_APP,
custs1_val_ntf_ind_req,
DEF_USER_LED_STATE_CHAR_LEN);
static char sample[400]="The painting is thought to be a portrait of Lisa Gherardini, the wife of Francesco del Giocondo, and is in oil on a white Lombardy poplar panel. It had been believed to have been painted between 1503 and 1506; however, Leonardo may have continued working on it as late as 1517. Recent academic work suggests that it would not have been started before 1513. It was acquired by King Francis I of Franc";
req->handle = USER_IDX_LED_STATE_VAL;
req->length = DEF_USER_LED_STATE_CHAR_LEN;

req->notification = true;
memcpy(req->value, &sample, DEF_USER_LED_STATE_CHAR_LEN);
ke_msg_send(req);}

So, when i enter debugging session and i press the run button, it is suddenly stopped. I see no warnings or errors.
Thank you a lot!

MT_dialog
Offline
Last seen:3 months 3 days ago
Staff
Joined:2015-06-08 11:34
Hi marios256,

Hi marios256,

您使用的消息是发送通知,而不仅仅是更改数据库中的值以便中心读取,在发送通知时,只有前20个字节将被修改,除非您将MTU更改为要传输的大小。复制的代码,你粘贴在我这边的ble\u app\u外设与确切的mods,你已经做了,我没有看到任何问题,一旦我启用通知,并发出0x01到控制点,我能够得到的字符串,你粘贴的头20个字节,并维持连接。如果在没有启用通知甚至没有连接到设备的情况下突然停止,那么问题不是你正在做的mod,而是SDK或demo中的其他东西。

Thanks MT_dialog

马里奥斯256
Offline
Last seen:1 year 10 months ago
Joined:2017-10-30 09:36
Good evening,

Good evening,
thank you a lot for helping me. So if I wanted to just read a characteristic transfering 1000 bytes or more what should I do?
I wrote this struct but it keeps stop running
struct custs1\u val\u set\u req*req=KE\u MSG\u ALLOC(custs1\u val\u set\u req,prf\u get\u task\u from\u id(task\u id\u custs1),task\u APP,custs1\u val\u set\u req);
req->handle = USER_IDX_LED_STATE_VAL;
req->length = DEF_USER_LED_STATE_CHAR_LEN;
static char sample[400]="The painting is thought to be a portrait of Lisa Gherardini, the wife of Francesco del Giocondo, and is in oil on a white Lombardy poplar panel. It had been believed to have been painted between 1503 and 1506; however, Leonardo may have continued working on it as late as 1517. Recent academic work suggests that it would not have been started before 1513. It was acquired by King Francis I of Franc";
memcpy(req->value, &sample, DEF_USER_LED_STATE_CHAR_LEN);
ke_msg_send(req);
I noticed that when i initialize in user_custs1_def.h #define DEF_USER_LED_STATE_CHAR_LEN around 350-400, the problem occurs. If i initialize it at 300, it works fine.
提前谢谢!

MT_dialog
Offline
Last seen:3 months 3 days ago
Staff
Joined:2015-06-08 11:34
Hi marios256.

Hi marios256.

Send more notifications, just send the first bulk and then after getting the confirmantion that the notification is successfully stored in the transmit buffer, send the second notification. Whenever you send a notification you will get a CUSTS1_VAL_NTF_CFM (for the custom profile), as soon as you get this you will know that the notification just send will be delivered to the central, so you can directly place the second notification.

Regarding the stop running, perhaps you hit the platform reset when you increase the size of the characteristic, try to define and increase the DB_HEAP_SZ from the da1458x_config_advanced, for example you can place a value of 2048.

Thanks MT_dialog