advertise dynamic scanned data

28 posts / 0 new
Last post
hrg
Offline
Last seen:2 years 3 months ago
格鲁鲁
Joined:2014-08-05 13:37
advertise dynamic scanned data

HI
am using the proximity reporter application .I want to add a scanned data(eg number) which will increment for each advertising event .is it possible in DA14580 ?

hrg
Offline
Last seen:2 years 3 months ago
格鲁鲁
Joined:2014-08-05 13:37
有人能帮忙吗? !

有人能帮忙吗? !

JE_Dialog
Offline
Last seen:2小时14分钟前
Staff
Joined:2013-12-05 14:02
Hello hrg, i will check into

Hello hrg, i will check into this. Please be patient and allow a couple of days.

BR JE_Dialog

hrg
Offline
Last seen:2 years 3 months ago
格鲁鲁
Joined:2014-08-05 13:37
而且为什么adv&scan

而且为什么adv&scan_resp data is in such a format ?? #define APP_SCNRSP_DATA "\x09\xFF\x00\x60\x52\x57\x2D\x42\x4C\x45" ??
is there any service data field in addition to manufacture specific data field ?if there how to access it ?

hrg
Offline
Last seen:2 years 3 months ago
格鲁鲁
Joined:2014-08-05 13:37
嗨对话团队我们急切地

嗨对话团队我们急切地waiting for the response asap .
Thankyou

JE_Dialog
Offline
Last seen:2小时14分钟前
Staff
Joined:2013-12-05 14:02
Hello hrg, The simplest way

Hello hrg, The simplest way to implement a counter would be to implement a counter.

For example : if you want measure 4 advertising events with an advertising interval is set to 700 ms.

- You will have to set the timer to a 2152 ms (13ms *4 + 700ms *3).
注意:1广告需要大约13毫秒+ 1广告间隔,例如700毫秒。

This may not be whollly accurate over a long period of time : how accurate do you want to make this ?

BR JE_Dialog

hrg
Offline
Last seen:2 years 3 months ago
格鲁鲁
Joined:2014-08-05 13:37
Hi JE_Dialog thankyou for

嗨JE_DIALOG谢谢你的回复.Even如果我们使用计时器,我们如何更改扫描数据,因为它被定义为宏,它可以在运行时更改吗?

-Actually i need to update the scan response field for each advertising event during advertising.
-say for example- during power on the scan data is 00 so for each adv event of 13ms i need to increment the scan data like 01,02 ... So the scan response data field would advertise dynamic data during advertising till it goes to sleep.

Hope you understood my question.

MHv_Dialog
Offline
Last seen:1 week 17 hours ago
Staff
Joined:2013-12-06 15:10
Hi Hrg,

Hi Hrg,

广告扫描响应数据设置在大多数示例项目的函数app_adv_func()中(template_fh是这个的一个很好的例子)。在广告开始之前运行此功能,并且加载到扫描响应和广告数据的内容将在所有将来的广告中使用,直到您停止广告。该功能可以在App_Template_Proj.c中找到。

So the trick is to stop advertising, rebuild the advertising data using the app_adv_func() with your updated data (counter or whatever) and restart advertising. Stopping advertising can be done with a timer or with one of the sleep hooks if you use one of the two sleep modes. The latter method is recommended.

制造商特定数据使用ADV_DATA类型0xFF。您可以使用定义的值Gap_ad_type_manu_specific_data而不是0xFF。假设您希望将0xAA的计数器值添加到Scan Esponse String。您必须先提供数据的总长度(包括类型)。这是类型的一个字节,以及数据的一个字节,或者为0x02。接下来,您应该提供0xFF,最后是0xAA的一个字节数据。整个字符串将是\ 0x02 \ 0xFF \ 0xAA

I hope this makes sense and addresses your request.

hrg
Offline
Last seen:2 years 3 months ago
格鲁鲁
Joined:2014-08-05 13:37
Thankyou mhvid_dialog for the

Thankyou mhvid_dialog for the detailed reply .
Is there any main() where all these functions like adv_start ,adv_stop are called ??Because there exists a confusion where the advertising sequential operation happens !!

And also as you said the value 0xAA should increment automatically .but since it is a macro defined format how to change the values during runtime ??!

MHv_Dialog
Offline
Last seen:1 week 17 hours ago
Staff
Joined:2013-12-06 15:10
Hi hrg,

Hi hrg,

app_adv_start() is defined in app.c. It uses the app_adv_func() to build the advertisment command that it finally sends to the the GAP stack. app_adv_start() is called several places. It is called the first time right after the device configuration has completed (app_set_dev_config_complete_func()). It is also called when a central disconnects from the device.

0xAA doesn't increment austomatically. Your application would have to that.

Below is an example of changing the content of advertising dynamically inside the app_adv_func() function. I am using the iBeacon as an example, and I am loading the minor and major keys defined elsewhere into the advertising data string:

///////////Code Snippet start

