DSP使用GPIO控制进入长时间睡眠和唤醒。

13 posts / 0 new
Last post
Lane
离线
Last seen:1 month 20 hours ago
加入:2015-07-14 14:21
DSP使用GPIO控制进入长时间睡眠和唤醒。

Hi Dialog

使用DSPS 3.150.2设备项目进行数据传输时出现了一些问题。da4580_config.h设置为:
#define CFG_EXT_SLEEP
#undef CFG_DEEP_SLEEP
但是,当我与我的对等设备连接时,它也进入睡眠模式,数据传输将丢失,所以我想知道如何设置GPIO唤醒以确保DA不进入睡眠。我是根据《AN-B-026 DA14580外部唤醒机制》来配置的:

#定义外部唤醒1
......
ext_wakeup_enable(UART1_CTSN_GPIO_PORT, UART1_CTSN_GPIO_PIN, 1);
......
这是我修改的任何其他设置,以通过GPIO唤醒DA。

TKS

Device:
MT_dialog
离线
Last seen:2 months 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:1 month 20 hours ago
加入:2015-07-14 14:21
嗨,对话,

嗨,对话,
have read the section 10.7 in document UM-B-051, and setup the program as it. But DA14580 still in sleep
这是检察官睡觉前我的密码:
app_set_extended_sleep();
app_ble_ext_wakeup_on();
ext_wakeup_enable(UART1_CTS_PORT, UART1_CTS_PIN, 1);
SCB->SCR |= 1<<2; // enable sleepdeep mode bit in System Control Register (SCR[2]=SLEEPDEEP)
SetBits16(SYS_CTRL_REG, PAD_LATCH_EN, 1); // activate PAD latches
SetBits16(PMU\u CTRL\u REG,RADIO\u SLEEP,1);//关掉收音机
SetBits16(PMU\u CTRL\u REG,PERIPH\u SLEEP,0);//关闭外围电源域
SetBits16(SYS_CTRL_REG, RET_SYSRAM, 1); // turn System RAM off => all data will lost
the function "ext_wakeup_enable()":
void ext_wakeup_enable(uint32_t port, uint32_t pin, uint8_t polarity)
{
rwip_env.ext_wakeup_enable=2;
#如果开发\u调试
保留\u GPIO(EXT \u WAKEUP \u GPIO,(GPIO \u PORT)PORT,(GPIO \u PIN)PIN,PID \u GPIO);
#结束
保留\u GPIO(EXT \u WAKEUP \u GPIO,(GPIO \u PORT)PORT,(GPIO \u PIN)PIN,PID \u GPIO);
if ( polarity == 0 ) // active low
GPIO_ConfigurePin((GPIO_PORT)PORT,(GPIO_PIN)PIN,INPUT_PULLUP,PID_GPIO,false);//低电平有效。将默认设置为“输入高”。
else // active high
GPIO_ConfigurePin((GPIO_PORT)PORT,(GPIO_PIN)PIN,INPUT_PULLDOWN,PID_GPIO,false);//高活性。将默认设置为输入低。

wkupct_register_callback(ext_wakeup_cb);

wkupct_enable_irq(1<

Lane
离线
Last seen:1 month 20 hours ago
加入:2015-07-14 14:21
(No subject)
MT_dialog
离线
Last seen:2 months 3 weeks ago
Staff
加入:2015-06-08 11:34
嗨,莱恩,

嗨,莱恩,

请遵循智能标记参考设计中的示例,为了唤醒,请检查app\u button\u press\u cb()函数(从按钮唤醒da)。您可以通过使用一个按钮来唤醒配置,然后实现CTS唤醒来检查配置是否正常。

Thanks MT_dialog

Lane
离线
Last seen:1 month 20 hours ago
加入:2015-07-14 14:21
比k you very much,I have

比k you very much,I have found problem,It has been resolved .as follow :
在函数“wkupct\u enable\u irq()”中说:@param[in]sel\u pins Select enabled inputs。位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 10 months ago
加入:2015-11-18 02:51
谢谢你和莱恩先生的对话,

谢谢你和莱恩先生的对话,

我也遇到了同样的问题。莱恩应该在右边。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;
#如果开发\u调试
保留\u GPIO(EXT \u WAKEUP \u GPIO,(GPIO \u PORT)PORT,(GPIO \u PIN)PIN,PID \u GPIO);
#结束
if ( polarity == 0 ) // active low
GPIO_ConfigurePin((GPIO_PORT)PORT,(GPIO_PIN)PIN,INPUT_PULLUP,PID_GPIO,false);//低电平有效。将默认设置为“输入高”。
else // active high
GPIO_ConfigurePin((GPIO_PORT)PORT,(GPIO_PIN)PIN,INPUT_PULLDOWN,PID_GPIO,false);//高活性。将默认设置为输入低。

wkupct_register_callback(ext_wakeup_cb);

wkupct_enable_irq(1<}

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() function needs following parameters:

/**
****************************************************************************************
*@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\u 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]去抖动时间去抖动时间。最大0x3F。
*
*@返回无效
****************************************************************************************
*/
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.

Thanks for your support in advance.

Best regards,
CD

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

Hi CD,

The ext_wakeup_enable is a function that should be used only with full embedded designs, this implementation isn't for the reason you are trying to use it. For using the wake up controller please use the API implementation of the wakeup driver. You can find examples in the reference designs which is similar to the implementation of the ext_wakeup_enable.

Thanks MT_dialog

CD
离线
Last seen:3 years 10 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. My environment: I would like to use DA14583 as the FULL EMBEDDED design.
2. Your comment is:

The ext_wakeup_enable is a function that should be used only with full embedded designs, this implementation isn't for the reason you are trying to use it.

我可以为完整的嵌入式设计系统使用ext\u wakeup\u enable()函数吗?或者您想让ext\u wakeup\u enable()函数与“运行主机应用程序的外部处理器”一起使用吗?
In source code, there are some comments about these things, but it's really confusing to me...

- da1458x_config_advanced.h -
LINE
64 /***************************************************/
65 /* Wakeup fromexternal processor running host application.*/
66 /***************************************************/
67#未定义CFGŠ外部Š唤醒

- arch.h -
LINE
210#如果定义(CFG#外部#唤醒)
211 #define EXTERNAL_WAKEUP 1
212 #else
213 #define EXTERNAL_WAKEUP 0
214 #endif
.....
388#如果((外部唤醒)&&(!BLE\u APP\u PRESENT))//外部唤醒,仅在full embeddeddesigns
389 void ext_wakeup_enable(uint32_t port, uint32_t pin, uint8_t polarity);
390 void ext_wakeup_disable(void);
391年空白ext_wakeup_cb(无效);
392#结束

- arch_main.c -
静态内联空拱门转到睡眠(睡眠\u模式\u t当前睡眠\u模式)
{
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
关闭外围设备(睡眠模式);
#如果(USE_POWER_OPTIMIZATIONS)
fine_hit = false;
#结束
// hook for app specific tasks just before sleeping
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 -
#如果((外部唤醒)&&(!BLE_APP_PRESENT))//仅在full embeddeddesigns
/**
****************************************************************************************
* @brief Enable external wake up GPIO Interrupt.
* @param[in] GPIO_PORT. The GPIO port of the external wake up signal
*@param[in]GPIO\u引脚。外部唤醒信号的GPIO引脚
* @param[in] polarity. The polarity of the external wake up interrupt. 0=active low. 1=active high
*@返回无效.
****************************************************************************************
*/
void ext_wakeup_enable(uint32_t port, uint32_t pin, uint8_t polarity)
{
rwip_env.ext_wakeup_enable=2;
if (DEVELOPMENT_DEBUG)
保留\u GPIO(EXT \u WAKEUP \u GPIO,(GPIO \u PORT)PORT,(GPIO \u PIN)PIN,PID \u GPIO);
if ( polarity == 0 ) // active low
GPIO_ConfigurePin((GPIO_PORT)PORT,(GPIO_PIN)PIN,INPUT_PULLUP,PID_GPIO,false);//低电平有效。将默认设置为“输入高”。
else // active high
GPIO_ConfigurePin((GPIO_PORT)PORT,(GPIO_PIN)PIN,INPUT_PULLDOWN,PID_GPIO,false);//高活性。将默认设置为输入低。
wkupct_register_callback(ext_wakeup_cb);
wkupct_enable_irq(1<}

正如我在上面列出的,有相同的#if语句“#if((EXTERNALŠu WAKEUP)&&(!BLE_APP_PRESENT)),但这些注释与每个文件或函数的完全嵌入式和外部处理器混合在一起。
If I used DA1458x as a full embedded design, I should code as followings, is it right??? :

#undefCFG\u外部唤醒

And ext_wakeup_enable() in arch_goto_sleep() function is NOT called when full embedded design system, isn't it?! Is my understanding right?!?
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: 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
My systems seems to wake up when I coded above. ( Let me check some sample projects from Dialog regarding GPIO wakeup.)

三。尽管ext\u wakeup\u enable()只设计用于完全嵌入式(或外部处理器主机?)设计,但我认为arch\u system.c中的ext\u wakeup\u enable()函数似乎是错误的,正如Lane提到的那样。
ext\u wakeup \u enable()函数需要3个参数,wakeup GPIO port、pin和polarity。因此,如果用户想唤醒P2泷2,激活事件较少,可以这样调用:ext泷wakeup泷enable(GPIO泷u PORT泷2,GPIO泷u PIN泷2,0)。
另一方面,在ext\ u wakeup\ u enable()函数中,端口信息(即GPIO\ u port\ u 2)完全丢失。wkupct \u enable \u irq()函数需要位表达式来选择端口和pin,包括端口信息。ext\u wakeup \u enable()的当前代码只能处理端口\u 0上的信号更改(换句话说,ext\u wakeup\u enable(GPIO\u PORT\u 2,GPIO\u PIN\u 2,0)将在ext\u wakeup\u enable()函数中被修改为GPIO\u PORT\u 0,GPIO\u PIN\u 2,低活动事件。

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

谢谢你的大力支持。

Best regards,
CD

MT_dialog
离线
Last seen:2 months 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 10 months ago
加入:2015-11-18 02:51
你好,先生,

你好,先生,

非常感谢您的评论。
是的,你说得对。我把“完全嵌入”和“完全托管”混为一谈。我很抱歉。。。

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\u外部唤醒
Register callback function when system wakes up: using wkupct_register_callback()
为唤醒启用IRQ:wkupct_enable_irq(0x40000,0x40000,1,0);//i、 e.P2琰2,P2琰2的低电平有效,1个事件,去抖动时间=0毫秒

Thanks again,
CD

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

Hi CD,

是的,没错,注册回调(wkupct\u register\u callback(your function))并将管脚和极性启用到相应的管脚(wkupct\u enable\u irq())。

Thanks MT_dialog

CD
离线
Last seen:3 years 10 months ago
加入:2015-11-18 02:51
你好,先生,

你好,先生,

非常感谢您的确认。
现在,一切都清楚了!!

Thanks a lot,
CD

Topic locked