DSP使用GPIO控制延长睡眠并唤醒。

13 posts / 0 new
Last post
Lane
离线
Last seen:6 days 17 hours ago
加入:2015-07-14 14:21
DSP使用GPIO控制延长睡眠并唤醒。

Hi Dialog

有一些问题是我使用DSP 3.150.2设备项目来数据传输。DA4580_CONFIG.H已设置为:
#define CFG_EXT_SLEEP
#undef cfg_deep_sleep.
但是,当我与我的同伴角度联系时,它也进入睡眠模式,数据传输将会丢失,所以我想知道如何设置一个gpio唤醒,以确保da没有进入睡眠。我被设置为“AN-B-026DA14580外部唤醒机制”根据配置:

#define external_wakeup 1
......
ext_wakeup_enable(uart1_ctsn_gpio_port,uart1_ctsn_gpio_pin,1);
......
是我修改的任何其他设置以由GPIO唤醒。

TKS

关键词:
Device:
MT_dialog
离线
Last seen:1 month 3 weeks ago
Staff
加入:2015-06-08 11:34
嗨巷,

嗨巷,

In order for you to check how to enable the external wakeup mechanism and how to register a callback function please have a look at the smart tag reference design in the app_button_press_cb() function. Also please have a look at the document UM-B-051 at section 10.7 Wakeup Timer.

Thanks MT_dialog

Lane
离线
Last seen:6 days 17 hours ago
加入:2015-07-14 14:21
嗨对话框,