void app_adv_func(struct gapm_start_advertise_cmd *cmd)
{
// Start advertising. Fill GAPM_START_ADVERTISE_CMD message
cmd->op.code = GAPM_ADV_NON_CONN;// Not connectable
cmd->op.addr_src = GAPM_PUBLIC_ADDR;// Using a public Address
cmd->intv_min = APP_ADV_INT_MIN;//最小广告间隔
cmd-> intv_max = app_adv_int_max;// Maximum advertising interval
cmd->channel_map = APP_ADV_CHMAP;// Advertising channels (7 => all threee used)
cmd->info.host.mode = GAP_BROADCASTER_MODE;// Broadcast mode (RX never open)
/*-----------------------------------------------------------------------------------
* Set the Advertising Data and the Scan Response Data
*---------------------------------------------------------------------------------*/
cmd->info.host.scan_rsp_data_len = 0; // No Scan Response in an iBeacon
cmd-> info.host.adv_data_len = 27;// IBEACON的标准长度
// Define broadcast advertise data:
UINT8_T数据[27] = {0x1a,0xff,0x4c,0x00,0x02,0x15,// ibeacon
0x58,0x58,0x58,0x58,0x58,0x58,0x58,0x58,0x58,0x58,0x58,0x58,0x58,0x58,0x58,0x58,// beacon uuid
0x00,0x00,0x00,0x00, // Major and minor key placeholders
0xC5}, // Signal Strength at disatance of 1 meter
};
memcpy(&cmd->info.host.adv_data,&data[0],cmd->info.host.adv_data_len);
// Load dynamically generated Major and Minor keys into iBeacon data set (Both previeously loaded into app_env environment)
memcpy(&cmd->info.host.adv_data[22],&app_env.major,2);
memcpy(&cmd-> info.host.adv_data [24],&app_env.minor,2);
return;
}

///////////Code Snippet end

anthony42
Offline
Last seen:5年4个月前
Joined:2015-07-17 08:21
嗨mhv_dialog,

嗨mhv_dialog,

我可以在写入时更改ADV数据
memcpy(&cmd->info.host.adv_data,&data[0],cmd->info.host.adv_data_len);
so can I switch off NVDS_SUPPORT,
什么剂量的nvds要做什么?

Thanks,
安东尼

anthony42
Offline
Last seen:5年4个月前
Joined:2015-07-17 08:21
嗨mhv_dialog,

嗨mhv_dialog,

why the dev name and adv data from nvds is ok,
但是nvds_tag_app_ble_scan_resp_data不正常
(if(nvds_get(NVDS_TAG_APP_BLE_SCAN_RESP_DATA, &cmd->info.host.scan_rsp_data_len,
&cmd->info.host.scan_rsp_data[0]) != NVDS_OK))
nvds.c中的扫描响应数据长度是对的,任何其他原因?

Thanks,
安东尼

MT_dialog
Offline
Last seen:2周25分钟前
Staff
Joined:2015-06-08 11:34
嗨Antony42,

嗨Antony42,

NVDS是Sysram中的特殊区域,具有特定结构,可以通过OTP报头或使用指定的程序中的指定代码填充。如果成功读取来自NVDS的程序数据,它会从其他值获取来自默认值的NVDS ears的adv数据。

if(nvds_get(nvds_tag_app_ble_adv_data,&cmd-> info.host.adv_data_len,
&cmd->info.host.adv_data[0]) != NVDS_OK)

Thanks MT_dialog

anthony42
Offline
Last seen:5年4个月前
Joined:2015-07-17 08:21
Hi MT_dialog,

Hi MT_dialog,

Thank you very much for your reply,
ADV数据来自NVDS,但扫描响应数据始终来自默认宏,
.NVDS_TAG_APP_BLE_SCAN_RESP_DATA = "\x09\xFF\x00\x60\x52\x57\x2D\x42\x4C\x45",
.can_resp_data_tag_len = 10,// scan_resp_data
所以nvds_get失败可能会导致什么?

Thanks,
安东尼.

MT_dialog
Offline
Last seen:2周25分钟前
Staff
Joined:2015-06-08 11:34
Hi antony42,

Hi antony42,

We will have a look and let you know as soon as we have news on this.

Thanks MT_dialog

MT_dialog
Offline
Last seen:2周25分钟前
Staff
Joined:2015-06-08 11:34
Hi antony42,

Hi antony42,

It seems that there is a bug in the procedure for fetching the scan response data from the nvds, this will be fixed in the future release of the SDK.

Thanks MT_dialog

hrg
Offline
Last seen:2 years 3 months ago
格鲁鲁
Joined:2014-08-05 13:37
Also one more doubt to wake

Also one more doubt to wake up from deep sleep is an interrupt like push buttton (as of in proximity_reporter_fh) mandatory ? is there anyway to wake from sleep after some confined period ??

JE_Dialog
Offline
Last seen:2小时14分钟前
Staff
Joined:2013-12-05 14:02
Hello hrg, there are two good

