嗨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?
此外,如果我配置UART1_TX,UART1_RX,UART1_RTS&UART1_CTS到端口2,则将消耗2MA更多电流,请告知。
谢谢。
设备:
嗨Jackiechau,
使用SW流量控制其更大的功耗,因为您必须更常见的是醒来的顺序发送流量控制信号,等待额外的字节接收等,SW流量控制比HW流量控制更详细,并保持580令人欣赏频繁地。您无法降低功耗,如果您确实存在丢失数据的侧面。只要它在DSPS应用笔记中提到的睡眠模式下运行时,DSP就会从电源消耗视角显示从功耗角度优化。
在端口2的哪个管脚上放置了UART管脚?
谢谢mt_dialog.
嗨mt_dialog,
实际上我没有定义h/w和s/w流控制,我想用一个外部MCU的GPIO唤醒14580,以便以后接收和传输数据(上升沿唤醒14580,下降沿让它休眠)。14580的所有功能都已实现,但电流消耗约为1x mA。你介意我把我整个项目的源代码发给你,你帮我看一下吗?谢谢。
嗨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的下边缘,以便传输和接收数据?
谢谢。
嗨Jackiechau,
1) 你的意思是在不做广告的情况下让你的设备进入永久睡眠还是只启用睡眠功能?您可以在发送SSID后发出停止广告命令,并设置计时器或按钮,以便您的设备唤醒(这将使您的设备进入永久睡眠,您还必须通过调用arch\u set\u extended\u sleep()将设备设置为睡眠模式,或者您可以只调用arch\u set\u extended\u sleep()并动态更改睡眠模式(这将在广告之间将设备设置为睡眠模式)。
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) 由于数据丢失,DSP不能在没有流量控制的情况下工作,睡眠和流量控制有着密切的关系,因为DSP不实现外部唤醒,当设备进入睡眠状态时,它会保持RTS高,以防止外部MCU发送任何数据。如果数据是在580睡眠时发送的,会有数据丢失。是的,我想您可以实现这样一种情况:580将使用流控制,并且外部MCU将触发580唤醒,并等待580准备就绪,以便开始发送数据。
本地团队将通过您的注册电子邮件地址与您联系。
谢谢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.
Hi jackiechau,
DSP不仅仅是通过设计实现的,通过唤醒控制器外部唤醒,它只是以垂直间隔唤醒,以便保持连接,当它唤醒时,它才能为其拉低其RTS另一边知道它是令人醒目的并且能够接收数据。您必须启用外部唤醒控制器并将其设置为适当的PIN,以便通过MCU的RTS信号唤醒,并且还需要进一步的修改以覆盖先前的功能,并通过中断调整唤醒。
谢谢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.
谢谢。
嗨mt_dialog,
参考http://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).
在periph\u 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);
预留GPIO(UART1\U RX、UART1\U RX\U端口、UART1\U RX\U引脚、PID\U UART1\U RX);
#if(uart_hw_flow_enabled)
RESERVE_GPIO( UART1_RTS, UART1_RTS_PORT, UART1_RTS_PIN, PID_UART1_RTSN);
保留\u GPIO(UART1 \u CTS、UART1 \u CTS \u端口、UART1 \u CTS \u引脚、PID \u UART1 \u 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//开发\调试
/ **
****************************************************************************************
*@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\ U配置引脚(UART1\ U TX\ U端口、UART1\ U TX\ U引脚、输出、PID\ U UART1\ U TX、false);
GPIO_ConfigurePin( UART1_RX_PORT, UART1_RX_PIN, INPUT_PULLUP, PID_UART1_RX, false );
#if(uart_hw_flow_enabled)
GPIO\u ConfigurePin(UART1\u RTS\u端口,UART1\u RTS\u PIN,输出,PID\u UART1\u RTSN,false);
GPIO_ConfigurePin( UART1_CTS_PORT, UART1_CTS_PIN, INPUT_PULLUP, PID_UART1_CTSN, false );
#endif / * uart_hw_flow_enabled * /
//初始焊盘
GPIO_ConfigurePin(UART2_TX_PORT, UART2_TX_PIN, OUTPUT, PID_UART2_TX, false);
GPIO\ U配置引脚(UART2\ U RX\端口,UART2\ U RX\引脚,输入,PID\ UART2\ U RX,false);
/ *
*配置应用程序端口。
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\u STAT\u REG,PER\u IS \u DOWN))
periph_init();
printf_string("\r\napp_cts_logic_high_cb\r\n");
/ *按下按钮,启动3SEC GURD定时器检测按钮长按
**并恢复按钮GPIO上的极性以检测释放
*/
wkupct_register_callback(app_cts_logic_low_cb);
wkupct_enable_irq(0x100,0x100,1,0x14);// p1_0,极性低,1个事件,脱嘴时间= 20ms
应用程序按钮状态=1;
if(ke\u state\u get(TASK\u APP)==APP\u 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\u STAT\u REG,PER\u IS \u DOWN))
periph_init();
printf_string(“\r\napp_cts_logic_low_cb\r\n”);
//按钮发布,停止App_Button_Press_Timer Gurd Timer
//并恢复按钮GPIO上的极性以检测按钮按下
wkupct\u寄存器\u回调(app\u cts\u逻辑\u高\u cb);
wkupct_enable_irq(0x100, 0x000, 1, 0x14); // P1_0, polarity high, 1 event, debouncing time = 20ms
应用程序\按钮\状态=0;
if(ke\u state\u get(TASK\u APP)==APP\u CONNECTABLE)
{
只有我们在广告模式中才能唤醒唤醒。仅在ADV模式中,用户可以清除绑定数据。
app_ble_force_wakeup();
app_ble_ext_wakeup_off();
//向任务应用程序发送消息。当BLE唤醒时,我们应该清除定时器应用程序按钮按下定时器
ke_msg_send_basic(app_wakeup_msg,task_app,null);
}
}
void应用程序初始化函数(void)
{
app_set_rxirq_threshold(ble_rx_buffer_cnt / 4);
app_sps_init();
printf_string(“\ n \ rapp_init_func \ r \ n”);
wkupct\u寄存器\u回调(app\u cts\u逻辑\u高\u 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*参数,
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);
}
其他的
{
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))
{
//从非vlolatile内存中清除绑定数据
app_clear_bond_data();
//播放一个音调,表示已删除绑定数据
app_proxr_pwm_enable(button_pwm_callback);
systick\u usec\u单位(假);
systick_wait(app_pwm_disable_delay);
app_proxr_pwm_disable();
* /
return(ke_msg_consumed);
}
Hi jackiechau,
关于您粘贴的代码的一些注释,唤醒控制器有20ms的去抖动时间,如果您切换MCU的RTS,可能是因为去抖动时间,唤醒中断没有触发。为了确保设备正在进行中断并被唤醒,您可以在唤醒回调中使用arch\u set\u pxact\u gpio()函数,并检查是否在智能代码段中触发了中断(调用函数pxact时,您应该看到一条红色的竖线)。另外,当BLE处于睡眠模式时,您不能在唤醒后立即使用UART,因为唤醒后580与RC16振荡器一起工作,这将不允许您正确使用UART,您必须在使用UART之前切换到XTAL16,然后关闭,等待XTAL稳定下来。
You can find more information regarding the wakeup controller in the UM-B-051 document in the peripheral drivers section.
谢谢mt_dialog.
嗨mt_dialog,
1我正在使用basic工具包,并通过smartsnippets将图像烧录到EVB中,如果调用了pxact函数,我还能看到红色的竖线吗?如果是,应该使用哪种smartsnippets布局,以便我可以看到红色的垂直线?如果basic kit不能显示这条线,我能做什么来证明系统唤醒了?
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中的变量,以查看是否设置了管脚,此外,您还可以设置管脚并用分析仪跟踪它,以验证您的设备是否唤醒。是的,缩短去盎司参数,因为您使用的是来自外部处理器的脉冲,所以20毫秒的去盎司时间不会有任何好处,只需将去盎司时间设置为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.
嗨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,
当中断击中580的醒来需要一些时间时,它不会立即醒来,这需要时间,直到XTAL切换和稳定是正确的。
谢谢mt_dialog.
嗨mt_dialog,
我想知道如何在app_adv_start之前关掉无线电,如果需要,我可以直接调用setbits16(pmu_ctrl_reg,radio_sleep)直接吗?谢谢。
布罗尔,
杰基
Hi jackiechau,
当设备未发布广告时,收音机将关闭;当您调用app\u adv\u启动SDK时,BLE堆栈将根据您设置的广告时间间隔打开和关闭收音机;当您连接时,同样的情况也适用。
谢谢mt_dialog.