Hi Dialog Team,
我正在使用SDk文件夹中的misc文件夹中的“ble\u app_uunconon”示例编写自定义板。我的项目要求如下。
- 每当没有BLE或其他活动时都会进入睡眠模式(ARCH_EXT_SLEEP_ON)。
- When external sensor gives data, dialog chip will wakeup on pin change interrupt and start decoding the data from the sensor using timer 0.
- Decode the data and update it on the advertisement string.
- 开始广告使用“user_app_adv_start()的一个d start an easy timer that will expire in 6 seconds. Till then the advertisement data is advertised. When app_easy timer expires, stop the advertisement using 'app_easy_gap_advertise_stop()' and this will put the chip to sleep.
- 在停止广告之前,将启用唤醒引脚以在下一个数据准备就绪时从睡眠中唤醒芯片。
I have mananged to complete the above steps in debugging mode. When I run my program on the RAM and disconnect the debugger the current consumption reduces to 2.4µA. When the external interrupt occurs the current rises to around 50µA and oscillates between 2.4µA to 50µA. ( I guess this is due to the sleep between advertising internvals). So I think the above concept works fine.
But I am stuck at two problems.
1)在睡眠模式(调试器断开条件)时,当我的芯片广告时,我认为它仅广告一次。因为我在BLE扫描仪应用上检查它,我注意到RSSI值只会更新一次。它只会传播一次?如果它正在发送一次,那么为什么当前振荡在2.4μA到50μA之间的6秒持续时间?
2) The above condition works for a while and all of a sudden, the current increases to 350µA and then there is no advertisement at all. Is my program halted?
Please note that the above two condition occurs only when I disconnect the debugger.
什么可能导致这两个问题在睡眠期间?
Regards,
标记

