Hi MT_dialog,
Recap from my last posthttp://support.dialog-semiconductor.com/dsps-large-current-consumption, may I continue to ask the question how to achieve low current consumption in DSPS project?
I'm using official DA14580EVKT-B now. I have tested the current consumption by using HW or SW flow control. If HW flow control is used, the current consumption is below 1mA. If SW flow control is used, the current consumption is nearly 2.x mA. Because the limitation of I/O pins of MCU master, I can't use the approach of HW flow control. But the current consumption of using SW flow control is still quite high, how to lower the current consumption below 1mA?
此外,如果我配置UART1_TX,UART1_RX,UART1_RTS&UART1_CTS到端口2,则将消耗2MA更多电流,请告知。
谢谢。
Device:
Hi Jackiechau,
使用SW流量控制其更大的功耗,因为您必须更常见的是醒来的顺序发送流量控制信号,等待额外的字节接收等,SW流量控制比HW流量控制更详细,并保持580令人欣赏频繁地。您无法降低功耗,如果您确实存在丢失数据的侧面。只要它在DSPS应用笔记中提到的睡眠模式下运行时,DSP就会从电源消耗视角显示从功耗角度优化。
在港口2上的引脚你放置了UART引脚?
Thanks MT_dialog
Hi MT_dialog,
实际上我拥有未定义的H / W&S / W流量控制,并希望使用外部MCU的GPIO来唤醒14580以进行数据接收和传输(上升沿唤醒14580和下降以放置睡眠)。已实施14580的所有功能,但目前的消费量为1x mA。你介意我寄给你我的整个项目的源代码,你帮我看看吗?谢谢。
Hi MT_dialog,
In my project, 14580 broadcasts SSID periodically and receives data from external MCU via UART1. Because it always consumes 1x mA current after undefined h/w and s/w flow control (UART TX and RX FIFO should be empty),
1. Can I force 14580 to sleep mode after broadcasting SSID? How to do it?
2. One of GPIO of 14580 is configured as interrupt pin to detect logic high or low, if logic high is detected, 14580 is forced to active forever. If logic low is detected, 14580 is forced to sleep. Is it possible to do it? Should I use app_force_active_mode and app_restore_sleep_mode?
3. If h/w flow control must be defined in order that 14580 can be entered into sleep mode (I think h/w flow control and whether 14580 can be slept shouldn't be related), according to AN-B-026, can I use a "GPIO 1" of external MCU to provide a reset pulse to CTS of 14580 in order to wake up 14580, and use "GPIO 2" of external MCU to detect the lower edge of RTS of 14580 in order to transmit and receive data?
谢谢。
Hi Jackiechau,
1)您的意思是在永久睡眠中设置您的设备而无需广告或仅启用睡眠功能?您可以在发送SSID后发出停止广告命令并设置计时器或按钮,以便您的设备唤醒(这将使您的设备放在永久睡眠中,您还必须在睡眠模式下设置设备通过调用)ARCH_SET_EXTEDDE_SLEEP()或者您只能调用ARCH_SET_EXTEDDE_SLEEP()并动态更改睡眠模式(这将在广告之间设置您的设备。
2) app_force_active_mode()和app_restore_sleep_mode() lets you toggle between sleep modes that different tasks have requested, it keeps count from different invcations of the app_force_active_mode() and when each task invokes the restore_sleep() it reduces the count, when the count is zero the device can freelly fall to sleep, you can find the function's documentation in the UM-B-006 document. The arch_set_extended_sleep (SDK5) or app_set_extended_sleep (SDK3) can force the device immidiatelly to be set in the sleep mode.
3)DSP不设计为由于数据丢失而无流量控制,睡眠和流量控制深入相关,因为DSP无法实现外部唤醒,当设备跌至睡眠时,它保持RTS高次数为防止外部MCU发送任何数据。如果在580睡眠时发送数据,则会有数据丢失。是的,我想你可以实现580将使用流量控制的情况,并且外部MCU将触发580醒来并等到580准备好以便开始发送数据。
The local team will contact you via your registered email address.
Thanks MT_dialog
Hi MT_DIALOG,
I will contact your distributer next week but I would like to know why master Mcu can't wake up BLE by RTS if hardware flow control is defined and ext_sleep is enabled. When ext_sleep is disabled, I check CTS interrupt can be triggered and correct data can be received, it seems BLE can't be woke up, please kindly advise.
Hi jackiechau,
The DSPS as is, doesn't implement, by design, external wake up via the wake up controller, it just wakes up in regural intervals in order to keep the connection alive, when it is awake it pulls low its RTS in order for the other side to know that it is awake and that is capable of receiving data. You will have to enable the external wake up controller and set it to the appropriate pin in order to wake up via the RTS signal of your MCU and also will need further modifications in order to override the previous functionallity and adapt the wakeup via interrupt.
Thanks MT_dialog
Hi MT_DIALOG,
You mentioned
1. I found "Enable wake up controller" by EXTERNAL_WAKEUP but do you mean RTS of master Mcu should also connect to another pin of BLE, BLE sleep can be disabled in this gpio interrupt handler and BLE sleep can be enabled somewhere?
2. Futher modification, please provide the example.
谢谢。
Hi MT_dialog,
参考http://support.dialog-semiconductor.com/dsps-use-gpio-control-its-extend..., I have followed the smart tag reference design in the app_button_press_cb() function, connected RTS of master MCU to P1_0 for external wake up interrupt and reserved P0_2 for CTS of BLE. However, it seemed BLE couldn't be woke up and nothing was printed in app_cts_logi_high_cb(void).
在periph_setup.c
void GPIO_reservations(void)
{
RESERVE_GPIO( PUSH_BUTTON, GPIO_PORT_1, GPIO_PIN_0, PID_GPIO);
RESERVE_GPIO( UART1_TX, UART1_TX_PORT, UART1_TX_PIN, PID_UART1_TX);
保留_GPIO(UART1_RX,UART1_RX_PORT,UART1_RX_PIN,PID_UART1_RX);
#if (UART_HW_FLOW_ENABLED)
RESERVE_GPIO( UART1_RTS, UART1_RTS_PORT, UART1_RTS_PIN, PID_UART1_RTSN);
保留_GPIO(UART1_CTS,UART1_CTS_PORT,UART1_CTS_PIN,PID_UART1_CTSN);
#endif /*UART_HW_FLOW_ENABLED*/
//reserve for UART2 debug
RESERVE_GPIO( UART2_TX, UART2_TX_PORT, UART2_TX_PIN, PID_UART2_TX);
RESERVE_GPIO( UART2_RX, UART2_RX_PORT, UART2_RX_PIN, PID_UART2_RX);
}
#endif // development_debug.
/ **
****************************************************************************************
* @brief Map port pins
*
* The Uart and SPI port pins and GPIO ports are mapped
****************************************************************************************
* /
void set_pad_functions(void) // set gpio port function mode
{
GPIO_ConfigurePin( GPIO_PORT_1, GPIO_PIN_0, INPUT_PULLDOWN, PID_GPIO, false);
GPIO_CONFIGUREPIN(UART1_TX_PORT,UART1_TX_PIN,OUTPUT,PID_UART1_TX,FALSE);
GPIO_ConfigurePin( UART1_RX_PORT, UART1_RX_PIN, INPUT_PULLUP, PID_UART1_RX, false );
#if (UART_HW_FLOW_ENABLED)
GPIO_CONFIGUREPIN(UART1_RTS_PORT,UART1_RTS_PIN,OUTPUT,PID_UART1_RTSN,FALSE);
GPIO_ConfigurePin( UART1_CTS_PORT, UART1_CTS_PIN, INPUT_PULLUP, PID_UART1_CTSN, false );
#endif /*UART_HW_FLOW_ENABLED*/
// init pad.
GPIO_ConfigurePin(UART2_TX_PORT, UART2_TX_PIN, OUTPUT, PID_UART2_TX, false);
GPIO_CONFIGUREPIN(UART2_RX_PORT,UART2_RX_PIN,INPUT,PID_UART2_RX,FALSE);
/ *
*配置应用程序端口。
i.e.
GPIO_ConfigurePin( GPIO_PORT_0, GPIO_PIN_1, OUTPUT, PID_GPIO, false ); // Set P_01 as Generic purpose Output
* /
}
app_sps_device_project.c
void app_cts_logic_high_cb(void)
{
if(getBits16(sys_stat_reg,per_is_down))
periph_init();
printf_string("\r\napp_cts_logic_high_cb\r\n");
/ *按下按钮,启动3SEC GURD定时器检测按钮长按
** and revert polarity on the button GPIO to detect the release
* /
wkupct_register_callback(app_cts_logic_low_cb);
wkupct_enable_irq(0x100,0x100,1,0x14);// p1_0,极性低,1个事件,脱嘴时间= 20ms
app_button_status = 1;
if(ke_state_get(task_app)== app_connectable)
{
//Wakeup BLE only if we are in advertising mode. Only in ADV mode the user can clear the bonding data.
app_ble_force_wakeup();
app_ble_ext_wakeup_off();
//向Task_App发送消息。We should set the timer APP_BUTTON_PRESS_TIMER when BLE is awake
ke_msg_send_basic(APP_WAKEUP_MSG, TASK_APP, NULL);
}
}
void app_cts_logic_low_cb(void)
{
if(getBits16(sys_stat_reg,per_is_down))
periph_init();
printf_string(“\ r \ napp_cts_logic_low_cb \ r \ n”);
//Button is released, stop APP_BUTTON_PRESS_TIMER gurd timer
//并恢复按钮GPIO上的极性以检测按钮按下
wkupct_register_callback(app_cts_logic_high_cb);
wkupct_enable_irq(0x100, 0x000, 1, 0x14); // P1_0, polarity high, 1 event, debouncing time = 20ms
app_button_status = 0;
if(ke_state_get(task_app)== app_connectable)
{
//Wakeup BLE only if we are in advertising mode. Only in ADV mode the user can clear the bonding data.
app_ble_force_wakeup();
app_ble_ext_wakeup_off();
//向Task_App发送消息。我们应该清除Timer App_Button_Press_Timer时醒来时
ke_msg_send_basic(APP_WAKEUP_MSG, TASK_APP, NULL);
}
}
void app_init_func(void)
{
app_set_rxirq_threshold(ble_rx_buffer_cnt / 4);
app_sps_init();
printf_string("\n\rapp_init_func\r\n");
wkupct_register_callback(app_cts_logic_high_cb);
wkupct_enable_irq(0x100, 0x000, 1, 0x14); // P1_0, polarity high, 1 event, debouncing time = 20ms
}
int app_wakeup_handler(ke_msg_id_t const msgid,
void * param,
ke_task_id_t const dest_id,
ke_task_id_t const src_id)
{
// If state is not idle, ignore the message
if (ke_state_get(dest_id) == APP_CONNECTABLE)
{
/ *Check if reason of wake up was button press or release and set or clear the long press timer.
** Note this should only happen when the device is advertising and not connected
* /
if( app_button_status )
{
app_timer_set(APP_BUTTON_PRESS_TIMER, TASK_APP, 300);
}
别的
{
ke_timer_clear(APP_BUTTON_PRESS_TIMER, TASK_APP);
}
/ *if( adv_count == 0 )
{
restart_adv = 0;
app_adv_start();
}*/
}
return (KE_MSG_CONSUMED);
}
int app_button_press_timer_handler( ke_msg_id_t const msgid,
void const *param,
ke_task_id_t const dest_id,
ke_task_id_t const src_id)
{
/ *如果(gpio_getpinstatus(gpio_button_port,gpio_button_pin))
{
//从非vlolatile存储器清除绑定数据
app_clear_bond_data();
// Play a tone to indicate that the bonding data have been deleted
app_proxr_pwm_enable(button_pwm_callback);
systick_usec_units(false);
systick_wait(APP_PWM_DISABLE_DELAY);
app_proxr_pwm_disable();
}*/
return (KE_MSG_CONSUMED);
}
Hi jackiechau,
几个关于您粘贴的代码的评论,唤醒控制器的衰减时间为20ms,如果您正在为MCU的RTS切换,可能是因为唤醒时间未触发唤醒中断。要确保设备正在接收中断并唤醒,可以在唤醒回调中使用ARCH_SET_PXACT_GPIO()函数,并检查中断是否在智能片段中进行了三次,当函数pxact时,您应该看到红色垂直线叫)。此外,当BLE处于睡眠模式时,您无法在唤醒后立即使用UART,因为在唤醒后,580使用RC16振荡器运行,这允许您正确使用UART,您必须切换到XTAL16在使用UART和OFF COME等待XTAL定居之前。
You can find more information regarding the wakeup controller in the UM-B-051 document in the peripheral drivers section.
Thanks MT_dialog
Hi MT_dialog,
1.我正在使用基本套件和刻录图像,通过SmartSnippet将图像刻录到EVB中,如果函数pxact仍然可以看到红色垂直线?如果是这样,应该使用哪种Smartsnippet的布局,这样我就可以看到红色垂直线?如果基本套件无法显示这一行,我可以做些什么来证明系统醒来?
Also, should I shorten the debouncing time parameter of wkupct_enable_irq() and increase the toggle time of MCU's RTS signal?
2. If wkupct_register_callback and wkupct_enable_irq aren't called, and original api gpio0_callback() of periph_setup.c will be triggered if master MCU toggles its RTS signal, it's quite weird that dialog can receive and transmit data to master MCU. However, if app_timer_set(SPS_TIMER,TASK_APP, 100) is called per 1 second, nothing can be received or transmitted from dialog side. Is it still related to the wakeup issue?
谢谢。
Hi jackiechau,
1)不幸的是,如果您使用的基本套件不支持电源分布器,可以尝试从睡眠中唤醒时切换LED,这可能有点棘手,因为DSP可能跟踪没有数据要发送,所以它会恢复睡眠,醒来时会切换LED,所以必须在中断例程中设置一个变量,并且唤醒时检查PERIPH_INIT中的变量,以查看PIN是否已设置,除此之外,您可以使用分析仪设置PIN并将其跟踪,以验证您的设备是否唤醒。是缩短了你的去抖参数,因为你正在使用来自外部的proccessor的脉冲,一个20ms的去抖时间不会做任何好的,只是把去抖时间设置为0。
2) gpio0_callback()是一个平凡的中断,this interrupt can only be called when the system is awake, when the 580 is in sleep mode this interrupt is not going to wake up the system. When sleeping only the interrupt from the wake up timer can wake up the 580. There is no relation between the kernel timers and the wakeup timer.
Thanks MT_dialog
Hi MT_dialog,
Thanks for your help, it's done. But in my source code, I just wonder why I need to add several ms delay in gpio0_callback(), app_cts_logic_high_cb() and app_cts_logic_low_cb() in order that master MCU can transmit and receive UART data from 14580.
Hi jackiechau,
When the interrupt hits it takes some time for the waking up of the 580, it doesn't wake up instantly, it takes time until the XTAL switching and settling are proper.
Thanks MT_dialog
Hi MT_dialog,
I would like to know how to turn off radio before app_adv_start and turn on if in need, can I call SetBits16(PMU_CTRL_REG, RADIO_SLEEP) to on and off directly? Thanks.
布罗尔,
Jackie
Hi jackiechau,
当设备不是广告时,无线电熄灭,当您调用App_adv_start时,SDK和BLE堆栈将在收到/传输数据的时间根据您设置的广告间隔接收/传输数据时,同样适用连接。
Thanks MT_dialog