DSP电流消耗大(不)

16个帖子/ 0新
最后一篇
千岛
Offline
最后一次露面:3年5个月前
加入:2016-01-15 01:32
DSP电流消耗大(不)

嗨mt_dialog,

回顾我的最后一篇文章http://support.dialog-semicondiondiondum/dsps-large-current-consumption.,我可以继续提出问题如何在DSP项目中实现低电流消耗吗?

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?

Also, if I configure UART1_TX, UART1_RX, UART1_RTS & UART1_CTS to port 2, 2mA more current will be consumed, please kindly advise.
谢谢。

设备:
mt_dialog.
Offline
最后一次露面:2个月3周前
职员
加入:2015-06-08 11:34
嗨Jackiechau,

嗨Jackiechau,

利用SW流控制其耗费更多权力的罪ce you have to be awake more often in order send the flow control signals, wait for additional bytes to receive etc, the SW flow control is more elaborated than the HW flow control and keeps the 580 awake more frequently. You can't reduce the power consumption, since if you do there are going to be sideffects of loosing data. The DSPS is allready optimized from power consumption perspective as long as it doesn't compromizes the data send, with some limitations as well when operating in sleep mode that are mentioned in the DSPS application note.

On which pins on port 2 you placed the UART pins?

谢谢mt_dialog.

千岛
Offline
最后一次露面:3年5个月前
加入:2016-01-15 01:32
嗨mt_dialog,

嗨mt_dialog,

Actually I have undefined h/w & s/w flow control, and would like to use a GPIO of external MCU to wake up 14580 for data reception and transmission later (rising edge to wake up 14580 and falling edge to let it sleep). All features of 14580 have been implemented but the current consumption is around 1x mA. Would you mind if I send you my whole project's source codes and you help me to take a look? Thanks.

千岛
Offline
最后一次露面:3年5个月前
加入:2016-01-15 01:32
嗨mt_dialog,

嗨mt_dialog,

在我的项目中,14580周期性地广播SSID并通过UART1从外部MCU接收数据。因为它在未定义的H / W和S / W流量控制(UART TX和RX FIFO应该为空)后,它总是消耗1x MA电流,
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.如果A-B-026,则必须按顺序定义H / W流量控制(我认为H / W流量控制,并且14580不应该睡得无关),我可以使用外部MCU的“GPIO 1”,为CTS提供14580的复位脉冲,以便唤醒14580,并使用外部MCU的“GPIO 2”检测RTS的下边缘,以便传输和接收数据?

谢谢。

mt_dialog.
Offline
最后一次露面:2个月3周前
职员
加入:2015-06-08 11:34
嗨Jackiechau,

嗨Jackiechau,

1)你的意思是设置你的设备在永恒的睡眠智慧hout advertising or just enable the sleeping feature ? You can issue a stop advertising command after the SSID is sent and set a timer or a push button in order for your device to wake up (that will put your device in permanent sleep, you will also have to set the device in a sleep mode by invoking) arch_set_extended_sleep() or you can just invoke the arch_set_extended_sleep() and dynamically change the sleep mode (this will set your device in sleep mode between advertising).

2)app_force_active_mode()和app_restore_sleep_mode()允许您在睡眠模式之间切换不同任务所请求的,它会从App_force_Active_Mode()的不同验证中保持计数,并且当每个任务调用Restore_sleep()时,它会减少计数零是设备可以贪婪地睡觉才能睡眠,可以在UM-B-006文档中找到功能的文档。ARCH_SET_EXTEDDED_SLEEP(SDK5)或APP_SET_EXTEDDED_SLEEP(SDK3)可以强制将设备免疫粘贴到睡眠模式中设置。

3) The DSPS isn't designed to work without flow control due to data loss, the sleep and the flow control are deeply related since the DSPS doesn't implement external wakeup, when the device falls to sleep it keeps the RTS high in order to prevent the external MCU from sending any data.If data are sent while the 580 is sleeping, there will be data loss. Yes, i suppose that you can implement a case where the 580 will use flow control and also the external MCU will trigger the 580 to wake up and wait until the 580 is ready in order to start sending data.

本地团队将通过您的注册电子邮件地址与您联系。

谢谢mt_dialog.

千岛
Offline
最后一次露面:3年5个月前
加入:2016-01-15 01:32
嗨mt_dialog,

嗨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.

mt_dialog.
Offline
最后一次露面:2个月3周前
职员
加入:2015-06-08 11:34
Hi jackiechau,

Hi jackiechau,

DSP不仅仅是通过设计实现的,通过唤醒控制器外部唤醒,它只是以垂直间隔唤醒,以便保持连接,当它唤醒时,它才能为其拉低其RTS另一边知道它是令人醒目的并且能够接收数据。您必须启用外部唤醒控制器并将其设置为适当的PIN,以便通过MCU的RTS信号唤醒,并且还需要进一步的修改以覆盖先前的功能,并通过中断调整唤醒。

谢谢mt_dialog.

千岛
Offline
最后一次露面:3年5个月前
加入:2016-01-15 01:32
嗨mt_dialog,

嗨mt_dialog,

你提到了

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.
谢谢。

千岛
Offline
最后一次露面:3年5个月前
加入:2016-01-15 01:32
嗨mt_dialog,

嗨mt_dialog,

Refer tohttp://support.dialog-semicondiondiondiond.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).

In periph_setup.c

