Advertising period more than 1 second not working

12 posts / 0 new
Last post
abhikalitra
Offline
Last seen:3 years 6 days ago
加入:2014-10-30 07:43
Advertising period more than 1 second not working

HiSupport@Dialog,

I am using SDK 5.0.4. I have to design a BLE in advertising mode. It measures battery voltage and advertise it.For this application I am using example
SDK 5.0.4\SDK 5.0.4\DA1458x_SDK_5.0.4\DA1458x_SDK\5.0.4\projects\target_apps\ble_examples\ble_app_barebone.

I am setting advertising period 1 Second using the following settings--

#define APP_ADV_DATA_UPDATE_TO (100) // value*10ms = ms

.intv_min = 32, // value*0.625ms=ms

/// Maximum interval for advertising
.intv_max = 1600,

This 1 Second advertising period works perfectly for me.

But if I set any value more than 1 Second it does not works. Even i can not see BLE in scanning app.
For 10 Second I am doing the following settings--

#define APP_ADV_DATA_UPDATE_TO (1000) // value*10ms = ms

.intv_min = 32, // value*0.625ms=ms

/// Maximum interval for advertising
.intv_max = 16000,

Device:
MT_dialog
Offline
Last seen:3 months 3 days ago
Staff
加入:2015-06-08 11:34
Hi abhikalitra,

Hi abhikalitra,

The parameter that controls the advertising interval is the user_adv_conf struct and the .intv_min and .intv_max members. The APP_ADV_UPDATE_TO is the periodical change of the advertising string. In the .intv_max you set the maximum advertising interval to 16000, and i suppose that the sleep mode is disabled and since the sleep mode is disabled the watchdog is keep counting even when you should go to sleep, and eventually the watchdog elapses and you get an NMI interrupt. So you can either disable the watchdog or enable the sleep mode.

Thanks MT_dialog

abhikalitra
Offline
Last seen:3 years 6 days ago
加入:2014-10-30 07:43
Dear MT_dialog,

Dear MT_dialog,

Thank you for your reply. Actually I am a newbie with this chip. So do not have the wast idea. I assume that ble_app_barebone is a pre tested example. It should perform well for minimum adv period(20 mS) to maximum adv period(10.24 S). These sleep and watchdog things are also very well taken care by the dialog development team.

Please send me some sample code which can be used for 10 second period.

MT_dialog
Offline
Last seen:3 months 3 days ago
Staff
加入:2015-06-08 11:34
Hi abhikalitra,

Hi abhikalitra,

Yes the ble_app_barebone is a pretested example but if you have the device advertising with a 10 second interval the, BLE interrupt (the indication that the device should start advertise it take longer to occur than the watchdog timer). So in order for your device to work with this kind of interval you can enable the sleeping feature (that will freeze the watchdog) just change the app_default_sleep_mode = ARCH_SLEEP_OFF; to ARCH_EXT_SLEEP_ON in the user_config.h file or you can just disable the watchdog by #undef the CFG_WDOG in the da1458x_config_basic.h file.

Thanks MT_dialog

abhikalitra
Offline
Last seen:3 years 6 days ago
加入:2014-10-30 07:43
Dear MT_dialog,

Dear MT_dialog,

Thank you again. Yes this the thing I am looking for. Let me test with the code settings you suggested.

If further I feel any problem, I will bug you again.

abhikalitra
Offline
Last seen:3 years 6 days ago
加入:2014-10-30 07:43
Dear Support@Dialog,

DearSupport@Dialog,

Thank you for you support in past. Now I am facing a new problem. If I keep data update period and advertising period both 10 seconds, everything works fine. But I want to update data every 2 second while want to advertise every 10 second. This configuration is not working, I am getting advertising data every 2 seconds. My configurations are as follows-

#define APP_ADV_DATA_UPDATE_TO (200) // value*10ms = ms

.intv_min = 32, // value*0.625ms=ms

/// Maximum interval for advertising
.intv_max = 16000,

const static sleep_state_t app_default_sleep_mode = ARCH_EXT_SLEEP_ON;

LC_Dialog
Offline
Last seen:1 month 1 day ago
Staff
加入:2016-09-19 23:20
Hello abhikalitra,

Hello abhikalitra,

Apologies for the delay in answering your question...

The data update period defines when the data must me updated. If you follow the flow, when the timer expired the Advertisement is stopped and then restarted with the new data. As per the requirement the data is being updated and then that new data is being advertised.

