嗨对话框,
现在我遇到了一个问题,唤醒后不起作用。
Referring to ble_app_sleepmode sample project, I added UART receive interrupt handler.
作为示例项目,我写下唤醒回调如下。
static void enable_Wakeup_cb(void)
{
if(getBits16(sys_stat_reg,per_is_down))
{
GPIO_init();
periph_init();
}
setbits32(gp_control_reg,ble_wakeup_req,1);
if(arch_ble_ext_wakeup_get())
{
ARCH_SET_SLEEP_MODE(app_default_sleep_mode);
arch_ble_force_wakeup();
ARCH_BLE_EXT_WAKEUP_OFF();
app_easy_wakeup();
}
}
但是,有时不会出现UART接收中断。
唤醒中断和GPIO INT正常工作,但UART接收INT。
我觉得UART初始化需要比GPIO更多的时间,所以我插入了几秒钟定时器等待和Periph_init()再次等待。
但结果是一样的。
你能告诉我唤醒后挪威启动UART的条件吗?
Thanks,
Diogenes.
Device:
Hi diogenes,
在BLE_APP_SLEEP模式示例中,APP_ADV_DATA_UPDATE_TO的到期后,设备进入深度休眠模式(默认值为10秒),因此所有外设都会关闭电源。这意味着您无法在设备唤醒时具有UART活动。如果芯片被唤醒,您能否确保您正在尝试使用UART?此外,如果您试图解释一下您想要完成的东西,那将是非常有帮助的。当您在UART中发送数据时,您想唤醒您的设备,还是您想在芯片被唤醒以后有UART活动?如果您希望实现第一个选项,请注意,为了唤醒,您应该激活WKUP控制器,否则芯片将继续入住睡眠模式。另外,你能澄清你在努力的uart吗?在BLE_APP_SLEEPMODE示例中,仅实现UART2,可以通过将放入DA1458X_CONFIG_BASIC.H的CFG_PRINTF宏来激活您可以激活
谢谢,PM_DIALOG.
嗨对话框,
感谢您的评论。
至于APP_ADV_DATA_UPDATE_TO,我改为1毫秒and my program is to UART receive interrupt after wake-up.
我通过示波器测量了定时,并且我检查了UART接收的定时在唤醒后至少超过10msec发生。
但是没有检测到UART接收中断,我想象UART接收中断本身将工作,因为它在几秒钟后被检测到。
So I'd know how many seconds is neede to enable UART receive interrupt.
当然,UART接收中断并在我的程序中发送正常工作。
So how should I do to enable UART receive interrupt after wake-up?
Thanks,
Diogenes.
嗨对话框,
Could I add some information about the current problem.
Firstly as for UART receive interrupt doesn't normally after weke-up and my program sometimes jumps to L.369 in rwble.c (ASSERT_WARNING(0);).
if((development_debug)&&(use_power_optimizations))assert_warning(0);// l.369
{
slp_period_retated = slp_period;
//如果此断言命中,则LP ISR持续时间长于时间
//已通过LP_ISR_TIME_XTAL32_CYCLES和LP_ISR_TIME_USEC保留。
if(sleep_lp_cycles &&(sleep_lp_cycles
}
But Receive interrupt itself wasn't caught and I must judge it's not handler's problem.
Then I doubted wake-up delay time at L.400 in arch_system.c ().
else // USE_POWER_OPTIMIZATIONS
{
delay = minime_sleep_duration;
// if XTAL_TRIMMING_TIME_USEC changes (i.e. gets larger) then this
// will make sure that the user gets notified to increase "delay" by 1 or more
// slots so there's enough time for XTAL to settle
#if((3125 +(minimue_sleep_duration + 625))<(lp_isr_time_usec + 1100))//1.1ms max上电时间// l.395
#错误“最小睡眠持续时间太小,对于使用的16MHz水晶......”
# 万一
}
rwip_wakeup_delay_set(delay); // L.400
但考虑到L.395的约束,我理解将最终_sleep_duration更改为1slot。
然后我认为这是睡眠模式和我重写arch_set_deep_sleep()的问题;to arch_set_extendend_sleep();在void user_app_adv_start(void)中,但结果是相同的。
Anyway now I'm at loss.
请告诉我有用的信息来解决它。
Thanks,
Diogenes.
嗨对话框,
我必须更多地添加有关当前情况的更多信息。
I noticed on debugging that mu program doesn't enter into if(arch_ble_ext_wakeup_get()) clause though I set EXT_SLEEP in user_config.h, user_app_adv_start() and user_app_connection() like folllowings.
// const static sleep_state_t app_default_sleep_mode = arch_deep_sleep_on;
const static sleep_state_t app_default_sleep_mode = arch_ext_sleep_on;
// ARCH_SET_DEEP_SLEEP();
ARCH_SET_EXTEDDE_SLEEP();
所以我评论了(Arch_ble_ext_wakeup_get()),但没有发生UART接收中断。
// if(arch_ble_ext_wakeup_get())
{
ARCH_SET_SLEEP_MODE(app_default_sleep_mode);
arch_ble_force_wakeup();
ARCH_BLE_EXT_WAKEUP_OFF();
app_easy_wakeup();
}
And next I inserted forcibly arch_force_active_mode() just after arch_ble_force_wakeup().
然后UART接收中断发生,但我怀疑如果程序真的进入睡眠模式。
At least on debug, the program enters into arch_goto_sleep(sleep_mode).
Could I think Extended Sleep is really entered even I inserted arch_force_active_mode() just after arch_ble_force_wakeup()?
请告诉我更多信息。
Thanks,
Diogenes.
嗨Diogenes,
If you configure the APP_ADV_DATA_UPDATE_TO as 1msec, this means that the device will advertise only from 1msec, which is too short advertising time. After the expiration of 1msec, the device will go to permanent sleep mode and the only way to wake it up is from the wake up controller, as the implementation of the push button in ble_app_sleep_mode example that you are working on. After this time, all the peripherals modules will be powered of (including the UART peripheral module), so you will not able to receive any UART interrupt. Still, I am not able to understand what you are trying to accomplish with UART. Would you like to wake the DA14580 up by receiving data from UART? Can you please change the APP_ADV_DATA_UPDATE_TO to a longer duration of time and try to run your project without enabling the sleep mode?
Regarding you second post, this assertion probably means that the LP_Hanlder takes too much time to execute and the warning that you get means that it took more time for the BLE core to wake up that the calculated value. Please check a previous thread:
https://support.dialog-semiconductor.com/forums/post/dialog-smartbond-bluetooth-low-energy-%E2%80%93-software/some-porblem-sleep-mode
我想通知您,如果您发现上述任何答案有用,请将其中一个标记为已接受。
谢谢,PM_DIALOG.
嗨对话框,
Thank you for your reply.
>您想通过从UART接收数据来唤醒DA14580吗?
正如我已经解释了两倍的“否”,我只需要在Wakeup Int唤醒后接收中断。
> If you configure the APP_ADV_DATA_UPDATE_TO as 1msec
I think it's impossible to configure the APP_ADV_DATA_UPDATE_TO as 1msec, since the minimum quantum of APP_ADV_DATA_UPDATE_TO is 10msec.
我使用app_adv_data_update_to运行1(10msec间隔)和1000(10sec),但结果是相同的。
With both value UART receive interrupt after wake-up works normally.
我可以询问您是否有关它,将App_add_data_update_to配置为1(10磁形间隔)太短?
我再次问我在前一篇文章中写道的问题。
I repeat that I commented out if(arch_ble_ext_wakeup_get()) and inserted arch_force_active_mode() just after arch_ble_force_wakeup().
Could I think Extended Sleep is really entered even I inserted arch_force_active_mode() just after arch_ble_force_wakeup()?
// if(arch_ble_ext_wakeup_get())
{
ARCH_SET_SLEEP_MODE(app_default_sleep_mode);
arch_ble_force_wakeup();
ARCH_BLE_EXT_WAKEUP_OFF();
app_easy_wakeup();
}
这只是我想在上一篇文章中提出的问题。
Thanks,
Diogenes.
嗨Diogenes,
所以你的意思是,“我只需要UART在Wakeup int唤醒后接受中断”?如果您有数据要么发送或接收,您将收到中断。对不起,但我无法理解你试图与UART完成的事情。如果将App_add_data_update_to配置为1(10msec),则UART将仅适用于10毫秒。ARCH_BLE_EXT_WAKEUP_GET()函数检查BLE核心是否处于永久睡眠模式。让我试着更好地解释BLE_APP_SLEEP模式示例的更好。该设备将在广告或连接间隔之间输入睡眠模式。但是,在该示例中,存在进入永久睡眠的实现,并且只能从唤醒控制器唤醒设备。即使我在Arch_ble_Force_WakeUp()之后,睡眠模式也是如此插入Arch_Force_Active_Mode()。请检查user_app_adv_start()函数,您将看到计时器的到期后(app_add_data_update_to)触发adv_data_update_timer_cb()。 This function calls the app_easy_gap_advertise_stop() which send a GAPM_CANCEL_CMD message by executing the app_gapm_cancel_msg_create(). The response of the GAPM_CANCEL_CMD, is a GAPM_CMP_EVT, so the gapm_cmp_evt_handler() will be triggered from the app_task.c. If you check this function, in case of undirected connectable advertising that the example uses, app_on_adv_undirect_complete callback function will be triggered. Please check the .app_on_adv_undirect_complete callback from the user_callback_config.h header file and you will see that the user_app_adv_undirect_complete() is registered. This means that after the expiration of the timer the user_app_adv_undirect_complete() will be executed and it calls the arch_ble_ext_wakeup_on() which puts the BLE core to permanent sleep. Only an external event can wake it up.
谢谢,PM_DIALOG.