雷竞技电竞平台对话半导体客户支持- SDK1.0.8 https://support.dialog-seminile.com/resource-keywords/sdk108 延长睡眠vs. UART https://support.dialog-semicondiondiondiondiondum/forums/post/dialog-martbond-bluetooth-low-energy-%2%80%93-software/extended-sleep-vs-uart. < div class = "字段field-name-taxonomy-forums field-type-taxonomy-term-reference field-label-above”> < div class = "字段标签" >论坛:,< / div > < div class = "字段条目" > < div class =”field-item甚至“rel = " sioc: has_container " > < a href = " /论坛/ dialog-smartbond-bluetooth-low-energy - % E2 % 80% 93 -软件”“=“sioc:容器sioc:论坛”属性= " rdfs: label skos: prefLabel”数据类型= " " >对话框Smartbond蓝牙低能量-软件< / > < / div > < / div > < / div > < div class =”字段field-name-body field-type-text-with-summary field-label-hidden”> < div class = "字段条目" > < div class =”field-item甚至“财产=“内容:编码”> < p >亲爱的对话框中,< / p > < p >我想把我们的应用程序(DA14680-01, SDK 1.0.8.1050.1)扩展睡眠。为此,我采取了extended_sleep演示应用程序,并将其移植到我们的板(有LED上的LED垫,而不是gpio,所以我把他们放在TIMER2/PWM)。我们将使用UARTs,因此我尝试从vTimerCallback()打印UART2上的调试消息,并在peripher_init()中调用hw_uart_reinit()。(对于输出,我定义了CONFIG_CUSTOM_PRINT并写了一个_write()函数调用hw_uart_wrute_buffer();我也尝试使用ad_uart)。我还添加了pm_set_wakeup_mode(true)来等待XTAL16M解决。该板有外部32.768kHz和16MHz晶体。

然而,板的行为改变,取决于它是如何重置的。 If it was reset from JLink (by reboot_device.sh or by "monitor reset" from gdb), XTAL16M is running all the time (we checked with an oscilloscope), the LEDs stay on and UART output works.

But if it's reset either from firmware, or using the reset button, or by taking the battery out and putting it back in, XTAL16M stops and the LEDs go off during sleep; the LEDs still work when the board is awake. And if I try to use the UART after waking up, the CPU hangs and XTAL16M keeps running.

I'll appreciate if you can tell us how to use UARTs with extended sleep. The situation is a bit hard to debug, as I haven't found a way to attach the debugger without resetting the SoC.

Below are our periph_init() and write() functions.

Many thanks for your attention,
Vadim, MatchX.


static void periph_init(void)
{
/*
* Set-up Peripheral GPIOs
*/
hw_uart_reinit(HW_UART2, &uart_cfg);
hw_gpio_set_pin_function(HW_GPIO_PORT_4, HW_GPIO_PIN_5, HW_GPIO_MODE_OUTPUT,
HW_GPIO_FUNC_UART2_TX);
hw_gpio_set_pin_function(HW_GPIO_PORT_4, HW_GPIO_PIN_4, HW_GPIO_MODE_OUTPUT,
HW_GPIO_FUNC_UART2_RX);
/*
* Power up peripherals
*/
/*
* GPIO initializations
*/
/* Configure GPIO for LED output. */
timer2_config t2cfg = {
.pwm3_start = 0,
.pwm3_end = 0xffff,
.pwm4_start = 0,
.pwm4_end = 0xffff,
};
hw_timer2_init(&t2cfg);
hw_timer2_enable();
hw_led_set_led2_src(HW_LED_SRC2_PWM3);
hw_led_set_led3_src(HW_LED_SRC3_PWM4);
hw_led_enable_led2( ulLEDState & 1UL );
/* Configure GPIO for button. */
hw_gpio_set_pin_function(HW_GPIO_PORT_3, HW_GPIO_PIN_3, HW_GPIO_MODE_INPUT, HW_GPIO_FUNC_GPIO);
//printf("init\r\n");
}
int _write(int fd, char *ptr, int len)
{
hw_uart_write_buffer(HW_UART2, ptr, len);
return len;
}

Device: 
星期五,2017年4月21日18:51:40 +0000 matchx. 23312年https://support.dialog-semiconductor.com https://support.dialog-semiconductor.com/forums/post/dialog-smartbond-bluetooth-low-energy-%E2%80%93-software/extended-sleep-vs-uart#comments