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.
I am running a loop in the main task where I do blink a led to check that the system is alive and execute a 1 sec sleep.
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灯亮起来,甚至在活动或空闲模式。
Can you confirm to me
- what is the init sequence for breath timer ?
- that Breath timer registers are retained during sleep ?
-呼吸计时器的状态和依赖关系是否由当前固件管理?
What are the steps to debug such case ?
Thank you in advance
Best Regards
Hi,
May I know which sample code is your code based on, and what's your modifications? Is the function you are implementing for making an automated breathing function for an external LED?
For breathing function of LED, below code shows a example:
breath_config config = {
.dc\u min=直流\u min,
.dc_max = dc_max,
.dc_step = dc_step,
.freq_div = freq_div,
.polarity = HW_BREATH_PWM_POL_POS
};
/*
* Setup breath timer configuration, so hardware can drive LED automatically.
*/
hw_breath_init(&config);
/*
* 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.
I am using exactly what you gave me
static void prvSetupHardware(void)
{
//激活中断
....
breath_config breath_cfg = {
.dc_min = 9, // light power - 1
.dc_max=10,//灯光功率设置为10/255
.dc_step = 255,
.freq_div = 255,
.polarity = HW_BREATH_PWM_POL_POS
};
/*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_led_set_led2_src(HW_LED_SRC2_BREATH);
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).
Other Hint 0x500030D0=0 before sleep, 0x500030D0=1 after sleep. It seems that this feature is not restored properly after wake-up.
下一个提示是0x50000022=0x54B7 before sleep, 0x54B6 after sleep. The RC16 is stopped during extended sleep and not started again after it. DCDC relying on it is killed during the operation. (0x5000002A = 0x20D2 after sleep : 1V8 and 1V8P down)
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控制。
Can you please check this on freertos_retarget sample code running on a DA14683 ?
到现在为止我不能使用睡眠模式。能源对我的产品至关重要。
Thank you
Hi Bob,
Can you please try to implement it in any of BLE examples of the SDK which are using sleep mode? How you are testing that the device fails to sleep? Also, which are your configurations in periph_init?
Thanks, PM_Dialog
Hello
I did not had time yet to use ble with my prototype. The BSP is quite big now so this integration has been moved away because bluetooth is not in our Minimum Viable Product.
periph_init currently only have GPIOs IN/OUT configuration, GPIO high/low for some OUT that are fixed during execution and now breath timer init.
我设法延长了睡眠时间:
- by disabling the DCDC
--> can you confirm to me why RC16 is stopped during sleep and not restarted ?
- by removing sys_tcs from the power management.
--> can you confirm to me how to have it stop reloading LED_CONTROL_REG from OTP with a reset value (0x80) ? (DA14683 on a custom board, OTP never used)
- by moving breath timer init / config in periph_init
--> LED are shut-down during sleep. As a result I can only use LED during execution time.
- by using a simple loop in the main task
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)
--> break in the UART Interrupt handler located in case HW_UART_INT_BUSY_DETECTED. I can see comment related to RBR_THR_DLL in the code. If you have any idea here, I would be pleased.
-UART丢失了一些与外部调制解调器的通信,因此我的应用程序无法正常运行。
--> I do need hardware flow control here but my hardware is not OK with it. If you have a reference implementation of asynchronous communication using hardware flow control over UART, I would be pleased. I am currently polling ad_uart_read in a thread to wait for data when communicating with external modem but it seems it misses some bytes.
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。这方面我没有问题了。
On the UART side,
-我在睡眠期间禁用了为外部调制解调器提供服务的电平移位器,因此在睡眠期间没有消息传入。这不会改变任何事情。
-我用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,
Sorry but I am little bit confused. I would strongly recommend you to NOT modify the SDK files. The hw_i2c is the Low Level Driver (LLD) and the ad_i2c is the adapter of I2C. I would highly recommend the usage of the adapters e recommend the usage of the adapters for accessing hardware peripherals because not only provide access to the peripheral, but also make sure that other tasks which are currently accessing it, suspend their operation until the peripheral is once again released. So you don't have to worry if another task tries accessing the same peripheral at the same time. Also, in sleep mode all the peripheral blocks are powered down.
Thanks, PM_Dialog
Hello
你能看一下下面这些吗?
1. console service generating uart interrupt ending in __BRK. This issue happens as soon as I do activate extended sleep.
硬故障分析:
- LR指向UART_Interrupt_Handler (HW_UART1) which is used for console service.
-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。它清楚的保留了我的发光二极管的状态。
3. RC16 / DCDC shutdown after wake-up. LDOs can do the job until extended sleep can be used with DCDC enabled.
Here I only see that before / after sleep the RC16 bit goes to zero and never goes back to 1. In DS v3.1 spec, chapter 6, DCDC is relying on RC16 so it can't be alive after wake-up.
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
- all adapters have been tested after sleep mode ?
-我可以在构造函数中使用适配器“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.
Thanks, PM_Dialog
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.
I was hitting the BOD of 3.3V because of power failure while on the retention LDO.
Things are OK after activating the Flash 1V8 switch off feature thus unloading the 3V3 RET LDO.
英航d news n°1. The system stop sleeping after several minutes. No identified fault yet.
英航d news n°2. I am still hitting the BOD of 3V3 if I do enable external peripherals.
你知道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).
- I had to raise up capacitors on VBAT up to 20µF to avoid BOD on 3V3 (current peak at wake-up that made the VBAT fall down).
-在完全关闭模式下,我的一个外设在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.
At the end of that journey the sleeping mode seems to be working but
- I am not anymore reloading OTP values from the power manager because of sys_tcs_apply(tcs_system); reloading LED_CONTROL_REG after periph_init execution.
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