prox_reporter rtc_interrupt_hdlr trips twice when in ARCH_EXT_SLEEP_ON

⚠️
Hi there.. thanks for coming to the forums. Exciting news! we’re now in the process of moving to our new forum platform that will offer better functionality and is contained within the main Dialog website. All posts and accounts have been migrated. We’re now accepting traffic on the new forum only - please POST any new threads at//www.xmece.com/support. We’ll be fixing bugs / optimising the searching and tagging over the coming days.
10 posts / 0 new
Last post
andrewl
Offline
Last seen:2 weeks 2 days ago
加入:2020-11-05 02:45
prox_reporter rtc_interrupt_hdlr trips twice when in ARCH_EXT_SLEEP_ON

Hi, folks,

I've been tracking a fairly irritating bug, and I finally managed to reproduce it on Dialog sample code. I set up the prox_reporter with CFG_EXT_SLEEP_WAKEUP_RTC so that it will wake up from sleep via the RTC.

When I run the prox_reporter with ARCH_SLEEP_OFF, everything runs just fine. The rtc_interrupt_hdlr trips once every 20 seconds (10 seconds of advertising and 10 seconds before the RTC hits). That's all just ducky.

但是,当我使用ARCH_EXT_SLEEP_ON运行PROX_REPORTER时,在RTC_INTERRUPT_HDLR触发之后,它会在稍后再次触发* 696ms。如果你试图可靠地安排一些东西,那就不好了。

This bug also seems to affect the Timer1 handler as that's what I was tracking down. I'm reporting it on the RTC as it's a *LOT* easier and more obvious to catch this on the RTC handler.

That's too close to the advertising interval to be coincidence. What is the BLE sleep code doing to cause this? And how do I fix this?

谢谢。

设备:
PM_Dialog
Offline
Last seen:1 day 5 hours ago
工作人员
加入:2018-02-08 11:03
嗨安德鲁尔,

嗨安德鲁尔,

感谢your question. Let me try to explain how the prox_reporter works when the CFG_EXT_SLEEP_WAKEUP_RTC is defined.

Initially, the device will start adverting. The default sleep mode is extended sleep – see app_default_sleep_mode in user_config.h. This means that the system will go into extended sleep mode between advertising intervals, and it will wake-up automatically via the BLE timer.

After a pre-defined time (3min) – see .advertise_period in user_default_hnd_conf structure in user_config.h ( this value can be changed; for example 12000 advertising for 12sec) – the device will stop adverting and the app_advertise_complete() callback will be triggered and the chip will go into permanent sleep mode ( without advertising). In this callback the RTC is configured to trigger wake-up interrupt from extended sleep – see configure_rtc_wakeup().

If you go inside the configure_rtc_wakeup(), in the rtc_time_t time you can find the RTC configuration: 11h , 55min, 30 sec ) . So, the rtc_interrupt_hdlr() will be triggered when the advertisement has been stopped and after 11h , 55min, 30 sec and then chip will wake up.

I would recommend you to do a quick test and verify it with the SmartSnippets Toolbox Power Profiler.

Change the advertising period to 12 sec: .advertise_period = MS_TO_TIMERUNITS(12000),

Configure the RTC to wake up the DA14531 after 15 sec :

rtc_time_t time = {.hour_mode = rtc_hour_mode_24h,.pm_flag = 0,.hour = 00,.minute = 00,.sec = 5,.hsec = 00};

Thanks, PM_Dialog

andrewl
Offline
Last seen:2 weeks 2 days ago
加入:2020-11-05 02:45

Hi, PM_Dialog,

> After a pre-defined time (3min) – see .advertise_period in user_default_hnd_conf structure in user_config.h ( this value can be changed; for example 12000 advertising for 12sec)

是的,默认值为3分钟,我更改为此,以便我可以更快地复制错误。

>如果您进入CONFIGURE_RTC_WAKEUP(),请在RTC_TIME_T时间内找到RTC配置:11h,55min,30秒)。因此,将在广告已停止时触发RTC_Interrupt_hdlr(),在11h,55min,30秒之后,芯片将唤醒。