嗨对话框,
已阅读文档UM-B-051中的10.7节,并将程序设置为它。但DA14580仍然在睡眠状态
这是我之前去睡觉之前的代码:
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);//关闭收音机
setBits16(PMU_CTRL_REG,PERIPH_SLEEP,0);//关闭外围电源域
SetBits16(SYS_CTRL_REG, RET_SYSRAM, 1); // turn System RAM off => all data will lost
函数“ext_wakeup_enable()”:
void ext_wakeup_enable(uint32_t port, uint32_t pin, uint8_t polarity)
{
rwip_env.ext_wakeup_enable = 2;
#if development_debug.
Letail_GPIO(ext_wakeup_gpio,(gpio_port)端口,(gpio_pin)pin,pid_gpio);
#万一
Letail_GPIO(ext_wakeup_gpio,(gpio_port)端口,(gpio_pin)pin,pid_gpio);
if ( polarity == 0 ) // active low
gpio_configurepin((gpio_port)端口,(gpio_pin)引脚,input_pullup,pid_gpio,false);//电源低。设置默认值以输入高。
否则//主动高
gpio_configurepin((gpio_port)端口,(gpio_pin)引脚,input_pulldown,pid_gpio,false);//主动高。将默认值设置为低电平。

wkupct_register_callback(ext_wakeup_cb);

wkupct_enable_irq(1<

Lane
离线
Last seen:6 days 17 hours ago
加入:2015-07-14 14:21
(No subject)
MT_dialog
离线
Last seen:1 month 3 weeks ago
Staff
加入:2015-06-08 11:34
嗨巷,

嗨巷,

请按照智能标记参考设计中的示例进行唤醒,检查App_button_press_cb()函数(从按钮唤醒da)。您可以通过使用按钮唤醒并唤醒CTS唤醒来检查配置是否正常。

Thanks MT_dialog

Lane
离线
Last seen:6 days 17 hours ago
加入:2015-07-14 14:21
非常感谢,我有

非常感谢,我有found problem,It has been resolved .as follow :
在功能中,“wkupct_enable_irq()”说:@param [in] sel_pins选择已启用的输入。位0-7 - >端口0(p00..p07),位8-13 - >端口1(p10..p15),位14-15 - >端口2(p28,p29),位 - > 16-23端口2(p00..p07),位24-31 - >端口3(p30..p37)。0禁用,1启用。
I use the P2_3 Port to wake up ,but in the function “ext_wakeup_enable()”,the line is wkupct_enable_irq(1<

CD
离线
Last seen:3 years 9 months ago
加入:2015-11-18 02:51
谢谢Lane和MT_Dialog,

谢谢Lane和MT_Dialog,

我刚遇到了同样的问题。车道应该是对的。在SDK 5.0.3中的函数遵循(也是SDK 3.x.x)似乎有问题......


void ext_wakeup_enable(uint32_t port, uint32_t pin, uint8_t polarity)
{
rwip_env.ext_wakeup_enable = 2;
#if development_debug.
Letail_GPIO(ext_wakeup_gpio,(gpio_port)端口,(gpio_pin)pin,pid_gpio);
#万一
if ( polarity == 0 ) // active low
gpio_configurepin((gpio_port)端口,(gpio_pin)引脚,input_pullup,pid_gpio,false);//电源低。设置默认值以输入高。
否则//主动高
gpio_configurepin((gpio_port)端口,(gpio_pin)引脚,input_pulldown,pid_gpio,false);//主动高。将默认值设置为低电平。

wkupct_register_callback(ext_wakeup_cb);

wkupct_enable_irq(1 << PIN,(UINT32_T)(极性== 0)?(1 << PIN):( 0),1,0);// PIN,有效低/高,1个事件,DEBOUNCING TIME = 0ms
}

If we call this function like:
ext_wakeup_enable( GPIO_PORT_2, GPIO_PIN_3, 0)
this method callswkupct_enable_irq()功能wrong parametersin the end.
wkupct_enable_irq()函数需要以下参数:

/ **
****************************************************************************************
* @brief启用唤醒IRQ。
*
* @param[in] sel_pins Select enabled inputs. 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-disabled, 1-enabled.
* @param [in] pol_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] events_num Number of events before wakeup interrupt. Max 255.
* @param [in] deb_time debouncing时间。最大0x3f。
*
* @return void.
****************************************************************************************
* /
void wkupct_enable_irq(uint32_t sel_pins, uint32_t pol_pins, uint16_t events_num, uint16_t deb_time)

If there are good solution to solve this, please let me know.

感谢您提前支持。

此致,
CD

MT_dialog
离线
Last seen:1 month 3 weeks ago
Staff
加入:2015-06-08 11:34
Hi CD,

Hi CD,

ext_wakeup_enable是一个应该只使用完整的嵌入式设计时使用的函数,但这种实现不是由于您尝试使用它的原因。对于使用唤醒控制器,请使用唤醒驱动程序的API实现。您可以在参考设计中找到类似于ext_wakeup_enable的实现的示例。

Thanks MT_dialog

CD
离线
Last seen:3 years 9 months ago
加入:2015-11-18 02:51
Hi MT_dialog,

Hi MT_dialog,

Thanks for your quick reply.

Sorry, I'm getting confused... Please let me confirm the things there....

1.我的环境:我想使用DA14583作为完整的嵌入式设计。
2. Your comment is:

ext_wakeup_enable是一个应该只使用完整的嵌入式设计时使用的函数,但这种实现不是由于您尝试使用它的原因。

我可以使用全嵌入式设计系统的ext_wakeup_enable()函数吗?或者您想要表示ext_wakeup_enable()函数应该与“运行主机应用程序的外部处理器”一起使用?
在源代码中,有一些关于这些东西的评论,但它真的很困惑......

- da1458x_config_advanced.h -
线
64 /***************************************************/
65 /* Wakeup fromexternal processor running host application.* /
66 / *************************************************** /
67 #undef cfg_external_wakeup.

- arch.h -
线
210 #f定义(CFG_EXTERNAL_WAKEUP)
211 #define EXTERNAL_WAKEUP 1
212 #else
213 #define EXTERNAL_WAKEUP 0
214 #endif
.....
388 #f((hyperent_wakeup)&&(!ble_app_present))//外部唤醒,只在全嵌入式designs
389 void ext_wakeup_enable(uint32_t端口,uint32_t引脚,uint8_t极性);
390 void ext_wakeup_disable(void);
391年空白ext_wakeup_cb(无效);
392 #ENDIF.

- arch_main.c -
静态内联void arch_goto_sleep(sleep_mode_t current_sleep_mode)
{
sleep_mode_t sleep_mode = current_sleep_mode;
ble_turn_radio_off();
//turn the radio off and check if we can go into deep sleep
sleep_mode = ble_validate_sleep_mode(sleep_mode);
// grant access to the application to check if we can go to sleep
app_sleep_prepare_proc(&sleep_mode); //SDK Improvements for uniformity this one should be changed?
//turn the peripherals off according to the current sleep mode
ARCH_TURN_PERITITALLE_OFF(Sleep_Mode);
#如果(USE_POWER_OPTIMIZATIONS)
fine_hit = false;
#万一
//睡觉前的应用程序特定任务
app_sleep_entry_proc(sleep_mode);
#if ((EXTERNAL_WAKEUP) && (!BLE_APP_PRESENT)) // external wake up, only inexternal processordesigns
ext_wakeup_enable(GPIO_PORT_2, GPIO_PIN_2, 0);
#万一
// do the last house keeping of the clocks and go to sleep
arch_switch_clock_goto_sleep (sleep_mode);
}

- ARCH_SYSTEM.C -
#if((hyperent_wakeup)&&(!ble_app_present))//只有全嵌入式designs
/ **
****************************************************************************************
* @brief启用外部唤醒GPIO中断。
* @param[in] GPIO_PORT. The GPIO port of the external wake up signal
* @param [in] gpio_pin。外部唤醒信号的GPIO引脚
* @param[in] polarity. The polarity of the external wake up interrupt. 0=active low. 1=active high
* @return void..
****************************************************************************************
* /
void ext_wakeup_enable(uint32_t port, uint32_t pin, uint8_t polarity)
{
rwip_env.ext_wakeup_enable = 2;
if (DEVELOPMENT_DEBUG)
Letail_GPIO(ext_wakeup_gpio,(gpio_port)端口,(gpio_pin)pin,pid_gpio);
if ( polarity == 0 ) // active low
gpio_configurepin((gpio_port)端口,(gpio_pin)引脚,input_pullup,pid_gpio,false);//电源低。设置默认值以输入高。
否则//主动高
gpio_configurepin((gpio_port)端口,(gpio_pin)引脚,input_pulldown,pid_gpio,false);//主动高。将默认值设置为低电平。
wkupct_register_callback(ext_wakeup_cb);
wkupct_enable_irq(1 << PIN,(UINT32_T)(极性== 0)?(1 << PIN):( 0),1,0);// PIN,有效低/高,1个事件,DEBOUNCING TIME = 0ms
}

正如我上面所列出的那样,有相同的#if语句“#if((hyperent_wakeup)&&(!ble_app_present))”,但是,每文件或函数都与全嵌入和外部处理器混合的注释。
If I used DA1458x as a full embedded design, I should code as followings, is it right??? :

#undefcfg_external_wakeup.

Arch_goto_sleep()ext_wakeup_enable()在完整的嵌入式设计系统时未调用,不是吗?!是我的理解吗?!?
So, as you mentioned, we have to use wake up controller to wake up on full embedded design system. I believe the code for waking up would be something like followings:
1st: Register callback function when system wakes up: using 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.即使ext_wakeup_enable()只是仅为完整的嵌入式(或外部处理器主机?)设计,exch_system.c的ext_wakeup_enable()函数似乎是错误的,因为我认为车道也是如此。
ext_wakeup_enable()函数需要3个参数,唤醒gpio端口,引脚和极性。因此,如果用户想要唤醒具有低活动事件的P2_2,则用户调用这样:ext_wakeup_enable(gpio_port_2,gpio_pin_2,0)。
另一方面,在ext_wakeup_enable()函数中,端口信息(即gpio_port_2)完全丢失。wkupct_enable_irq()函数需要位表达式,以选择端口和引脚,包括端口信息。ext_wakeup_enable()的当前代码可以仅处理Port_0的信号更改。(换句话说,ext_wakeup_enable(gpio_port_2,gpio_pin_2,0)将被修改为gpio_port_0,gpio_pin_2,在ext_wakeup_enable()函数中具有低活动事件。

Sorry for my long reply, but if you could provide any comments on this, it would be much appreciated.

谢谢你的支持。

此致,
CD

MT_dialog
离线
Last seen:1 month 3 weeks ago
Staff
加入:2015-06-08 11:34
Hi CD,

Hi CD,

只是一些澄清完全蒙上的澄清 - >应用程序在外部MCU上运行,完全托管 - >应用程序在DA上运行

I haven't realised that you were using a fully embedded design (running from an external host), since you are, then yes you can use the function. The thing is that the code assumes that you are going to use only pins from port 0. This part must be corrected, and will be in future SDK versions. If you are going to use a fully embedded design and you run your application from an external host and you want your device to wake up from an external MCU then you have to configure the external wake up. The ext_wakeup_enable() is used in full embedded designs (since the application should wake up from the external proccessor). If your design was fully hosted then you should use the code you are mentioning.

Thanks MT_dialog

CD
离线
Last seen:3 years 9 months ago
加入:2015-11-18 02:51
嗨MT,

嗨MT,

非常感谢您的意见。
是的,你是对的。我混淆了“完全托管”的“完全嵌入式”。我很抱歉......

As you mentioned, we would like to use DA1458x as "fully hosted" design (using DA as an integrated processor).

So I have to code like followings, is it right?

#undefcfg_external_wakeup.
系统唤醒时注册回调函数:使用wkupct_register_callback()
启用IRQ唤醒:WKUPCT_ENABLE_IRQ(0x40000,0x40000,1,0);// i.e.p2_2,p2_2的高电平为低电平,1个事件,debouncing time = 0ms

再次感谢,
CD

MT_dialog
离线
Last seen:1 month 3 weeks ago
Staff
加入:2015-06-08 11:34
Hi CD,

Hi CD,

是的,就是正确的,注册回调(Wkupct_register_callback(您的函数))并使引脚和极性为适当的PIN(WKUPCT_ENABLE_IRQ())。

Thanks MT_dialog

CD
离线
Last seen:3 years 9 months ago
加入:2015-11-18 02:51
嗨MT,

嗨MT,

非常感谢您的确认。
现在,很清楚!!

Thanks a lot,
CD

Topic locked