⚠️
Hi there.. thanks for coming to the forums. Exciting news! we’re now in the process of moving to our new forum platform that will offer better functionality and is contained within the main Dialog website. All posts and accounts have been migrated. We’re now accepting traffic on the new forum only - please POST any new threads at//www.xmece.com/support. We’ll be fixing bugs / optimising the searching and tagging over the coming days.
7 posts / 0 new
Last post
Wally
Offline
Last seen:2 weeks 3 days ago
加入:2016-06-21 01:23
timer0 problem

When Timer0 interrupts and PWM are used at the same time. The timing is not correct.

void timer_init(void)
{
set_tmr_enable(CLK_PER_REG_TMR_ENABLED);
set_tmr_div(CLK_PER_REG_TMR_DIV_8);
timer0_init(TIM0_CLK_FAST, PWM_MODE_ONE, TIM0_CLK_NO_DIV);
timer0_register_callback(Timer0_IRQ_Handle);
timer0_set(1500, 900, 100);
timer0_enable_irq();
timer0_start();
}

timer0_set(1500, 900, 100);

The height and low of PWM is correct,900=450us , 100=50us。
The interruption time is incorrect ,1500=750us ,The actual time is 1000us。

Attachment:
Device:
LC_Dialog
Offline
Last seen:2 weeks 5 days ago
工作人员
加入:2016-09-19 23:20
Hi Wally,

Hi Wally,

In DA14580, the ON counter interrupt is dependent on the HIGH and LOW values of the PWM due to the fact that the register operation to reload the ON conter value (1500 in this case) has to wait until the Timer register LOW value has reached to zero. Let's say when the ON counter reached 0 when the Timer PWM0 is in the middle of LOW count, the ON counter stays at 0 until the PWM0 has reached 0 on the LOW count and then generates the interrupt. To keep things consistent, it is recommended to configure the HIGH LOW values such that the sum of HIGH and LOW is always equal to ON value. Hope this helps. Please refer to the document snippet below.

Best,
LC_Dialog

bemoon
Offline
Last seen:2 years 1 month ago
加入:2017-07-19 09:37
Hi! LC.

Hi! LC.
Could you upload the whole document or tell us the reference number of the document you quoted?
谢谢!

PM_Dialog
Offline
Last seen:5 hours 28 min ago
工作人员
加入:2018-02-08 11:03
Hi bemoon,

Hi bemoon,

This information is from full specification of the DA14580 SoC and it is not available to provide it.

Thanks, PM_Dialog

bemoon
Offline
Last seen:2 years 1 month ago
加入:2017-07-19 09:37
Thank you for your reply.

Thank you for your reply.

LC_Dialog
Offline
Last seen:2 weeks 5 days ago
工作人员
加入:2016-09-19 23:20
Hi bemoon,

Hi bemoon,

Adding to PM_Dialog's comment, you might find this information in our DA14585 Datasheet. This module on DA14580 is similar to the one on DA14585. So you might use that docuemnt for reference.
Please note that not all the other modules might be similar though.

Best,
LC_Dialog

bemoon
Offline
Last seen:2 years 1 month ago
加入:2017-07-19 09:37
Thank you very much LC.

Thank you very much LC.
It's really useful!