嗨对话框
There are some problem that I was use the DSPS 3.150.2 device project to Data transmission.The da4580_config.h was set to :
#define cfg_ext_sleep.
#undef cfg_deep_sleep.
but ,when I was Connection with my peer divce ,it also Into sleep mode and Data transmission will be lost,so I want to know How to set a GPIO wake-up To ensure that the DA did not enter sleep .I was set by According 《AN-B-026 DA14580 External wake-up mechanisms》 to configure:
#define EXTERNAL_WAKEUP 1
......
ext_wakeup_enable(uart1_ctsn_gpio_port,uart1_ctsn_gpio_pin,1);
......
is that any Other settings I have modified to wake The DA up by GPIO.
TKS
关键词:
设备:
Hi Lane,
为了检查您如何启用外部唤醒机制以及如何注册回调功能,请查看App_button_press_cb()函数中的智能标记参考设计。另请参阅10.7唤醒定时器的文档UM-B-051。
谢谢mt_dialog.
嗨对话框,
已阅读文档UM-B-051中的10.7节,并将程序设置为它。但DA14580仍然在睡眠状态
That is my code before the DA go to sleep:
app_set_extended_sleep();
app_ble_ext_wakeup_on();
ext_wakeup_enable(uart1_cts_port,uart1_cts_pin,1);
scb-> scr | = 1 << 2;//在系统控制寄存器中启用睡眠模式位(SCR [2] = SleepDeep)
SetBits16(Sys_ctrl_reg,pad_latch_en,1);//激活焊盘锁存器
SetBits16(PMU_CTRL_REG, RADIO_SLEEP, 1); // turn off radio
SetBits16(PMU_CTRL_REG, PERIPH_SLEEP, 0); // turn off peripheral power domain
setbits16(sys_ctrl_reg,ret_sysram,1);//关闭系统RAM =>所有数据都将丢失
函数“ext_wakeup_enable()”:
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
RESERVE_GPIO( EXT_WAKEUP_GPIO, (GPIO_PORT) port, (GPIO_PIN) pin, PID_GPIO );
if(极性== 0)//高电平
GPIO_ConfigurePin((GPIO_PORT) port, (GPIO_PIN) pin, INPUT_PULLUP, PID_GPIO, false ); // active low. Set default to input high.
否则//主动高
GPIO_ConfigurePin ((GPIO_PORT)端口(GPIO_PIN)πn, INPUT_PULLDOWN, PID_GPIO, false ); // active high. Set default to input low.
wkupct_register_callback(ext_wakeup_cb);
wkupct_enable_irq(1 <
Hi Lane,
Please follow the example in the Smart Tag reference design in order to wake up, check the app_button_press_cb() function (wakes up the da from a button). You can check if the configuration is ok by using a button to wake it up and then implement the CTS wake up.
谢谢mt_dialog.
非常感谢你,我发现了问题,它已经解决了.AS跟随:
in function “wkupct_enable_irq()” is say that:@param[in] sel_pins Select enabled inputs. Bits 0-7 -> port 0(P00..P07), Bits 8-13 -> port 1(P10..P15), Bits 14-15 -> port 2(P28,P29), Bits -> 16-23 port 2(P00..P07), Bits 24-31 -> port 3(P30..P37). 0-disabled, 1-enabled.
我使用p2_3端口唤醒,但在函数“ext_wakeup_enable()”中,行为wkupct_enable_irq(1 <
Thanks Lane and MT_dialog,
I just met the same problem. Lane should be right. Following function in the SDK 5.0.3 (and also SDK 3.x.x) seems to have a problem...
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.
否则//主动高
GPIO_ConfigurePin ((GPIO_PORT)端口(GPIO_PIN)πn, INPUT_PULLDOWN, PID_GPIO, false ); // active high. Set default to input low.
wkupct_register_callback(ext_wakeup_cb);
wkupct_enable_irq(1 << PIN,(UINT32_T)(极性== 0)?(1 << PIN):( 0),1,0);// PIN,有效低/高,1个事件,DEBOUNCING TIME = 0ms
}
如果我们称之为:
ext_wakeup_enable(gpio_port_2,gpio_pin_3,0)
此方法呼叫wkupct_enable_irq()function with错误的参数到底。
wkupct_enable_irq()函数需要以下参数:
/ **
****************************************************************************************
*@brief Enable Wakeup IRQ.
*
* @param [in] sel_pins选择已启用的输入。位0-7 - >端口0(端口00..p07),位8-13 - >端口1(p10..p15),位14-15 - >端口2(p28,p29),位 - > 16-23端口2(端口00..p07),位24-31 - >端口3(P30..p37)。0禁用,1启用。
*@param[in] pol_pins Inputs' polarity. Bits 0-7 -> port 0(Port 00..P07), Bits 8-13 -> port 1(P10..P15), Bits 14-15 -> port 2(P28,P29), Bits -> 16-23 port 2(Port 00..P07), Bits 24-31 -> port 3(P30..P37). 0-high, 1-low.
* @param [in] event_num唤醒中断前的事件数。最多255。
*@param[in] deb_time Debouncing time. Max 0x3F.
*
*@return void
****************************************************************************************
*/
void wkupct_enable_irq(uint32_t sel_pins,uint32_t pol_pins,uint16_t events_num,uint16_t deb_time)
如果有良好的解决方案来解决这个问题,请告诉我。
感谢您提前支持。
此致,
光盘
嗨CD,
ext_wakeup_enable是一个应该只使用完整的嵌入式设计时使用的函数,但这种实现不是由于您尝试使用它的原因。对于使用唤醒控制器,请使用唤醒驱动程序的API实现。您可以在参考设计中找到类似于ext_wakeup_enable的实现的示例。
谢谢mt_dialog.
嗨mt_dialog,
感谢您的快速回复。
对不起,我变得困惑......请让我确认那里的东西....
1.我的环境:我想使用DA14583作为完整的嵌入式设计。
你的评论是:
Can I use ext_wakeup_enable() function for the full embedded design system? Or do you want to mean ext_wakeup_enable() function should be used with "external processor running host application"?
在源代码中,有一些关于这些东西的评论,但它真的很困惑......
- da1458x_config_advanced.h -
线
64 / *************************************************** /
65 / *唤醒外部处理器运行主机应用程序。*/
66 /***************************************************/
67 #undef CFG_EXTERNAL_WAKEUP
- arch.h -
线
210 #if defined(CFG_EXTERNAL_WAKEUP)
211 #define external_wakeup 1
212 #else.
213 #define external_wakeup 0
214 #ENDIF.
.....
388 #if ((EXTERNAL_WAKEUP) && (!BLE_APP_PRESENT)) // external wake up, only in全嵌入式设计
389 void ext_wakeup_enable(uint32_t端口,uint32_t引脚,uint8_t极性);
390 void ext_wakeup_disable(void);
391 void ext_wakeup_cb(void);
392 #endif
- arch_main.c -
static inline void arch_goto_sleep (sleep_mode_t current_sleep_mode)
{
sleep_mode_t sleep_mode = current_sleep_mode;
ble_turn_radio_off();
//关闭收音机并检查我们是否可以深入睡眠
sleep_mode = ble_validate_sleep_mode(sleep_mode);
//授予对申请的访问检查我们是否可以睡觉
app_sleep_prepare_proc(&sleep_mode);// SDK的均匀性改进此一个应该改变这个?
//根据当前睡眠模式关闭外设
arch_turn_peripherals_off(sleep_mode);
#if(use_power_optimizations)
fine_hit = false;
#endif
//睡觉前的应用程序特定任务
app_sleep_entry_proc(sleep_mode);
#if((hyperent_wakeup)&&(!ble_app_present))//外部唤醒,只有外部处理器设计
ext_wakeup_enable(gpio_port_2,gpio_pin_2,0);
#endif
//做最后一个房子保持钟表并睡觉
ARCH_SWITCH_CLOCK_GOTO_SLEEP(Sleep_Mode);
}
- ARCH_SYSTEM.C -
#if ((EXTERNAL_WAKEUP) && (!BLE_APP_PRESENT)) // only in全嵌入式设计
/ **
****************************************************************************************
* @brief启用外部唤醒GPIO中断。
* @param [in] gpio_port。外部唤醒信号的GPIO端口
*@param[in] GPIO_PIN. The GPIO pin of the external wake up signal
* @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 );
if(极性== 0)//高电平
GPIO_ConfigurePin((GPIO_PORT) port, (GPIO_PIN) pin, INPUT_PULLUP, PID_GPIO, false ); // active low. Set default to input high.
否则//主动高
GPIO_ConfigurePin ((GPIO_PORT)端口(GPIO_PIN)πn, INPUT_PULLDOWN, PID_GPIO, false ); // active high. Set default to input low.
wkupct_register_callback(ext_wakeup_cb);
wkupct_enable_irq(1 << PIN,(UINT32_T)(极性== 0)?(1 << PIN):( 0),1,0);// PIN,有效低/高,1个事件,DEBOUNCING TIME = 0ms
}
As I listed up above, there are same #if statements "#if ((EXTERNAL_WAKEUP) && (!BLE_APP_PRESENT))", but the comments for those are mixed with full embedded and external processor per a file or a function.
如果我使用DA1458x作为一个完整的嵌入式设计,我应该代码如下,是对吗???:
#undef.CFG_EXTERNAL_WAKEUP
Arch_goto_sleep()ext_wakeup_enable()在完整的嵌入式设计系统时未调用,不是吗?!是我的理解吗?!?
因此,如上所述,我们必须使用唤醒控制器来唤醒全嵌入式设计系统。我相信醒来的代码将是如下所示:
1st:在系统唤醒时注册回调函数:使用wkupct_register_callback()
2nd:启用IRQ for WakeUp:WKUPCT_ENABLE_IRQ(0x40000,0x40000,1,0);// i.e.p2_2,p2_2的高电平为低电平,1个事件,debouncing time = 0ms
当我编写上面时,我的系统似乎醒来。(让我查看关于GPIO唤醒的对话框的一些示例项目。)
3. Even though ext_wakeup_enable() is desinged for only full embedded (or external processor host?) design, ext_wakeup_enable() function in arch_system.c seems wrong, as Lane mentioned too, I think.
ext_wakeup_enable() function needs 3 parameters, wakeup GPIO port, pin and polarity. So, if users want to wake up P2_2 with low active event, user call this like: ext_wakeup_enable(GPIO_PORT_2, GPIO_PIN_2, 0).
On the other hand, in ext_wakeup_enable() function, port information(i.e. GPIO_PORT_2) is completely lost. wkupct_enable_irq() function required bit expression to select port and pin including port information. Current code of ext_wakeup_enable() can a handle the signal change on only PORT_0. (In other words, ext_wakeup_enable(GPIO_PORT_2, GPIO_PIN_2, 0) will be modified to GPIO_PORT_0, GPIO_PIN_2 with low active event in ext_wakeup_enable() function.
抱歉我的长期回复,但如果您能提供任何意见,那就非常感谢。
Thanks for your great support.
此致,
光盘
嗨CD,
Just some clarifications fully mbeded -> Application runs on external MCU, fully hosted -> application runs on DA
我没有意识到您使用完全嵌入的设计(从外部主机运行),因为您是,那么是的,您可以使用该函数。这是代码假定您只能从端口0中使用引脚。此部分必须更正,并将在将来的SDK版本中。如果您要使用完全嵌入的设计,并且您将应用程序从外部主机运行,并且希望您的设备从外部MCU唤醒,那么您必须配置外部唤醒。ext_wakeup_enable()用于完全嵌入式设计(因为应用程序应从外部Proccessor唤醒)。如果您的设计完全托管,那么您应该使用您提到的代码。
谢谢mt_dialog.
Hi MT,
Thank you very much for your comments.
Yes, you are right. I had mixed up "full embedded" with "fully hosted". I'm so sorry about this...
如您所提到的,我们希望使用DA1458x作为“完全托管”的设计(使用DA作为集成处理器)。
所以我必须像下面的代码一样,是对吗?
#undef.CFG_EXTERNAL_WAKEUP
系统唤醒时注册回调函数:使用wkupct_register_callback()
Enable IRQ for wakeup:wkupct_enable_irq(0x40000, 0x40000, 1, 0); // i.e. P2_2, active low for P2_2, 1 event, debouncing time = 0ms
再次感谢,
光盘
嗨CD,
Yes, thats right, register your callback (wkupct_register_callback(your function)) and enable the pins and the polarity to the appropriate pin (wkupct_enable_irq()).
谢谢mt_dialog.
Hi MT,
Thank you very much for your confirmation.
Now, it's clear!!
非常感谢,
光盘