Hi Mark,
When performing any kind of measurements in sleep mode, you should not run the firmware in debug mode. Otherwise, the device fails to go into sleep mode and the power consumption will be dramatically increased. To do so, my suggestion would be to have the debugger de-attached, as this prevents the system to sleep. Additionally, a very important tip is that in case you are using SPI Flash in your custom board, you should power it down.
你能试着进一步调试它吗?请在调试模式下运行它-功耗在这一步中不重要。你提到过广告一次…第一次广告后fw做什么?WDOG已启用或禁用?我建议你启用它,否则如果fw在某处绊倒,你将不会被通知。如果完全确定fw按预期运行(未发生WDOG或NMI),请使用SmartSnippets工具箱的Power Profiler检查它是否未发布一次。
Thanks, PM_Dialog
嗨,下午对话,
When running in debug mode, the code advertises properly and the firmware does not get stuck anywhere. I ran the code in debug mode for more than an hour and it works fine. When I disconnect the debugger and run it, the problem ( as mentioned in the first post) occurs.
我还有一个疑问。“杂项”文件夹中的示例代码“ble\U app\u nonon”是否支持扩展睡眠模式?。因为在调试模式下连接时,它工作正常。但是当我断开调试器时,问题就开始了。
I am advertising for 6 seconds and stopping it. But it advertises only once and but there is an oscillation in current consumption during the whole 6 seconds. That means that it is waking up between advertising intervals but why no packets are being transmitted. ?
Regards,
标记
Hi Mark,
SDK6.0.12的BLE_APP_NONCONN项目默认情况下不支持睡眠模式。但是,您可以更改睡眠模式配置。由于它是自定义代码和自定义板,因此可以共享您在睡眠模式下配置的更改吗?启动调查哪个是路由原因的另一个选项可能是开始切换GPIO或打印一些调试消息,因为仅在非调试模式下卡住的固件gests。在调试模式下,我假设您已启用WDog ..
Thanks, PM_Dialog
Hi PM_Dialog,
My firmware doesnt get stuck. It transmits only a single advertisement for the entire 6 second duration. But in debug mode it transmits 4 to 5 times for the 6 second duration. Why does it transmit only once in non-debug mode?. Is the sleep mode affecting the ble advertisement?.
对于睡眠模式,我做了以下更改。
我6秒后停止了广告,芯片进入了长时间睡眠。
Regards,
标记
Hi Mark,
Not sure what happen since it is a custom board/code. Can you please use the arch_printf() in the user_app_adv_start() and in the user_app_adv_nonconn_complete()? Also, can you please send me a screenshot from the Power Profiler? When the debugger is attached and de-attached.
Thanks, PM_Dialog
你好 ,
我没有选择在我的自定义板打印消息。我用万用表测量电流消耗。
我认为问题在于在我准备好宣传的时候调用user_app_adv_start()函数。
我已经附上下面的代码进行推荐。
Hi PM_Dialog,
As u suggested, i pulled down a GPIO onperiph_init()and pulled it high before going to sleep beforearch_goto_sleep(sleep_mode)在Arch_Main.cn。我附上了示波器输出的屏幕截图。我面临的问题是,当我调用user_app_adv_start()时,芯片仅发送一次数据。我通过查看Android中的BLE Scanner应用程序上的RSSI值来确认这一点。我也附上了示例代码。
As I have an urgent demonstration of my product, I have changed the advertising interval to 200ms and somehow managing to advertise the data by calling 'user_app_adv_start()' and after 1 second I am stopping it and in the advertise complete function I am calling 'user_app_adv_start()' again. I am repeating these steps for 6 seconds and I am getting multpile advertising hits in my app. Each time when I call 'user_app_adv_start()' I get only 1 hit in my app until I stop the advertisement and call it again.
Why does 'user_app_adv_start()' advertising the data only once?
Can u please share me a sample code for beacon data which wakes up on an external interrupt and modifies the advertising string and transmits it and goes to sleep.
Regards,
标记
Hi Mark,
让我检查一下,我会回复你。
Thanks, PM_Dialog
Hi Mark,
ARCH_MAIN.c是SDK文件,强烈建议不要修改任何SDK文件。所有修改都应在应用程序层中完成,以user_开头的文件中。作为SDK的所有其他文件相关,如果其中任何一个都被修改,我们无法保证应用程序将正常工作。SDK应使用,因为它由对话框提供,而无需任何其他修改。
关于你的源代码,我无法编译它,因为我几乎没有错误。请参阅下面的差异文件,了解如何停止不可连接的广告,将设备放在睡眠模式下并唤醒。我的建议是从包含广告数据更新的SDK的BLE_APP_SLEEPMODE示例开始。您如何建立应用程序以及如何更新信标数据取决于您。请按照SDK的BLE_APP_SLEEPMODE示例中的步骤操作。
Thanks, PM_Dialog
Hi PM_Dialog,
1) 编译代码时会遇到什么样的错误?。
2) I modified your arch_main.c file because, when my sensor sends an interrupt I have to wait around 20ms for getting the data, but if I dont wait my code will go back into sleep and I will miss the data. That's why I modified the arch_main.c file to wait till I get the data out and then put the chip to sleep. How to prolong the wake time of the chip?. Can you suggest an idea for that?.
3) 当我开始做广告时,我添加到arch_uMain.c中的大部分代码内容都不会执行,因为我正在检查主循环中的条件,并且在我做广告时不会执行它。为什么这会影响你的sdk和广告序列?。
4) When I get an interrupt until I process the data from my sensor I will not start advertising. After I get the data I will start the advertising and I am sure none of my code will run during advertising. So why does that give any problem to the sdk?.
Thanks,
标记
Hi PM_Dialog,
Please support me on the above points. As you suggested I have started working on the sleepmode project in ble_examples. My biggest doubt is when my external sensor gives an interrupt and gives the data only after 20ms, how do I have to prevent the chip from going into sleep for that 20ms after I had woken up from sleep.
Regards,
标记
Hi Mark,
请找到附加的日志文件,其中包含Keil IDE中的错误。指出您正在使用的SDK版本将非常有用。对于SDK版本不确定,但强烈建议使用最新版本(SDK6.0.12)。
Thanks, PM_Dialog
Hi PM_Dialog,
The issue got sorted out after we added the external 32Khz crystal oscillator.
It seems that that the ble_app_sleepmode code is unstable without the 32Khz crystal. But your datasheets say that this 32Khz is optional which is very much misleading. Please correct the datasheets or it may mislead others too. I have spent 3-4 months on this issue and had no clue it was due to the external crystal.
无论如何,谢谢你的在线支持。
Regards,
标记
Hi Mark,
很高兴你能成功。这就是我们在上一次电话会议上讨论的问题。谢谢你的指示。
Regards, PM_Dialog