Timer Interrupt - timing delay problem

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
kikw_2616236
Level 2
Level 2
First like given

hi

i am testing timer Interrupt

1. environment

  kit : CY8CKIT-042-BLE-A

  mcu : CY8C4248LQI-BL583 ( PSOC4 )

  Psoc Creator 4.1

2. Timer Setting

  Clock input - 12MHz

  Period - 48,000

  On terminal count

  Timer pulse toggle : every 4ms --> Oscillocope CH1 - Yellow

pastedImage_2.png

3. Function Generator pulse toggle : every 5ms --> Oscillocope CH4 - Green

-----------------------------------------------------------------------------------------------------------------------------------------

problem

I want precise pulses but there is a time delay

50us delay per pulse

How to make precise pulses?

pastedImage_11.png

-----------------------------------------------------------------------------------------------------

0 Likes
1 Solution
NoriTan
Employee
Employee
25 sign-ins 5 questions asked 10 sign-ins

There are two issues.

1) The Timer component counts the 12MHz clock from ZERO to 48000.  So, the period of the timer is 48,001  If you want to get a 48,000 cycle period result, 47999 should be set to the period value.

2) In your project, you are using the 48MHz IMO as the HFCLK clock which is used as the source clock of the 12MHz clock.

GS003351.png

The accuracy of the IMO is +/-2%.  So, the accuracy of the 12MHz is +/-2% too.

GS003352.png

If you want to generate more accurate Timer interrupt, Use the External Crystal Oscillator (ECO) clock as the HFCLK.

GS003353.png

Now, You can use more accurate 24MHz clock as the HFCLK.

Regards,

Noriaki

View solution in original post

2 Replies
NoriTan
Employee
Employee
25 sign-ins 5 questions asked 10 sign-ins

There are two issues.

1) The Timer component counts the 12MHz clock from ZERO to 48000.  So, the period of the timer is 48,001  If you want to get a 48,000 cycle period result, 47999 should be set to the period value.

2) In your project, you are using the 48MHz IMO as the HFCLK clock which is used as the source clock of the 12MHz clock.

GS003351.png

The accuracy of the IMO is +/-2%.  So, the accuracy of the 12MHz is +/-2% too.

GS003352.png

If you want to generate more accurate Timer interrupt, Use the External Crystal Oscillator (ECO) clock as the HFCLK.

GS003353.png

Now, You can use more accurate 24MHz clock as the HFCLK.

Regards,

Noriaki

thanks Noriaki

It works well.

I understood about clock system

0 Likes