PSoC4100s use WCO as timer's clock source

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

cross mob
Anonymous
Not applicable

we are using PSoC4100s, setup WCO as timer0's clock source, measure the frequency of timer0 and found it not in WCO's 32768 frequency.

our configuration as the follows.

pastedImage_0.png

codes like the follows:

void timer0_isr(void)

{

    set_a_Write(1);

    set_a_Write(0);

    CySysTimerClearInterrupt(0);

    CySysTimerSetMatch(0, CySysTimerGetCount(0) + 100);

}

void timer0_init(void)

{

    CySysClkSetTimerSource(CY_SYS_CLK_TIMER_SRC_WCO);

    CySysTimerDisable(CY_SYS_TIMER0_MASK);

    CySysTimerResetCounters(CY_SYS_TIMER0_RESET);

    CySysTimerSetInterruptCallback(0, timer0_isr);

    CySysTimerSetMode(0, CY_SYS_TIMER_MODE_INT);

    CySysTimerSetClearOnMatch(0, 1);

    CySysTimerSetMatch(0, CySysTimerGetCount(0) + 100);//100 ticks

    CySysTimerEnableIsr(0);

    CySysTimerEnable(CY_SYS_TIMER0_MASK);

    set_a_SetDriveMode(set_a_DM_STRONG);

    set_a_Write(0);

}

we want pull up set_a pin in every 100 ticks, but the frequency is not from WCO's 32768 but seems from the ILO.

0 Likes
1 Solution
Anonymous
Not applicable

problem have been resolved. software found that using wco and ilo in same counter, their time period different much. hardware check its circurt and fix it.

now the ticks calculated match with the waveform.

thanks.

View solution in original post

0 Likes
4 Replies
HaoW_21
Employee
Employee
First like received Welcome!

Qipan,

Can you paste your captured waveform here?

Hao

0 Likes
Anonymous
Not applicable

IMG_20180605_194521.jpg

we setup it in 10ms period, but from the waveform it is about 15ms.

0 Likes
Anonymous
Not applicable

problem have been resolved. software found that using wco and ilo in same counter, their time period different much. hardware check its circurt and fix it.

now the ticks calculated match with the waveform.

thanks.

0 Likes
Anonymous
Not applicable

The ILO timer is very inaccurate I believe, but good that you got it working for your case.

0 Likes