9个职位/0个新职位
Last post
cyanolum
Offline
Last seen:5 years 10 months ago
加入:2014-11-13 20:59
Sample128 question

I am trying to modify the sample128 design so that it can handle more than 1 byte at a time, I am not having much luck. Is there a version available that can write more than 1 byte at a time? Thanks!

VesaN
Offline
Last seen:5 years 3 months ago
上师 Master
加入:2014-06-26 08:49
嗨cyanolum,

嗨cyanolum,
您可以从为sample128\u task.c第103行中的value属性分配更多空间开始。使用sample128示例中描述的方法创建新服务比使用其他服务更棘手。您可以检查DIS服务文件diss.c和diss\u task.c作为基础

cyanolum
Offline
Last seen:5 years 10 months ago
加入:2014-11-13 20:59
Thank you for your response

Thank you for your response Vesa, allocating more space for the value attribute is what I have already tried. When I do that I reach the breakpoint in the NMI handler that states the watchdog has expired.

Maybe there exists a better example for me to start with than sample128?

My need is simple, I wish to have my mobile app send a request for data to the DA14580 which will respond with ~30 bytes information.

VesaN
Offline
Last seen:5 years 3 months ago
上师 Master
加入:2014-06-26 08:49
嗨cyanolum,

嗨cyanolum,

that error probably means that the programs gets stuck somewhere. It is difficult to say anything else about the error. I remember that the method shown in 128-bit UUID service sample is very tricky to use because there are a lot ofmagic numbers. I recommend to see the dis service. If you open file diss.c and diss_task.c in profiles folder, you see that the profile structure is quite easy to understand with this method:

const struct attm_desc diss_att_db[DIS_IDX_NB] =
{
// Device Information Service Declaration
[DIS_IDX_SVC] = {ATT_DECL_PRIMARY_SERVICE, PERM(RD, ENABLE), sizeof(diss_dis_svc),
sizeof(diss_dis_svc), (uint8_t *)&diss_dis_svc},
// Manufacturer Name Characteristic Declaration
[DIS_IDX_MANUFACTURER_NAME_CHAR] = {ATT_DECL_CHARACTERISTIC, PERM(RD, ENABLE), sizeof(diss_manufacturer_name_char),
sizeof(diss_manufacturer_name_char), (uint8_t *)&diss_manufacturer_name_char},
// Manufacturer Name Characteristic Value
[DIS_IDX_MANUFACTURER_NAME_VAL] = {ATT_CHAR_MANUF_NAME, PERM(RD, ENABLE), DIS_VAL_MAX_LEN, 0, NULL},
...
};

In diss_task.c, you have a functiondiss_create_db_req_handler, which will create the service to the database. Take a look at the function callattm_svc_create_db()inside the create database request handler. There is no need to do magic calculations by hand.

Unfortunately, you can only use short UUID definitions with this method.

I have found that creating new profile is unpleasantly troublesome with current SDK. Hopefully there will be some easement in the future versions of the SDK.

If you are creating a completely new profile, remember to modify da14580_config.h, prf_utils.c, rwble_hl_config.h, app_api.h, app_task_handlers.h, and rwip_config.h. Hopefully I didn't miss any file

PS. If you only need to reply with 30 bytes of data, could you consider just sending it constantly in the advertisement packets? Then mobile phone doesn't need request the data. Or do you also need to send some specific data to the device before that data can be sent?

cyanolum
Offline
Last seen:5 years 10 months ago
加入:2014-11-13 20:59
再次感谢你这么做

再次感谢你这么做a very good reply. I will look through the things you have said and keep working on it.

I do need to send some specific data to the device first, then send the correct response back with all valid responses being less than 30 bytes each. So it seems to be a simple task but I am obviously having some troubles with the SDK.

cyanolum
Offline
Last seen:5 years 10 months ago
加入:2014-11-13 20:59
我很幸运使用了

我很幸运使用了custom profile to send my 30 bytes but am now wondering if I can add a text menu via uart similar to how the "Peripheral Examples" works.

In more detail what I would like to do is have a menu print via UART, select an option (1,2,3,4... etc) and have the DA14580 save a 20 byte value that can then be read by my mobile app.

Any ideas on the easiest way to implement this? I have tried adding it to "arch_main()" like in "Peripheral Examples" but this does not seem to work very well at all, as it constantly crashes while printing the menu to UART.

Thanks!

VesaN
Offline
Last seen:5 years 3 months ago
上师 Master
加入:2014-06-26 08:49
嗨cyanolum,

嗨cyanolum,

please include app_console in your project (dk_apps/src/modules/app/src/app_utils). app_console providesarch_printffunction to print formatted text. The syntax is similar toprintfC标准库提供的函数。不幸的是,app\ u控制台目前似乎没有提供收集输入的方法。请参阅源文件夹中的uart.h。在那里你可以找到uart_reveive_byte函数。Be sure to enable printf function in da14580_config.h:#define CFG_PRINTF. Otherwise these functions won't exist

Thanks

cyanolum
Offline
Last seen:5 years 10 months ago
加入:2014-11-13 20:59
Thank you again Vesa. Exactly

Thank you again Vesa. Exactly what I needed.

JE_Dialog
Offline
Last seen:21小时34分钟前
Staff
加入:2013-12-05 14:02
Thankyou Vesa ! we really

Thankyou Vesa ! we really appreciate you helping fellow DA14580 users. Have yourself a great XMAS if you are soon heading onto vacation,

BR JE_Dialog