我正在使用SDK 5.0.4。我必须在广告模式下设计一个ble。它测量电池电压并宣传它。对于此应用程序,我正在使用示例
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,//值* 0.625ms = MS
///广告的最大时间间隔
.intv_max = 1600,
这1秒的广告时期适合我。
But if I set any value more than 1 Second it does not works. Even i can not see BLE in scanning app.
10秒钟我正在做以下设置 -
#define APP_ADV_DATA_UPDATE_TO (1000) // value*10ms = ms
.intv_min = 32,//值* 0.625ms = MS
///广告的最大时间间隔
.intv_max = 16000,
设备:
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
亲MT_dialog,
感谢你的回复。实际上我是这个芯片的新手。所以没有浪费的想法。我假设BLE_APP_BAREBONE是一个预先测试的示例。它应该对最小的adv周期(20 ms)进行良好,以最大的adv周期(10.24 s)。这些睡眠和看门狗的事情也受到对话开发团队非常受到优质的。
请发送一些可用于10秒钟的示例代码。
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
亲MT_dialog,
Thank you again. Yes this the thing I am looking for. Let me test with the code settings you suggested.
如果进一步遇到任何问题,我会再次误解你。
亲Support@Dialog,
谢谢你过去的支持。现在我正面临一个新问题。如果我在10秒内保留数据更新期和广告时期,一切都正常工作。但我想每2秒钟更新数据,而希望每10秒宣传一次。此配置无法正常工作,我每2秒都获得广告数据。我的配置如下 -
#define app_add_data_update_to(200)//值* 10ms = ms
.intv_min = 32,//值* 0.625ms = MS
///广告的最大时间间隔
.intv_max = 16000,
const static sleep_state_t app_default_sleep_mode = ARCH_EXT_SLEEP_ON;
Hello abhikalitra,
为延迟回答你的问题而道歉......
数据更新期限定义了我必须更新数据时。如果您按照流程,当定时器过期时,广告停止,然后用新数据重新启动。根据要求,数据正在更新,然后正在宣传新数据。
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()回调函数。
这是推荐,因为您要在更新时传输。甚至,如果您多次更新数据并在可能是第3次更新之后进行通告,则仅在第3次迭代中更新的数据将被宣传。如果您只想每10秒才能宣传一次,那么每10秒只更新一次数据就会有意义。
如果您有更多问题,请告诉我们。
Best,
LC
亲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.
这意味着我必须做5个迭代,并在我必须做广告数据的每个第五次迭代。
亲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.
等待有利的回应。
Hello abhikalitra,
我不确定我是否正确理解了这个问题。所以这是我明白的,请确认。
1.在您的项目中,您必须监控硬件中交换机的状态(这是每2秒钟的开发板)一次。
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?
如果是,则每2秒监视开关,每2秒是来自广告的单独本地事件,并且可以在广告分组中更新本地存储的数据,并在已经完成的每10秒传输一次。
如果我理解问题,请告诉我。
Best,
Leepeng
亲爱的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_add_data_update_to(200)//值* 10ms = ms
.intv_min = 32,//值* 0.625ms = MS
///广告的最大时间间隔
.intv_max = 16000,
const static sleep_state_t app_default_sleep_mode = ARCH_EXT_SLEEP_ON;
但遗憾的是,数据更新和广告两者都在2秒钟内发生。所以请建议我在代码中制作什么改变以实现我的要求。
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...
将广告更新设置为10秒,广告间隔可以像已设置的那样。
#define APP_ADV_DATA_UPDATE_TO (1000) // 1000*10ms = 10sec
更新数据可以以不同的方式完成。
Create a separate update function, say
void timeout_update_cb(void)
{
//您阅读交换机的状态并保存它
ARCH_SET_PXACT_GPIO();//这是一个软件光标,可在Power Profiler中视觉上看到。
// Setting a timer for 2 seconds. When timer is expired, read the status.
app_easy_timer(200, timeout_update_cb);
}
在开始广告时调用此函数。在功能中说
void user_app_adv_start(void)
注意:您可以将交换机状态保存到某些本地变量或直接用于在功能中更新的设备制造商信息mnf_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
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.