In the background, in order to update the data you must stop the advertising and the update the data. Otherwise, the data you send may be corrupted between the old one and new data without stopping the advertisement. Once the data is updated, theuser_app_adv_start()is called in theuser_app_adv_undirect_complete()callback function.

这是推荐的,因为你想transmit the as it is updated. Even, if you update the data multiple times and advertise after may be the 3rd update, only the data updated in the 3rd iteration will be advertised. If you want to advertise once every 10s only, then it makes sense to update the data only once every 10s.

Please let us know if you have any more questions.

Best,

LC

abhikalitra
Offline
Last seen:3 years 6 days ago
加入:2014-10-30 07:43
Dear LC,

Dear LC,

Thank you for your support. I have gone through your suggestion. But sorry my requirement is something different. Actually In my project I have to check the status of a switch every 2 seconds. But I have to advertise the latest updated packet at every 10 second. So please suggest me how to achieve this in code.

It means I have to do 5 iterations and on every 5th iteration I have to advertise data.

Dear LC, I am very newbie in this Dialog development. So please give me solution with some code example or tell me what exactly syntax changes i have to make in my code and in which file.

waiting for a favourable response.

LC_Dialog
Offline
Last seen:1 month 1 day ago
Staff
加入:2016-09-19 23:20
Hello abhikalitra,

Hello abhikalitra,

I am not sure if I understood the question correctly. So here is what I understood, please confirm.
1. In your project, you have to monitor the status of a SWITCH in your Hardware (this is the Development board that is also advertising) once every 2 seconds.
2. At the same time, you also want to update the status of the SWITCH in the advertisement packet every 2 seconds.
3. But, you want this updated data to be advertised only once every 10 seconds.
Is this what your requirement is?

If yes, you are monitoring the switch every 2 seconds which is a separate local event from advertising and this locally stored data can be updated in the advertisement packet and transmitted every 10 seconds which is already being done.

Please let me know if I understood the question wrong.

Best,
Leepeng

abhikalitra
Offline
Last seen:3 years 6 days ago
加入:2014-10-30 07:43
Dear Leepeng,

Dear Leepeng,

Thank you for prompt reply. Yes you are right. This is my exact requirement. To achieve this I made following changes in code

#define APP_ADV_DATA_UPDATE_TO (200) // value*10ms = ms

.intv_min = 32, // value*0.625ms=ms

/// Maximum interval for advertising
.intv_max = 16000,

const static sleep_state_t app_default_sleep_mode = ARCH_EXT_SLEEP_ON;

But unfortunately data update and advertising both are happening at 2 seconds. So please suggest me what changes I have to make in code to achieve my requirement.

LC_Dialog
Offline
Last seen:1 month 1 day ago
Staff
加入:2016-09-19 23:20
Hello abhikalitra,

Hello abhikalitra,

In your code, you are setting the advertisement update time period to 2 seconds. As I said in the previos replies, this is also setting the advertisement time period to that value since to udpate the data you have to stop the advertising which calls some callback functions and the advertising is started again. This process is needed and not recommended to be altered since these are hooks into the SDK. In order to update your data every 2 seconds and advertise every 10 seconds, please follow these steps...

Set the advertising update to 10 seconds, the advertising interval can be as you have already set.
#define APP_ADV_DATA_UPDATE_TO (1000) // 1000*10ms = 10sec

Updating the data can be done in different ways..
Create a separate update function, say
void timeout_update_cb(void)
{

// YOU READ THE STATUS OF THE SWITCH HERE AND SAVE IT
arch_set_pxact_gpio(); // This is a software cursor to visually see in the power profiler.

// Setting a timer for 2 seconds. When timer is expired, read the status.
app_easy_timer(200, timeout_update_cb);
}

Call this function when you start advertising., say in function
void user_app_adv_start(void)

Note: You can save the switch status to some local variables or directly to device manufacturer information that is being updated already in the functionmnf_data_update()在上面的函数中调用。

This may not be the best way, but one of the ways to update your data locally for every 2 seconds and update your adveritsement packet every 10 seconds. But please notice that only the latest updated data will be advertised. However, if you want to make use of the status to perform some other things, this can be a way to do that as well as update the advertising packet.

Best,
LC

abhikalitra
Offline
Last seen:3 years 6 days ago
加入:2014-10-30 07:43
dear LC,

dear LC,

Thank you for support. Sorry for late reply. I was busy in some other task. I will try your solution and further inform you.