⚠️
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
marios256
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 6 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

marios256
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 6 days ago
Staff
Joined:2015-06-08 11:34
Hi marios256,

Hi marios256,

您正在使用的信息是发送notification and not to just change the value in the database in order for the central to read it, when sending a notification only the first 20 bytes are going to be modified unless you change the MTU to the size that you would like to transfer. Replicated the code on that you pasted on my side on the ble_app_peripheral with the exact mods that you have done and i dont see any issue, as soon as i enable the notifications and issue a 0x01 to the control point i am able to get the first 20 bytes of the string that you have pasted and maintain the connection. If that sudden stop occurs without enabling the notifications or even connecting to the device, then the issue isn't the mod that you are doing but something else that you have in the SDK or the demo.

Thanks MT_dialog

marios256
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_val_set_req *req = KE_MSG_ALLOC(CUSTS1_VAL_SET_REQ, prf_get_task_from_id(TASK_ID_CUSTS1), TASK_APP, custs1_val_set_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 6 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