Hello hrg, there are two good documents here that will tell you how to use the sleep mode in synchronous (ble timer) and asynchronous (ext interrupt) mode.

Sleep mode configuration

http://support.dialog-semiconductor.com/system/files/restricted/UM-B-006.pdf

http://support.dialog-semiconductor.com/resource/b-026-external-wake-mechanisms

BR JE_Dialog

hrg
Offline
Last seen:2 years 3 months ago
格鲁鲁
Joined:2014-08-05 13:37
Thankyou JE_Dialog !!

Thankyou JE_Dialog !!
also please respond to these questions also

Is there any main() where all these functions like adv_start ,adv_stop are called ??Because there exists a confusion where the advertising sequential operation happens !!

And also as you said the value 0xAA should increment automatically .but since it is a macro defined format how to change the values during runtime ??!

Thankyou

MHv_Dialog
Offline
Last seen:1 week 17 hours ago
Staff
Joined:2013-12-06 15:10
Hi HRG,

Hi HRG,

Please see my response above.

hrg
Offline
Last seen:2 years 3 months ago
格鲁鲁
Joined:2014-08-05 13:37
Thankyou Mhv_dialog !!

Thankyou Mhv_dialog !!

hrg
Offline
Last seen:2 years 3 months ago
格鲁鲁
Joined:2014-08-05 13:37
Hi Dialog team

Hi Dialog team

I modified the proximity application to advertise dynamic manufacture data in advertising field and it was working fine in debugging mode in SRAM. The app will advertise once and goes to sleep and when i press the button K1 it will advertise again with incremented data once and goes to sleep.This was working fine in debugging mode. Now i burned the same program in OTP.The problem arised !!
It is advertising well .but the manufacture data is not incrementing upon wakeup by the K1 !!. So what is the problem here !??
Could you please asap explain why such problem arise ???

hrg
Offline
Last seen:2 years 3 months ago
格鲁鲁
Joined:2014-08-05 13:37
Dialog Team why there is no

Dialog Team why there is no response so far !?

JE_Dialog
Offline
Last seen:2小时14分钟前
Staff
Joined:2013-12-05 14:02
hrg, what sleep mode do you

hrg, what sleep mode do you use ? note that if you use Deep Sleep, all SRAM contents are lost : so anything you keep as a counter in SRAM will be disapear. SRAM is re-loaded from OTP on wake from deep sleep.

If you use extended sleep, SRAM is kept alive.

BR JE_Dialog

hrg
Offline
Last seen:2 years 3 months ago
格鲁鲁
Joined:2014-08-05 13:37
Thankyou for the reply JE

Thankyou for the reply JE_dialog .
You are right !! i used deep sleep mode (by default in proximity reporter_fh it was deep sleep mode).! I burned the otp too ! during OTP header i have enabled Jtag.So is can we change it to extended sleep mode through Spota or any other way ??

JE_Dialog
Offline
Last seen:2小时14分钟前
Staff
Joined:2013-12-05 14:02
Hello hrg, thats not so

Hello hrg, thats not so straight forward ... implementing SPOTA afterwards is not possible since that needs to be included within the project build and you arleady burnt OTP. The quickest approach will be to swap with another device (swap out on the board) and i'd recommend to keep everything in development mode until you are completely sure you have the functioanlity you need. Alternatively you can use the BASIC development kit which has a FLASH on board, there you can use the FLASH memory and either permanently use FLASH (and only burn bootlader into OTP for example).

BR JE_Dialog

jd@exp-eng.com
Offline
Last seen:2年5米onths ago
Joined:2014-10-22 04:34
Dialog team,

Dialog team,

I could use your help on this as well. I would like to do the same thing hrg described, however I am using the latest version of the SDK, V5.0.3.

I am using the proximity reporter application as well.

I am UNABLE to update the Manufacturer Specific Data in deep sleep nor debug mode. I get the default manufacturer specific data '?DLG-BLE' every single time.

An update to this would be greatly appreciated.

MT_dialog
Offline
Last seen:2周25分钟前
Staff
Joined:2015-06-08 11:34
Hi jd@exp-eng,

Hijd@exp-eng,

When you are in development mode and your project is configured in deep sleep the 580 doesn't actually turns off its sysram so, even if you haven't saved your values in a retention memory area you should be able to see your values changing over the scan response string, if you are actually changing them. The scan response data is loaded through the NVDS in most of the 580 examples using the below command:

app_easy_gap_adv_read_from_NVDS (&cmd->info.host.scan_rsp_data_len,&cmd->info.host.scan_rsp_data[0], SCAN_RSP_DATA_LEN, SCAN_RSP_DATA_LEN+1,
NVDS_TAG_APP_BLE_SCAN_RESP_DATA); in the app_easy_gap_undirected_advertise_start_create_msg() function. Please have a look at this function and replace the command
使用您的字符串操作功能。

Thanks MT_dialog