Hello
I am willing to put my device into extended sleep thanks to idle task of free_rtos. Up to now I am facing some issues.
My code is based on sample code from Dialog. The system is booting, freertos is starting, tasks are being loaded properly.
我在主任务中运行一个循环,在这个循环中,我确实会闪烁一个led,以检查系统是否处于活动状态,并执行1秒睡眠。
I can trace the system until WFI is being executed properly. At that time breath timer is switched-off and led shut down.
At the exit of the WFI, breath timer does not wake-up.
目前,breath_config breath_cfg、hw_led_set_ledX_src(…)、hw_breath_init(&breath_cfg)和hw_breath_enable();都位于prvSetupHardware中。如果我把任何这些在periph\u init,没有led灯亮起来,甚至在活动或空闲模式。
你能跟我确认一下吗
-呼吸计时器的初始化序列是什么?
-睡眠时呼吸计时器的记录会被保留吗?
-呼吸计时器的状态和依赖关系是否由当前固件管理?
What are the steps to debug such case ?
Thank you in advance
Best Regards
Hi,
我可以知道你的代码是基于哪个示例代码的吗?你的修改是什么?您正在实施的功能是为外部LED提供自动呼吸功能吗?
For breathing function of LED, below code shows a example:
呼吸配置={
.dc\u min=直流\u min,
.dc_max = dc_max,
.dc\u step=直流步进,
.freq_div = freq_div,
极性=HW\U呼吸\U PWM\U极性\U位置
};
/*
*Setup breath timer configuration, so hardware can drive LED automatically.
*/
初始化(&C);
/*
*Setup LED1 output to be driven by timer.
*/
hw\ U led\ U set\ U led1\ U src(hw\ U led\ U SRC1\ U呼吸);
hw_led_enable_led1(true);
/*
*然后启动呼吸计时器。
*/
hw_breath_enable();
More details could be found in the peripherals_demo of the SDK.
Hello
My code is based on freertos_retarget source code.
我用的正是你给我的
static void prvSetupHardware(void)
{
//激活中断
....
breath_config breath_cfg = {
.dc_min=9,//灯功率-1
.dc_max=10,//灯光功率设置为10/255
.dc_步长=255,
.freq_div = 255,
极性=HW\U呼吸\U PWM\U极性\U位置
};
/*Init hardware (OTPC, Cache, ADC, DCDC, USB Pads, RF, adapters, buses, devices, watchdog) */
pm\u系统初始化(periph\u init);
//初始化中断控制器
hw\u wkup\u init(&wkup\u cfg);
// configure LED1, Red
hw\ U led\ U set\ U led1\ U src(hw\ U led\ U SRC1\ U呼吸);
hw\ U led\ U enable\ U led1(假);
// configure LED2, Green
hw\ U led\ U set\ U led2\ U src(hw\ U led\ U SRC2\ U呼吸);
hw\ U led\ U enable\ U led2(真);
//配置LED3,蓝色
hw_led_set_led3_src(HW_LED_SRC3_BREATH);
硬件发光二极管启用发光二极管3(假);
// configure Breath Timer required for RGB Led
hw_breath_init(&breath_cfg);
hw_breath_enable();
}
如果我把前面的代码放在periph\u init中,没有led亮起。
起床后extended_sleep远离。
Thank you in advance
它似乎比LED更麻烦。
Before sleep : 0x50000066=0x3 after WFI and after pm_system_wake_up 0x50000066=0x2.
Datasheet point out secure boot (I am testing production mode with watchdog in use but with no secure boot yet).
其他提示0x500030D0=0在睡眠前,0x500030D0=1在睡眠后。似乎唤醒后此功能未正确恢复。
下一个提示是0x50000022=0x54B7在睡眠前,0x54B6在睡眠后。RC16在长时间睡眠期间停止,之后不再启动。依赖它的DCDC在操作过程中被杀死。(0x5000002A=0x20D2休眠后:1V8和1V8P坏)
I tried to put the system in dg_configUSE_DCDC = 0 to stop using DCDC.
结果0x50000022=0xE7D3在睡眠前后。我睡觉后再也没有撞车了。
但我还是没有LED
New Hint. LED_CONTROL_REG is being erased by sys_tcs. If y do set my led sources in periph_init, they are then erased by sys_tcs at boot and at wake-up.
我没有使用OTP,为什么在这两个时刻只有这个寄存器是sys\U tcs设置的?
在查看UM-B-044的附录H时,似乎在生产过程中使用了LED控制。
你能在运行在DA14683上的freertos\u重定目标示例代码上检查这个吗?
到现在为止我不能使用睡眠模式。能源对我的产品至关重要。
Thank you
Hi Bob,
你能试着在任何一个使用睡眠模式的SDK实例中实现它吗?如何测试设备无法睡眠?另外,您在periph\u init中有哪些配置?
谢谢,下午好
Hello
我还没来得及在我的原型上使用ble。BSP现在相当大,所以这种集成已经被移开了,因为蓝牙不在我们的最低可行产品中。
periph_init目前只有GPIOs IN/OUT配置,GPIO high/low用于一些在执行期间固定的输出,现在是呼吸计时器init。
我设法延长了睡眠时间:
-通过禁用DCDC
-->你能告诉我为什么RC16在睡眠中停止而没有重新启动吗?
- by removing sys_tcs from the power management.
-->你能向我确认如何让它停止从OTP用重置值(0x80)重新加载LED控制寄存器吗?(自定义板上的DA14683,从未使用OTP)
-通过在periph\u init中移动呼吸计时器init/config
--> LED are shut-down during sleep. As a result I can only use LED during execution time.
-在主任务中使用一个简单的循环
If I do load more code than the main loop I do get various crashes / troubles:
-如果我使用硬件i2c
--> hard fault. (I need to move to ad_i2c to have it reload controler status after wake-up).
- If the UART receives data while the CPU is about to sleep or is sleeping (I think external modem sends clock update)
-->在检测到HW\U UART\U INT\U BUSY\U的情况下,中断UART中断处理程序。我可以在代码中看到与RBR\u THR\u DLL相关的注释。如果你知道的话,我会很高兴的。
-UART丢失了一些与外部调制解调器的通信,因此我的应用程序无法正常运行。
-->我确实需要这里的硬件流量控制,但我的硬件是不符合它。如果您有一个异步通信的参考实现使用硬件流控制UART,我会很高兴。我目前正在轮询线程中的ad\u uart\u read,以便在与外部调制解调器通信时等待数据,但它似乎丢失了一些字节。
Probably more troubles are to come with the sleep feature. Up to now I cannot use it in a reliable way.
Thank you in advance
Hello
我把我的代码从hw\ui2c移到ad\ui2c。这方面我没有问题了。
在UART端,
-我在睡眠期间禁用了为外部调制解调器提供服务的电平移位器,因此在睡眠期间没有消息传入。这不会改变任何事情。
-我用JTAG探测器检查了那次中断的背景。这个问题似乎与uart控制台有关,因为我的代码不使用异步通信,所以在我用来与外部调制解调器通信的uart上没有生成IRQ。我得到的唯一IRQ来自控制台服务。
你能告诉我以下的地址吗?
- RC16 / DCDC shutdown after wake-up
- sys_tcs reloading values from OTP while no OTP is used
- console service interrupt ending in __BRK
Thank you in advance
Hi Bob,
对不起,我有点困惑。我强烈建议您不要修改SDK文件。硬件i2c是低电平驱动程序(LLD),而ad i2c是i2c的适配器。我强烈建议使用适配器e建议使用适配器访问硬件外设,因为它不仅提供对外设的访问,而且确保当前正在访问它的其他任务,暂停其操作,直到外围设备再次释放。因此,如果另一个任务同时访问同一个外围设备,您不必担心。另外,在睡眠模式下,所有外围模块都关闭。
谢谢,下午好
Hello
你能看一下下面这些吗?
1. console service generating uart interrupt ending in __BRK. This issue happens as soon as I do activate extended sleep.
硬故障分析:
-LR指向用于控制台服务的UART\u中断处理程序(HW\u UART1)。
-PC指向CONFIG\u UART\u IGNORE\u BUSY\u DETECT case in void UART\u Interrupt\u Handler(HW\u UART\u ID UART)
I tried using no dma config for uart. no change.
2. sys_tcs reloading values from OTP while no OTP is used. This issue is to be solved to avoid modifying BSP files.
-看我之前的分析。我可以使用JTAG探针来确定LED\u CONTROL\u REG是sys\u tcs\u apply(tcs\u system);函数重新加载的唯一寄存器。重新加载的值为0x80。它清楚的保留了我的发光二极管的状态。
三。RC16/DCDC唤醒后停机。LDO可以完成这项工作,直到在启用DCDC的情况下使用延长睡眠。
在这里,我只看到在睡眠前/睡眠后,RC16位变为零,永远不会变回1。在DS v3.1规范的第6章中,DCDC依赖于RC16,因此在唤醒后它不能处于活动状态。
Thank you in advance
Hello
New hard fault: I get a new one in ad_gpadc_read() after sleep occured. I checked the GPADC registers and they are in reset state.
Can you confirm that
-所有的适配器都在睡眠模式下测试过了吗?
-我可以在构造函数中使用适配器“open”函数吗?
- I do not need to call "open" again during normal operations. (this include after wake-up) ?
Thank you in advance
嗨,鲍勃,
我真为你所做的改变感到困惑。
My recommendation would be to readUM-B-044: DA1468x Software Platform Reference和UM-B-056:DA1468x软件开发人员指南in order to understand the SDK architecture. You can also find “Adapter” example in the “Tutorial” section in DA1468x support portal.
谢谢,下午好
Hello
Can you launch freertos_retaget, light up a led and activate extended_sleep on a DA14683 (with printf/console redirected to a uart, dcdc and dma enabled) ?
-睡眠前LED\ U CONTROL\ U REG的值是多少?之后呢?
-休眠前RC16启用位的值是多少?之后呢?DCDC还活着吗?
Thank you for your advice of reading the manual but it looks like bugs in the SDK and I would be pleased that you check it on your side. I am getting hard faults from the board support package.
Thank you
Hello
Good news. I finally managed to get the sleep feature working without crash.
我在使用LDO时,由于电源故障,达到了3.3V的BOD。
启动闪存1V8关闭功能后一切正常,从而卸载3V3 RET LDO。
英航d news n°1. The system stop sleeping after several minutes. No identified fault yet.
坏消息2。如果我真的启用了外部外设,我仍然会达到3V3的目标。
你知道3.3V RET LDO在长时间睡眠时的功率预算是多少吗(请不要回答10mA,因为它附带了很多东西)?
我有1.2毫安的1V8P和300微安的3V3理论上的绝对最大值,但当睡眠是启用我击中了生化需氧量,并以上电复位结束。
Thank you
Hello
I finally managed to solve last issues
- I had to manually drive the switch to extended_sleep at a moment where I know nothing is happening on the system (and on the console !). I also had to manage a manual switch to idle mode to avoid small sleeps during normal operations (like sleeping while waiting for an adapter event).
-我不得不将VBAT上的电容提高到20µF,以避免3V3上的BOD(唤醒时的电流峰值导致VBAT下降)。
-在完全关闭模式下,我的一个外设在1V8P上消耗高达8mA。10毫安的预算不好!我不得不在手术后重置它,让它在睡觉时消耗更少。
- The system was not waking-up sleeping tasks without pm_set_wakeup_mode(true) activated. Without it I ended stuck after sleep with a system stable but doing nothing.
在旅程结束时,睡眠模式似乎起了作用,但
-我不再从电源管理器重新加载OTP值,因为sys\u tcs\u apply(tcs\u system);在periph\u init执行后重新加载LED\u CONTROL\u REG。
I am asking again for help at least on the OTP issue so I can release a version without modifying boad support package files.
Thank you