嗨对话框
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
Keywords:
设备:
Hi Lane,
为了检查您如何启用外部唤醒机制以及如何注册回调功能,请查看App_button_press_cb()函数中的智能标记参考设计。另请参阅10.7唤醒定时器的文档UM-B-051。
谢谢mt_dialog.
嗨对话框,
have read the section 10.7 in document UM-B-051, and setup the program as it. But DA14580 still in sleep
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; // enable sleepdeep mode bit in System Control Register (SCR[2]=SLEEPDEEP)
SetBits16(SYS_CTRL_REG, PAD_LATCH_EN, 1); // activate PAD latches
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 =>所有数据都将丢失
the function "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.
else // active 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.
else // active 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 <}
如果我们称之为:
ext_wakeup_enable(gpio_port_2,gpio_pin_3,0)
此方法呼叫wkupct_enable_irq()function with错误的参数到底。
wkupct_enable_irq()function needs following parameters:
/**
****************************************************************************************
*@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)
如果有良好的解决方案来解决这个问题,请告诉我。
Thanks for your support in advance.
Best regards,
光盘
嗨CD,
ext_wakeup_enable是一个应该只使用完整的嵌入式设计时使用的函数,但这种实现不是由于您尝试使用它的原因。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.
谢谢mt_dialog.
嗨mt_dialog,
感谢您的快速回复。
对不起,我变得困惑......请让我确认那里的东西....
1. My environment: I would like to use DA14583 as the FULL EMBEDDED design.
你的评论是:
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"?
In source code, there are some comments about these things, but it's really confusing to me...
- da1458x_config_advanced.h -
LINE
64 / *************************************************** /
65 / *唤醒外部处理器运行主机应用程序。*/
66 /***************************************************/
67 #undef CFG_EXTERNAL_WAKEUP
- arch.h -
LINE
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 infull embedded设计
389 void ext_wakeup_enable(uint32_t port, uint32_t pin, uint8_t polarity);
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
// hook for app specific tasks just before sleeping
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 infull embedded设计}
/**
****************************************************************************************
*@brief Enable external wake up GPIO Interrupt.
* @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.
else // active 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 <
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
And ext_wakeup_enable() in arch_goto_sleep() function is NOT called when full embedded design system, isn't it?! Is my understanding right?!?
因此,如上所述,我们必须使用唤醒控制器来唤醒全嵌入式设计系统。我相信醒来的代码将是如下所示:
1st:在系统唤醒时注册回调函数:使用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.)
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.
Best regards,
光盘
嗨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
Register callback function when system wakes up:using 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
Thanks again,
光盘
嗨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!!
非常感谢,
光盘