No, that is不是这是如何工作的。CONFIGURE_RTC_WAKEUP()每次通过时将时间重置为11:55:30,以便将来可以在将来10秒内设置警报。因此,只要在App_Advertise_Complete()末尾的Configure_rtc_wakeup()触发时,RTC时间都会重置,并将告警将来设置10秒钟。

The rtc_interrupt_hdlr() then fires 10 seconds in the future (sleep+10s). That's fine. If ARCH_EXT_SLEEP_ON is set, the problem is that it *also* fires again 696ms later (sleep+10+.696s). That's not fine.

我提供了一个真实的解释错误。我曾在我的安捷伦示波器和我的Keithley Sourcemeter上验证了它。我一直在狩猎兔子洞,我介绍了一种在对话框代码中复制它的方法。除非响应恢复谈论中断屏蔽和可能的优先级反转,否则它可能不是答案。

> I would recommend you to do a quick test and verify it with the SmartSnippets Toolbox Power Profiler.

我建议您将此票证向上用示波器手。我如何升级这个?

谢谢。

PM_Dialog
Offline
Last seen:1 day 5 hours ago
工作人员
加入:2018-02-08 11:03
嗨安德鲁尔,

嗨安德鲁尔,

感谢your comments. I will escalate this internally to start investigating this and I’ll get back to you.

Thanks, PM_Dialog

andrewl
Offline
Last seen:2 weeks 2 days ago
加入:2020-11-05 02:45
非常感激。感谢

非常感激。感谢doing that.

PM_Dialog
Offline
Last seen:1 day 5 hours ago
工作人员
加入:2018-02-08 11:03
嗨安德鲁尔,

嗨安德鲁尔,

Please check configure_rtc_wakeup(). This function is triggered when the advertisement has been stopped in order to configure the RTC as a wake-up source.

According to configure_rtc_wakeup(), the alarm interrupt is explicitly set to 10 seconds - alarm_time.sec += 10;

RTC_SET_ALARM()将作为输入参数作为anall_time和RTC_ALARM_EN_SEC(当已达到时间报警寄存器时启用以触发警报)

因此,rtc_interrupt_hdlr将在发生警报事件时生成中断(每10秒钟。)

如果更改armar_time.sec + = 2,则会看到RTC_Interrupt_hdlr每4秒发出每4秒发出一次。

Thanks, PM_Dialog

andrewl
Offline
Last seen:2 weeks 2 days ago
加入:2020-11-05 02:45
>所以,RTC_INTRUPT_HDLR

>所以,RTC_INTRUPT_HDLRwill generate an interrupt when alarm event occurs (every 10 seconds.)

Yes, that is true. But it *also* generates another interrupt 696ms later when it goes to sleep. Why?

当我建议你找到有示波器的人时,我发出了不止一点的尖锐;但是,如果没有这样做,你就不会调试这个。

This bug causes hiccups if you have something that relies on the handler firing correctly.

谢谢。

PM_Dialog
Offline
Last seen:1 day 5 hours ago
工作人员
加入:2018-02-08 11:03
嗨安德鲁尔,

嗨安德鲁尔,

我正在努力,所以我会回复你。

Thanks, PM_Dialog

PM_Dialog
Offline
Last seen:1 day 5 hours ago
工作人员
加入:2018-02-08 11:03
嗨安德鲁尔,

嗨安德鲁尔,

抱歉耽搁了。不幸的是,我无法复制这个问题。当触发configure_rtc_wakeup()时,我正在切换p08,并且当触发rtc_interrupt_hdlr()时p09。请参阅附件截图。我用逻辑分析仪探测p08和p09。RTC_interrupt_hdlr()稍后再次启动696ms。

The device is adverting for 5 seconds and the configure_rtc_wakeup() is executing after 4 seconds.

Could you please share a screenshot from the oscilloscope so that I can understand it better?

Thanks, PM_Dialog

Attachment:
andrewl
Offline
Last seen:2 weeks 2 days ago
加入:2020-11-05 02:45
当然。给我几天。

当然。给我几天。我正在进入这一点到“简单的信标”代码库,它调用了很多机械。这应该使追踪更容易。