void gpio_reservations(无效)
{
保留_GPIO(Push_Button,GPIO_PORT_1,GPIO_PIN_0,PID_GPIO);
RESERVE_GPIO( UART1_TX, UART1_TX_PORT, UART1_TX_PIN, PID_UART1_TX);
RESERVE_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);
RESERVE_GPIO( UART1_CTS, UART1_CTS_PORT, UART1_CTS_PIN, PID_UART1_CTSN);
#endif / * uart_hw_flow_enabled * /
//reserve for UART2 debug
保留_GPIO(UART2_TX,UART2_TX_PORT,UART2_TX_PIN,PID_UART2_TX);
保留_GPIO(UART2_RX,UART2_RX_PORT,UART2_RX_PIN,PID_UART2_RX);
}
#endif //DEVELOPMENT_DEBUG

/**
****************************************************************************************
*@brief Map port pins
*
*映射UART和SPI端口引脚和GPIO端口
****************************************************************************************
*/
void set_pad_functions(void)//设置GPIO端口功能模式
{

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 pads
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);
/*
*Configure application ports.
IE。
gpio_configurepin(gpio_port_0,gpio_pin_1,输出,pid_gpio,false);//将P_01设置为通用输出
*/
}

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");
/* Button is pressed, start 3sec gurd timer to detect button long press
**并恢复按钮GPIO上的极性以检测释放
*/
wkupct_register_callback(app_cts_logic_low_cb);
wkupct_enable_irq(0x100, 0x100, 1, 0x14); // P1_0, polarity low, 1 event, debouncing time = 20ms
app_button_status = 1;
if( ke_state_get(TASK_APP) == APP_CONNECTABLE )
{
只有我们在广告模式中才能唤醒唤醒。仅在ADV模式中,用户可以清除绑定数据。
app_ble_force_wakeup();
app_ble_ext_wakeup_off();

// Send message to 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");
//按钮发布,停止App_Button_Press_Timer Gurd Timer
//and revert polarity on the button GPIO to detect the button press
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 )
{
只有我们在广告模式中才能唤醒唤醒。仅在ADV模式中,用户可以清除绑定数据。
app_ble_force_wakeup();
app_ble_ext_wakeup_off();
// Send message to TASK_APP. We should clear the timer APP_BUTTON_PRESS_TIMER when BLE is awake
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.
**请注意,只有在设备广告而未连接时才会发生这种情况
*/
if( app_button_status )
{
app_timer_set(app_button_press_timer,task_app,300);

}
else
{
ke_timer_clear(app_button_press_timer,task_app);
}

/ *如果(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)
{
/*if( GPIO_GetPinStatus( GPIO_BUTTON_PORT, GPIO_BUTTON_PIN ) )
{

// Clear bonding data from non-vlolatile memory
app_clear_bond_data();

//播放一个音调,表示已删除绑定数据
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);
}

mt_dialog.
Offline
最后一次露面:2个月3周前
职员
加入:2015-06-08 11:34
Hi jackiechau,

Hi jackiechau,

A few comments regarding the code you ve pasted, the wakeup controller has a debouncing time of 20ms, if you are toggling the RTS of your MCU perhaps because of the debouncing time the wakeup interrupt is not triggered. To make sure that the device is taking the interrupt and wakes up, you can use the arch_set_pxact_gpio() function in the wake up callback and check if the interrupt is triggred in smart snippets (you should see a red vertical line when the function pxact is called). Also when the BLE is in sleep mode you can't use the UART immediately after wake up, since after waking up the 580 operates with the RC16 oscillator, this wont allow you to use the UART properly and you will have to switch to the XTAL16 before using the UART and off cource wait for the XTAL to settle.

You can find more information regarding the wakeup controller in the UM-B-051 document in the peripheral drivers section.

谢谢mt_dialog.

千岛
Offline
最后一次露面:3年5个月前
加入:2016-01-15 01:32
嗨mt_dialog,

嗨mt_dialog,

1. I'm using basic kit and burning image into EVB by smartsnippets, can I still see the red vertical line if function pxact is called? If so, which layout of smartsnippets should be used such that I can see the red vertical line? If basic kit can't show this line, what can I do to prove the system wakes up?
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?

谢谢。

mt_dialog.
Offline
最后一次露面:2个月3周前
职员
加入:2015-06-08 11:34
Hi jackiechau,

Hi jackiechau,

1) Unfortunatelly not, if you are using the basic kit it doesn't support the power profiler, you can try to toggle the LED when waking up from sleep, this might be a bit tricky since the DSPS might trace that there are no data to send so it will fall back to sleep and when waking up will switch the led off, so you have to set a variable in the interrupt routine and when waking up check the variable in the periph_init to see if the pin was set or not, besides that, you can set the pin and trace it with an analyser in order to verify that your device wakes up. Yes shorten your debounce parameter, since your are using a pulse from an external proccessor a 20ms debounce time is not going to do any good, just set the debounce time to 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.

谢谢mt_dialog.

千岛
Offline
最后一次露面:3年5个月前
加入:2016-01-15 01:32
嗨mt_dialog,

嗨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.

mt_dialog.
Offline
最后一次露面:2个月3周前
职员
加入:2015-06-08 11:34
Hi jackiechau,

Hi jackiechau,

当中断击中580的醒来需要一些时间时,它不会立即醒来,这需要时间,直到XTAL切换和稳定是正确的。

谢谢mt_dialog.

千岛
Offline
最后一次露面:3年5个月前
加入:2016-01-15 01:32
嗨mt_dialog,

嗨mt_dialog,

我想知道如何在app_adv_start之前关掉无线电,如果需要,我可以直接调用setbits16(pmu_ctrl_reg,radio_sleep)直接吗?谢谢。

BR,

杰基

mt_dialog.
Offline
最后一次露面:2个月3周前
职员
加入:2015-06-08 11:34
Hi jackiechau,

Hi jackiechau,

The radio is off when the device is not advertising, when you invoke app_adv_start the SDK and the BLE stack will switch on and off the radio when its time to receive/transmit data according to the advertising interval that you set, the same applies while you are connected.

谢谢mt_dialog.