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 ?
And also why the 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,最简单的方法来实现一个计数器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). Note: 1 advertising takes about 13ms + 1 advertising interval which is for example 700 ms.
This may not be whollly accurate over a long period of time : how accurate do you want to make this ?
Hi JE_Dialog thankyou for your reply .Even if we use timer ,how can we change the scan data since it is defined as macro ,will it can be changed during runtime ??
-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.
The advertising an scan response data is set in the function app_adv_func() of most of our sample projects (template_fh is a good example of this). This function is run once before advertisement starts and the content loaded into scan response and advertisement data will be used in all future advertisements until you stop advertising. the function can be found in 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.
Manufacturer specific data uses the adv_data type 0xFF. You can use the defined value GAP_AD_TYPE_MANU_SPECIFIC_DATA instead of 0xFF. Let's say you want to add the counter value of 0xAA to your scan esponse string. You would have to provide first the total length of your data (including the type). This is one byte for the type and one byte for the data, or 0x02. Next, you should provide the type 0xFF and finally your one byte data of 0xAA. The entire string would be \0x02\0xFF\0xAA
I hope this makes sense and addresses your request.
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 ??!
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:
I can change the adv data as you wrote memcpy(&cmd->info.host.adv_data,&data[0],cmd->info.host.adv_data_len); so can I switch off NVDS_SUPPORT, and what dose NVDS disigned to do?
why the dev name and adv data from nvds is ok, but NVDS_TAG_APP_BLE_SCAN_RESP_DATA not ok (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)) the scan response data length in nvds.c is right, any other reason?
The NVDS is a special area in the SYSRAM with a specific structure which can be populated either by the OTP header or by using the specified code in program. If the procedure reading data from NVDS is succeeded it gets the adv data from the NVDS else it gets the data from the default values.
Thank you very much for your reply, the adv data is from nvds,but the scan response data is always from the default macro, .NVDS_TAG_APP_BLE_SCAN_RESP_DATA = "\x09\xFF\x00\x60\x52\x57\x2D\x42\x4C\x45", .SCAN_RESP_DATA_TAG_LEN = 10, // SCAN_RESP_DATA so what may cause the nvds_get failed?
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 ??
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.
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 ??!
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, 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.
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 ??
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).
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.
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 with your string manipulation function.
有人能帮忙吗? !
Hello hrg, i will check into this. Please be patient and allow a couple of days.
BR JE_Dialog
And also why the 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 ?
HI Dialog team we are eagerly waiting for the response asap .
Thankyou
你好hrg,最简单的方法来实现一个计数器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).
Note: 1 advertising takes about 13ms + 1 advertising interval which is for example 700 ms.
This may not be whollly accurate over a long period of time : how accurate do you want to make this ?
BR JE_Dialog
Hi JE_Dialog thankyou for your reply .Even if we use timer ,how can we change the scan data since it is defined as macro ,will it can be changed during runtime ??
-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.
Hi Hrg,
The advertising an scan response data is set in the function app_adv_func() of most of our sample projects (template_fh is a good example of this). This function is run once before advertisement starts and the content loaded into scan response and advertisement data will be used in all future advertisements until you stop advertising. the function can be found in 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.
Manufacturer specific data uses the adv_data type 0xFF. You can use the defined value GAP_AD_TYPE_MANU_SPECIFIC_DATA instead of 0xFF. Let's say you want to add the counter value of 0xAA to your scan esponse string. You would have to provide first the total length of your data (including the type). This is one byte for the type and one byte for the data, or 0x02. Next, you should provide the type 0xFF and finally your one byte data of 0xAA. The entire string would be \0x02\0xFF\0xAA
I hope this makes sense and addresses your request.
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 ??!
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
///////////Code Snippet end
Hi MHv_dialog,
I can change the adv data as you wrote
memcpy(&cmd->info.host.adv_data,&data[0],cmd->info.host.adv_data_len);
so can I switch off NVDS_SUPPORT,
and what dose NVDS disigned to do?
Thanks,
Anthony
Hi MHv_dialog,
why the dev name and adv data from nvds is ok,
but NVDS_TAG_APP_BLE_SCAN_RESP_DATA not ok
(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))
the scan response data length in nvds.c is right, any other reason?
Thanks,
Anthony
Hi Antony42,
The NVDS is a special area in the SYSRAM with a specific structure which can be populated either by the OTP header or by using the specified code in program. If the procedure reading data from NVDS is succeeded it gets the adv data from the NVDS else it gets the data from the default values.
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
Hi MT_dialog,
Thank you very much for your reply,
the adv data is from nvds,but the scan response data is always from the default macro,
.NVDS_TAG_APP_BLE_SCAN_RESP_DATA = "\x09\xFF\x00\x60\x52\x57\x2D\x42\x4C\x45",
.SCAN_RESP_DATA_TAG_LEN = 10, // SCAN_RESP_DATA
so what may cause the nvds_get failed?
Thanks,
Anthony.
Hi antony42,
We will have a look and let you know as soon as we have news on this.
Thanks MT_dialog
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
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 ??
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
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
Hi HRG,
Please see my response above.
Thankyou Mhv_dialog !!
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 ???
Dialog Team why there is no response so far !?
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
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 ??
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
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.
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
with your string manipulation function.
Thanks MT_dialog