DA1468X Extended Sleep - Breath Timer and LED

Learn MoreFAQsTutorials

17 posts / 0 new
Last post
bobspam@free.fr
Offline
Last seen:3天前1周
加入:2018-06-20 08:07
DA1468X Extended Sleep - Breath Timer and LED

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.

目前呼吸呼吸呼吸_cfg,hw_led_set_ledx_src(...),hw_breath_init(&approze_cfg);和hw_breath_enable();都位于Prvsetuphardware。如果我在periph_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

关键词:
Device:
PW_Dialog
Offline
Last seen:4 days 11 hours ago
Staff
加入:2019-04-03 02:54
Hi,

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_min = dc_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_led_set_led1_src(hw_led_src1_breath);
hw_led_enable_led1(true);

/ *
*然后开始呼吸计时器。
*/
hw_breath_enable();

More details could be found in the peripherals_demo of the SDK.

bobspam@free.fr
Offline
Last seen:3天前1周
加入:2018-06-20 08:07
Hello

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_SYSTEM_INIT(PERIPH_INIT);

// init中断控制器
hw_wkup_init(&wkup_cfg);

// configure LED1, Red
hw_led_set_led1_src(hw_led_src1_breath);
hw_led_enable_led1(false);
// configure LED2, Green
hw_led_set_led2_src(HW_LED_SRC2_BREATH);
hw_led_enable_led2(真实);
//配置LED3,蓝色
hw_led_set_led3_src(HW_LED_SRC3_BREATH);
hw_led_enable_led3(false);
// configure Breath Timer required for RGB Led
hw_breath_init(&breath_cfg);
hw_breath_enable();

}

如果我在Periph_Init中放置了以前的代码,则没有LED亮起。

起床后extended_sleep远离。

Thank you in advance

bobspam@free.fr
Offline
Last seen:3天前1周
加入:2018-06-20 08:07
It seems deeper trouble than

它似乎比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).

bobspam@free.fr
Offline
Last seen:3天前1周
加入:2018-06-20 08:07
新提示0x500030D0 = 0之前

Other Hint 0x500030D0=0 before sleep, 0x500030D0=1 after sleep. It seems that this feature is not restored properly after wake-up.

bobspam@free.fr
Offline
Last seen:3天前1周
加入:2018-06-20 08:07
下一个提示是0x50000022 =

下一个提示是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。睡觉后我没有更多的撞车。

但我仍然没有领导

bobspam@free.fr
Offline
Last seen:3天前1周
加入:2018-06-20 08:07
New Hint. Breath Timer

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_tcs在这2次上唯一的一个?

在查看UM-B-044附录H的同时,似乎在生产过程中正在使用LED_CONTROL_REG。

Can you please check this on freertos_retarget sample code running on a DA14683 ?

到目前为止我不能使用睡眠模式。能量对我的产品至关重要。

Thank you

PM_Dialog
Offline
Last seen:1 hour 27 min ago
Staff
加入:2018-02-08 11:03
Hi Bob,

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

bobspam@free.fr
Offline
Last seen:3天前1周
加入:2018-06-20 08:07
Hello

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:

- 如果我使用hw_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

bobspam@free.fr
Offline
Last seen:3天前1周
加入:2018-06-20 08:07
Hello

Hello

我将我的代码从HW_I2C移动到AD_I2C。我在这方面没有更多的问题。

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

PM_Dialog
Offline
Last seen:1 hour 27 min ago
Staff
加入:2018-02-08 11:03
Hi Bob,

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

bobspam@free.fr
Offline
Last seen:3天前1周
加入:2018-06-20 08:07
Can you please address the

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.

- 在void uart_interrupt_handler(HW_UART_ID UART)中,PC点到CONFIG_UART_IGNORE_BUSY_DETECT案例

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.

- 查看我以前的分析。我可以使用LED_CONTROL_REG的JTAG探测器弄清楚LED_CONTROL_REG是由SYS_TCS_APPLED(TCS_SYSTEM)重新加载的唯一寄存器;功能。重新加载值为0x80。它清除了我的LED的保留状态。

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

bobspam@free.fr
Offline
Last seen:3天前1周
加入:2018-06-20 08:07
Hello

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 ?

- 我可以在构造函数中有适配器“打开”功能?

- I do not need to call "open" again during normal operations. (this include after wake-up) ?

Thank you in advance

PM_Dialog
Offline
Last seen:1 hour 27 min ago
Staff
加入:2018-02-08 11:03
嗨鲍勃,

嗨鲍勃,

我真的很困惑你所做的变化。

  1. SDK files like the adapters and LLD driver must NOT modified.
  2. All the adapters are tested
  3. Before using the adapter you should initialize and close them.
  4. 关于WDOD,您应该调试程序并找到代码卡的位置。
  5. The system will run with 16MHz clock when in active mode. In sleep mode it runs with 32KHz clock.

My recommendation would be to readUM-B-044: DA1468x Software Platform ReferenceUM-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

bobspam@free.fr
Offline
Last seen:3天前1周
加入:2018-06-20 08:07
Hello

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_CONTROL_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

bobspam@free.fr
Offline
Last seen:3天前1周
加入:2018-06-20 08:07
Hello

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有很多附加的东西)?

我在1V8P和300μA上有1.2mA,3V3理论绝对最大值,但是当睡眠启用时,我会击中BOD并最终通过电源复位。

Thank you

bobspam@free.fr
Offline
Last seen:3天前1周
加入:2018-06-20 08:07
Hello

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,同时处于完整的关闭模式。10MA预算不好!我不得不在操作后重置它,使其在睡觉时消耗少。

- 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