你好,
我正在使用完整托管模式的DSP。
我应该将GPIO唤醒功能添加到DSP中。
I found the DSPS codes already implemented the external wakeup functionality something like following codes in arch_system.c,.. etc.
#if((external_wakeup)&&(!ble_app_present))//只有完整的嵌入式设计
/**
****************************************************************************************
*@brief Enable external wake up GPIO Interrupt.
* @param [in] gpio_port。外部唤醒信号的GPIO端口
* @param [in] gpio_pin。外部唤醒信号的GPIO引脚
* @param [in]极性。外部唤醒中断的极性。0 =电源低。1 =活跃高
* @return void。
****************************************************************************************
*/
void ext_wakeup_enable(uint32_t端口,uint32_t pin,uint8_t极性)
{
rwip_env.ext_wakeup_enable = 2;
#if DEVELOPMENT_DEBUG
RESERVE_GPIO( EXT_WAKEUP_GPIO, (GPIO_PORT) port, (GPIO_PIN) pin, PID_GPIO );
#endif
if(极性== 0)//高电平
GPIO_ConfigurePin((GPIO_PORT) port, (GPIO_PIN) pin, INPUT_PULLUP, PID_GPIO, false ); // active low. Set default to input high.
else // active high
gpio_configurepin((gpio_port)端口,(gpio_pin)引脚,input_pulldown,pid_gpio,false);//主动高。将默认值设置为低电平。wkupct_register_callback(ext_wakeup_cb);
wkupct_enable_irq(1 <
问题。
1. DSP中的上述GPIO唤醒功能仅适用于全嵌入式设计?
2. In my case, I'm using the DSPS in full hosted mode(i.e !BLE_APP_PRESENT equals 0).
Can I achieve the gpio wakeup, if I just change the all of the#if ((EXTERNAL_WAKEUP) && (!BLE_APP_PRESENT))
至#if(外部_wakeup)
。
OR
3. Sholuld I implement the another approach something likehttp://support.dialog-semiconductor.com/how-can-i-handle-external-interr...。?
嗨Igotit,
The specific function is defined only in fully embedded systems but the wakeup procedure from an external interrupt is the same....you must configure your pins, register your callback and enable the irq.
谢谢mt_dialog.
Dear Dialog,
我已将我的系统配置为延长的睡眠模式准备好,似乎可以进入扩展的睡眠模式。但是,我发现系统无法根据我配置为强制唤醒的外部GPIO。我改变了什么是基于SDK5和“BLE_APP_BAREBONE”的项目
I have changed my main function. added with app_init_func()in the sleeping part
我还添加了我还在user_barebone.c文件中添加了这三个函数。
int main_func(void)
{
//
sleep_mode_t sleep_mode;
//全球初始化
system_init();
spi_lis3dh_peripherall_init();
#if debug_log.
// 2015-1-8
printf_string(“device_init done \ r \ n”);
#endif
// added block below
#if(USE_WDOG)
setword16(WatchDog_reg,0xC8);// 200 * 10.24ms =〜2sec活跃时间!
setword16(WatchDog_Ctrl_reg,0);//当计数器到达0时生成NMI,并且在达到-16时重置WDOG(SYS)!
// WDOG可以通过SW冻结!
SetWord16(RESET_FREEZE_REG, FRZ_WDOG); // Start WDOG
#else
setword16(set_freeeze_reg,frz_wdog);
#endif
#if(USE_WDOG)
setword16(WatchDog_reg,0xC8);// 200 * 10.24ms初始化的活动时间!
SetWord16(RESET_FREEZE_REG, FRZ_WDOG); // Start WDOG
#endif
while(1)
{
做 {
//安排所有待处理的事件
schedule_hile_ble_on();
}
而((app_asynch_proc())));//授予控件到应用程序,尝试掉电
//如果应用程序返回goto_sleep
//((streeData_queue)&& stree_queue_more_data()));//授予对拖缆的控制,尝试向下掉电
//如果应用程序返回goto_sleep
//wait for interrupt and go to sleep if this is allowed
if(((!ble_app_present)&&(check_gtl_state()))||
(ble_app_present))
{
//禁用中断
global_int_stop();
app_asynch_sleep_proc();
GPIO_SetInactive(LEDRED_PORT, LEDGREEN_PIN);
gpio_setinactive(LEDGREEN_PORT,LEDGREEN_PIN);
sleep_mode = rwip_power_down();
if ((sleep_mode == mode_ext_sleep) || (sleep_mode == mode_deep_sleep))
{
// 0208
app_init_func();
#if debug_log.
printf_string(“mode_ext_sleep \ r \ n”);
#endif
//power down the radio and whatever is allowed
Arch_Goto_Sleep(Sleep_Mode);
//wait for an interrupt to resume operation
WFI();
//resume operation
ARCH_RESUME_FROM_SLEEP();
}
否则if(sleep_mode == mode_idle)
{
#if debug_log.
printf_string(“空闲模式\ r \ n”);
#endif
if((!ble_app_present)&& check_gtl_state())||
(ble_app_present))
//wait for an interrupt to resume operation
WFI();
}
//恢复中断
GLOBAL_INT_START();
}
// added block below
#if(USE_WDOG)
setword16(WatchDog_reg,0xC8);// Reset WDOG! 200 * 10.24ms active time for normal mode!
#endif
}
}
void app_button_press_cb(void)
{
if(getBits16(sys_stat_reg,per_is_down))
periph_init();
#if ble_prox_reporter.
if (alert_state.lvl != PROXR_ALERT_NONE)
{
app_proxr_alert_stop();
}
#endif // BLE_PROX_REPORTER
#if ble_findme_locator
if(ke_state_get(task_findl)== findl_connected)
{
app_findl_set_alert();
}
#endif
/* Button is pressed, start 3sec gurd timer to detect button long press
**并恢复按钮GPIO上的极性以检测释放
*/
wkupct_register_callback(app_button_release_cb);
wkupct_enable_irq(0x001,0x001,1,0x14);// p1_1,极性低,1个事件,脱嘴时间= 20ms
app_button_status = 1;
#if debug_log.
printf_string(“\ r \ nbutton按”);
uart2_init(UART_BAUDRATE_115K2, 3);
#endif
if(ke_state_get(task_app)== app_connectable)
{
只有我们在广告模式中才能唤醒唤醒。仅在ADV模式中,用户可以清除绑定数据。
app_ble_force_wakeup();
app_ble_ext_wakeup_off();
gpio_setactive(LEDID_PORT,LEDGREEN_PIN);
// Send message to TASK_APP. We should set the timer APP_BUTTON_PRESS_TIMER when BLE is awake
//ke_msg_send_basic(APP_WAKEUP_MSG, TASK_APP, NULL);
app_easy_wakeup();
}
/ ** /
}
void app_button_release_cb(void)
{
if(getBits16(sys_stat_reg,per_is_down))
periph_init();
//按钮发布,停止App_Button_Press_Timer Gurd Timer
//and revert polarity on the button GPIO to detect the button press
wkupct_register_callback(app_button_press_cb);
wkupct_enable_irq(0x001, 0x000, 1, 0x14); // P0_0, polarity high, 1 event, debouncing time = 20ms
app_button_status = 0;
#if debug_log.
printf_string("\r\nButton release");
uart2_init(UART_BAUDRATE_115K2, 3);
#endif
if(ke_state_get(task_app)== app_connectable)
{
只有我们在广告模式中才能唤醒唤醒。仅在ADV模式中,用户可以清除绑定数据。
app_ble_force_wakeup();
app_ble_ext_wakeup_off();
gpio_setactive(LEDID_PORT,LEDGREEN_PIN);
//向Task_App发送消息。我们应该清除Timer App_Button_Press_Timer时醒来时
//ke_msg_send_basic(APP_WAKEUP_MSG, TASK_APP, NULL);
app_easy_wakeup();
}
}
void app_init_func(void)
{
#ifdef cfg_external_wakeup.
// Set button wake up interupt
wkupct_register_callback(app_button_press_cb);
wkupct_enable_irq(0x200,0x000,1,0x14);// p1_1,极性高,1个事件,脱嘴时间= 20ms
#endif //WKUP_ENABLED
}
嗨Liuluan002,
Can you please clarify what you are trying to do ? A press and release button scheme is implemented in the smart Tag reference design, can you please have a look at that reference design and check if that suits you.
谢谢mt_dialog.
我想要做的是尝试将我的传感器链接在Dice LIS3DH中作为FIFO模式,中断可能会从中断到唤醒模式从睡眠模式读取数据。我也试图为14580创建一个按钮唤醒并完成任务。我正在尝试在SDK5上这样做,但是你的智能标签示例是在SDK3中,它也有很多消息让我处理,并不容易合并到我的应用程序中。能否请你帮忙?
嗨Liuluan002,
The Smart Tag although it is on SDK3 all you need is the button press/release implementation, just check the app_button_press_cb and app_button_release_cb the wakeup interrupt is enabled in the app_init_func() when the button is pressed the wakeup interrupt is reinitialized to trigger in the opposite polarity (trigger when the button gets unpressed) and the button status is stored in a variable (app_button_status). Besides that a timer is initiated to poll the status of the button (after 3seconds erases the data in the flash). The functions used are almost the same with the SDK5.
此外,您还可以查看您的其他帖子,以触发外部中断,而580处于睡眠模式。
http://support.dialog-semiconductor.com/external-proximity-reporter-app-...
谢谢mt_dialog.
thank you now it works