Background
1>项目名称:项目\ target_apps \ ble_examples \ ble_app_profile
2> #undef cfg_development_debug在da1458x_config_basic.h中
3>for simplify the problem,comment the line ://#include "custs1.h" in user_profiles_config.h;
4>change value of app_default_sleep_mode to ARCH_EXT_SLEEP_ON in user_config.h
const static sleep_state_t app_default_sleep_mode = arch_ext_sleep_on;
5>编译并刻录到外部闪光灯;
Result:
1>Phone will cann't scan the DA except just at power DA;
2>After powered DA,I scan use phone as soon as quick,I will find DA,but connect fail; and can't scan DA any more except reset DA;
Background 2:
基于上面的背景,打开看门狗,并在init中切换一个LED,我发现芯片将再次重置,所以手机将永远
scan DA but connect failed.
我如何正确使用Arch_ext_sleep_on ??
关键词:
Device:
Hi kurbylee,
我已经测试了你的设置,它似乎工作好。我的年代uppose that you are using Smart Snippets to burn your SPI, do you make your device bootable when you are promted from Smart Snippets ? After burning the flash do you reset your board in order for the bootloader to run and boot from your SPI ? By setting the app_default_sleep_mode to ARCH_EXT_SLEEP_ON is enough to set your device to extended sleep. Are you able to see your device correctly when you dont use sleep mode?
Thanks MT_dialog
嗨,mt_dialog
1>是,我使用智能片段(Ver 3.9)将BLE_APP_PROFILE_580.HEX刻录为SPI,SDK Ver是DA1458x_sdk_5.0.3
2>我没有使用bootloader(secondery bootloader.hex),只需刻录ble_app_profile_580.hex使用smartsnippert并使其启动;我可以看到添加的可引导标志(8bytes以7050开头)
3>After burn , I always reboot the board by repower;
4>如果我将app_default_sleep_mode更改为arch_ext_sleep_off,它将非常好;
5>when I use sdk3.0.8,no problem occured,whether define/undef CFG_EXT_SLEEP
ps:I open the same project inDA1458x_SDK_5.0.2.1,and then get same result as in sdk5.3:(
ths kurbylee
Hi kurbylee,
I tested your setup again with a fresh 5.0.3 SDK and burn the image to the flash, it booted normally in reset and by removing the power. Are you able to donwload code by using keil, if yes is the device advertising as it should be ?
Thanks MT_dialog
Thanks MT_dialog for your information.
但我没有解决这个问题:
I burn the app hex with complied with app_default_sleep_mode=ARCH_SLEEP_OFF by smartSnippets 3.9, I can get expected result that the DA is running normal and android phone can scan/connect/access char it ;
if I change app_default_sleep_mode=ARCH_EXT_SLEEP_ON, and I can scan DA once only at time of DA powering.and then phone will never find DA;
今天,我做了一个Anthor测试,我在main_func中添加LED切换:(P07连接LED)
1>app_default_sleep_mode=ARCH_SLEEP_OFF in user_config.h
#undef CFG_DEVELOPMENT_DEBUG
#define CFG_WDOG in da1458x_config_basic.h (for more tests:))
2>在Arch_Main.c:
int main_func(void)
{
sleep_mode_t sleep_mode;
system_init();
GPIO_ConfigurePin( GPIO_PORT_0, GPIO_PIN_7, OUTPUT, PID_GPIO, false );
while(1)
{
uint32_t i;
........................
if (((!BLE_APP_PRESENT) && (check_gtl_state())) ||
(BLE_APP_PRESENT))
{
GPIO_SetActive(GPIO_PORT_0, GPIO_PIN_7);
i=0xfffff;
while (i)i--;
//Disable the interrupts
GLOBAL_INT_STOP();
......................
......................
......................
GPIO_SetInactive(GPIO_PORT_0, GPIO_PIN_7);
i=0xfffff;
while (i)i--;
GLOBAL_INT_START();
}
.....
}
3>现在,我可以看到LED是闪烁,手机无法扫描它(app_default_sleep_mode = arch_sleep_off)
4>if I make app_default_sleep_mode=ARCH_EXT_SLEEP_ON, phone will scan and connect it now;
So I'm confused with the result :
when I add led toggle,DA is normal with app_default_sleep_mode=ARCH_EXT_SLEEP_ON; (it will disconnect after some seconds because of WDOG)
when I remove led toggle,DA is normal with app_default_sleep_mode=ARCH_SLEEP_OFF;
I think there is a strick related with Timer/Inteval and so on... for set app_default_sleep_mode ,but I have not find it:(
另一个信息:当我联系WDOG时,LED将闪烁5次,然后用app_default_sleep_mode = arch_ext_sleep_on保持灯
Another infor: By toggle led, I found that the app into infinit loop while(!ble_deep_sleep_stat_getf());====>in func sleep_mode_t rwip_sleep(void)
Compared sdk5.03 and sdk3.0.8 files one by one, finally I found the culprit.
just chang SetWord16(RF_ENABLE_CONFIG13_REG, PREF_RF_ENABLE_CONFIG13_REG);
to SetWord16(RF_ENABLE_CONFIG13_REG, 0);
在Func rf_nfm_disable,
Everything come back to OK.
Dear Dialog team,
Can you explain how does it effects? What is correct?
你确定这是reason of your question ?
I encountered the exact problem of yours.
我搜索了,rf_nfm_disable叫做,所以我认为这不是原因。
Hi ggotta,
Can you please explain what your problem is ? In the SDK 5 if you want to enable the 580 in sleep mode all you have to do is to set your default sleep mode to ARCH_EXT_SLEEP_ON. The rf_nfm_disable has to do with the near field mode operation and not the sleep operation. The function isn't invoked in the SDK by default its just the API for disabling the near field mode if enabled.
Thanks MT_dialog
Hi,
Thanks for the details.
I enabled extended sleep mode and flashed the DA. After that I was not able connect via JTAG. But later I have gone through some more answers I found the solution. It is working now.
-gotta
Hi Ggotta,
我遇到和你同样的问题,使EXT_SLE之后EP_ON, my phone can't scan the DA now except power on DA time.
How you solve the issue finally? Is it true to only change:
just chang SetWord16(RF_ENABLE_CONFIG13_REG, PREF_RF_ENABLE_CONFIG13_REG);
to SetWord16(RF_ENABLE_CONFIG13_REG, 0);
在Func rf_nfm_disable.
Or other time setting is also necessary?
Hi smdzjl007,
As mentioned above in the previous comment, the rf_nfm_disable doesn't have to do with the sleep but with the near field mode which is disabled by default. In order to put the 580 in sleep mode only the app_default_sleep_mode = ARCH_EXT_SLEEP_ON; is enough to put the device in sleep mode. What is the SDK that you are using, and are you experincing this on a dev kit or on a custom board ? If you are able to scan the device only for a couple of seconds, then either something is wrong with your low power clock or the debuuger stays attached to your device and prevents it from going to sleep if you are using an SDK prior to the SDK 5.0.4.
Thanks MT_dialog
亲爱的mt_dialog团队,
Thanks for your help. Yes, I do find out that modification within rf_nfm_disable function doesn't work at all. I am using SDK 5.0.3. How to locate the problem is related with low power clock or other reason? Should I upgrade to SDK 5.0.4?
另一个问题,da14580输入到睡眠模式后,控制醒来的定时器设置从睡眠中?控制持续时间的计时器是什么?
谢谢,最好的问候,
Hi smdzji007,
The rf_nfm_disable() function doesn't have to do anything with the sleep, if you move to the new SDK 5.0.4 the debugger isn't disabled during sleep so your device should continue advertise even if the debugger stays attached. If by moving into the new SDK doesn't help and you have a custom board check the setting of your LP clock should be either XTAL or RCX, if you are operating under buck mode and you switch to RCX and then you are able to see advertising, then your problem is the external XTAL32 that you have on your custom board.
SDK照顾设备将留在睡眠模式和何时醒来的时间,您所要做的就是设置广告和连接间隔,SDK将照顾其余的并配置系统按时唤醒和睡觉也是如此。
Thanks MT_dialog
谢谢,MT_Dialog团队,非常timely feedback!
I tried to modify user_config.h for advertising and connection intervals as below, actual user_connection_param_conf is not changed:
static const struct advertise_configuration user_adv_conf = {
.addr_src = GAPM_PUBLIC_ADDR,
.renew_dur = 0,
.addr = {0x1, 0x2, 0x3, 0x4, 0x5, 0x6},
.intv_min = 1000, // 625 ms (1000*0.625ms)
.intv_max = 2000, // 1250 ms (2000*0.625ms)
.channel_map = 0x7,
.mode = GAP_GEN_DISCOVERABLE,
.adv_filt_policy = ADV_ALLOW_SCAN_ANY_CON_ANY,
.peer_addr = {0x1, 0x2, 0x3, 0x4, 0x5, 0x6},
.peer_addr_type = 0,
};
static const struct connection_param_configuration user_connection_param_conf = {
.intv_min = MS_TO_DOUBLESLOTS(20),
.intv_max = ms_to_doubleslots(100),
.latency = 0,
.time_out = MS_TO_TIMERUNITS(125),
.ce_len_min = MS_TO_DOUBLESLOTS(0),
.ce_len_max = MS_TO_DOUBLESLOTS(0),
};
But the test result is still failed, the device can broadcast BLE advertisement message for very short time, then sleep and my smartphone can't scan the device anymore.
我应该修改其他内容,以使其睡眠/唤醒作为正常可穿戴设备?
谢谢和最好的问候
Hi smdzj007,
I would suggest not to modify anything (in order to verify that the reason for the 580 not advertising is not the fw), just take ble example from the 5.0.4 as is and run it to sleep mode (const static sleep_state_t app_default_sleep_mode = ARCH_EXT_SLEEP_ON;) in the user_config.h file also run the same example with const static sleep_state_t app_default_sleep_mode = ARCH_SLEEP_OFF; and check if you do that is the device advertising and if it does you will have to set the sleeping mode always to off (ARCH_SLEEP_OFF). Do the above and let me know. Also please let me know if you are using a custom board or a dev kit and if you are using an external XTAL or you are operating with the RCX.
Thanks MT_dialog
Thanks, MT_Dialog team!
I upload my .hex file to other dialog support engineer, he see the same result as me.
https://support.dialog-semicondiondiondum/smartsnippets-spi-flash-program ...
He is using 580 dev kit pro. My design is also use dialog reference design with external XTAL clock. It works fine if switch off sleep.
Anyway, I will try again to download 5.0.4 sdk example to see any difference or not.
In the meanwhile, can you confirm my previous question about advertising and connection intervals adjustment? Are those 2 structures correct? Is my interval setting valid?
谢谢和最好的问候
Hi MT_Dialog team,
After checking with previous colleague, he told me that our design is based on dialog wechat sdk reference design:
https://support.dialog-semiconductor.com/connectivity/reference-designs?...
I tried to download wechat sdk reference design and run it to sleep mode (const static sleep_state_t app_default_sleep_mode = ARCH_EXT_SLEEP_ON;) in the user_config.h file. The problem is the same as mine, device sleep and can't be discovered by smart phone app: AirSyncDebugger
这里有两个问题:
- did wechat SDK reference design tested for extended sleep mode?
- how to replace wechat SDK reference design used dialog SDK to 5.0.4 standard SDK?
谢谢,最好的问候,
Hi smdzjl007,
- Yes, the wechat is tested to operate under extended sleep mode and i am also able to see the advertising string when the device is in sleep mode.
——我不问题,你的意思是如何replace the fw ? You can run directly one of the SDK examples via JTAG or you can download the .hex file of the examples via UART or if you have a flash, you can burn the flash and upon power up the 580 will download the code from the flash.
Thanks MT_dialog
Hi MT_Dialog team,
The question is coming from fact that: wechat reference design was released with 14580 SDK version x at Nov'15, as there is new 14580 sdk version 5.0.4 recently, if I need upgrade wechat reference design sdk source into 5.0.4 sdk, what procedure should I do?
谢谢,最好的问候,
Hi smdzji007,
Depending on where the the fw is located and if the fw that you are using is the wechat as provided by dialog, you should compile the code and download it to your device. If the device is using a flash memory or an EEPROM memory in order to load the fw you can erase and reburn the device via the Smart Snippets tool, either via JTAG or via UART (depending on the interface your device has available). In case the wechat is burned in OTP you wont be able to update the OTP since you can only program it once. You can also test the new source code via downloading the new fw directly to the sysram via keil and the JTAG interface (again if this interface is available on your device, you can also debug the code in that case) also you can download code into the sysram via UART through the Smart Snippets tool.
Thanks MT_dialog
Dear MT_dialog,
Today I ask my colleague to measure clock output signals. You can find attached 3 jpg.
If disable sleep, we can measure both 32KHz and 16MHz clock: 32K_withoutsleep.jpg and 16M_withoutsleep.jpg
If enable sleep, only can see 32KHz signal:32K_withsleep.jpg
I am using SDK5.0.4, the ble_app_sleepmode from SDK example folder. According to example code, the wakeup duration is 0.5s, so it should be very quick. But my test result looks that the 14580 failed to wakup and I can't scan the 14580 device from my smartphone
你能帮助暗示更麻烦的射击吗?
BTW,应该在睡眠前/之后配置clk_16m_reg作为xtal16_bias_sh_enable寄存器吗?
谢谢和最好的问候
Hi smdzji007,
The ble_app_sleepmode falls to permanent sleep after a specific period of time (a few seconds) and the XTAL16 is disabled when sleep is enabled, you can try using a another project that doesn't sleep constantly but wakes up in predefined periods in order to advertise and check again. You dont have to configure the CLK_16M_REG explictly, the SDK will take care of that in the periph_init() function.
此外,特定项目也实现了按钮按下,当按下设备唤醒并继续宣传,必须尝试按下该按钮以唤醒设备。
Also please dont post questions in irrelevant topics, you can always create a new thread if theres any follow up question.
Thanks MT_dialog
Hi MT_dialog,
如果确认BLE_APP_SLEEPMODE行为在我的电路板上是正确的,那么我应该在14580进入延伸或深睡眠后启用自动唤醒添加一个XTL32定时器回拨功能或还有什么?我应该使用哪个示例项目参考?
The reason for me to post question here is because I found my problem is relevant with current thread topic, and I can't find where is the button to create new thread. If my posting cause any in-convenience to you, I need say apology to you.
谢谢,最好的问候,
Hi smdzjl007,
You could try functionapp_easy_timerif the sleep time you specify is not too long(like under 5min)
布罗尔,
谢谢你的反馈,Qinjinyfrom Dialog team,
As previous support engineer said, the XTAL16 clock is disabled when sleeping is enabled, whether app_easy_timer can work normally? Should I write one call back function to enable XTAL32 clock by registering call back function like below?
static const struct arch_main_loop_callbacks user_app_main_loop_callbacks = {
.app_before_sleep = my_app_enable_xtal32_clock,
.app_resume_from_sleep = my_app_disable_XTAL32_clock,
};
嗨mt_dialog,
I re-study the ble_app_sleepmode example and found below definition within da1458x_config_advance.h
/****************************************************************************************************************/
/* Wakeup from external processor running host application. */
/****************************************************************************************************************/
#undef CFG_EXTERNAL_WAKEUP
/****************************************************************************************************************/
/ *当消息发送到GTL * /时,唤醒外部处理器
/****************************************************************************************************************/
#undef CFG_WAKEUP_EXT_PROCESSOR
Not sure whether it is aligned with your previous answer that the ble_app_sleepmode fall into permanent sleep until external button press trigger wake up. So, how this example code to undefine the external wake up but using external wake up?
Confusing for me
Best regards,
smdzjl
Hi smdzjl007,
您在那里看到的定义与BLE_APP_SLEEPMODE项目无关,但在580以完全嵌入模式(由SDK定义)时,使用外部唤醒。如果您有兴趣查看指示Pargulullar项目的代码,您可以检查以下内容:
Thanks MT_dialog
嗨mt_dialog,
Now I use Da14580 pro kit, and I set the app_default_sleep_mode to ARCH_SLEEP_OFF. It can work well when I burned hex file to SPI falsh, press reset button and pull the daughter board away from mother board.(It's powered by external battery.) It can be scanned from my cellphone. But when I set app_default_sleep_mode to ARCH_EXT_SLEEP_ON, it cannot be scanned from my phone. Does any else code I have to set? Which oscilator does the chip use when it enter the sleep mode? Thanks.
嗨梁云浩,
Please dont post questions in irrelevant topics, you can always create a new thread.
关于您的问题,尝试直接从Keil运行项目,并在延长睡眠状态并检查您是否能够查看您的设备广告,也尝试使用SDK示例进行操作并检查。当设备处于睡眠模式时,使用LP时钟,这意味着设备与外部XTal32或使用RCX操作,可以从DA1458x_config_Advanced.h文件中的CFG_LP_CLK定义配置此选项。
Thanks MT_dialog
那是工作!
我的问题:当我设置扩展睡眠模式时,我的手机无法连接到我的BLE设备,但如果我设置sleep_mode = arch_sleep_off,则是正常的。然后我将cfg_lp_clk(da458x_config_advance.h)的值从lp_clk_xxtal32更改为lp_clk_rcx20,即确定。
but i have a another problem that is when i set the sleep mode to deep sleep my phone will not find the ble device.
如果有人能告诉我为什么?
SDK:5.0.3 5.0.4
device:not Unofficial device
Hi zhounaichun,
Well, if you are under development mode and you 've set the ARCH_DEEP_SLEEP_ON and you ve also changed the memory configuration to CFG_MEM_MAP_DEEP_SLEEP (undefine CFG_MEM_MAP_EXT_SLEEP and set the CFG_MEM_MAP_DEEP_SLEEP) then you should be able to test the fw in deep sleep mode. But to see the proper power consumption of the device you will have to burn the OTP with your fw, so in every wake up the image will be copied from the OTP to the sysram, since in deep sleep the sysram will be shut down.
Thanks MT_dialog