lpcware

RIT timer intervall

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by inspire on Thu Jun 07 04:25:45 MST 2012
hi,

I've got some problems with the RIT timer interval.

The interrupts are generated not with the desired frequency.
E.g. interrupt interval of 10 seconds is required.


    uint32_t TimerInterval = 10000; // 10 seconds
   
    /* By default, the PCLKSELx value is zero, thus, the PCLK for
     all the peripherals is 1/4 of the SystemFrequency. */
    /* Bit 26~27 is for RIT_TIMER */
    pclkdiv = (LPC_SC->PCLKSEL1 >> 26) & 0x03;
    switch (pclkdiv) {
    case 0x00:
    default:
        pclk = SystemCoreClock / 4;
        break;
    case 0x01:
        pclk = SystemCoreClock;
        break;
    case 0x02:
        pclk = SystemCoreClock / 2;
        break;
    case 0x03:
        pclk = SystemCoreClock / 8;
        break;
    }

    LPC_RIT->RICOMPVAL = (pclk / TimerInterval) - 1;
But the interrupts don't follow the 10 seconds, they occur too fast.

You've got a hint for me?

Thanks in advance.

Outcomes