This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

How to reset RTI counter interface

Other Parts Discussed in Thread: HALCOGEN

Hello,

in my project I'm using an RM48 and I have to reset the RTI counter when an external interrupt occurred. So I perform the follow istruction (using the HALCoGen generated code):

            rtiStopCounter(rtiCOUNTER_BLOCK1);
            while(!rtiResetCounter(rtiCOUNTER_BLOCK1));
            rtiSetPeriod(rtiCOMPARE1, Period);
            rtiStartCounter(rtiCOUNTER_BLOCK1);

The problem is that the free running counter is set to 0 (and the compare register rtiREG1->CMP[compare].UDCPx to the period time), but the Comp1 register remains to the old value. This means that when no external interrupt occurres the the RTI counter match the compare in a very long time corresponding to Comp1.

How can I do to Reset the RTI counter???

Thanks in advance,

Antonio

  • Antonio,

    Your post has been forwarded to the HALCogen team. In the mean time, Can you write your own code to reset the compare register using the header file provided by HALCogen? You should be to write a new value into the compare register.

    Thanks and regards,

    Zhaohong

  • i've customized the function:

    void rtiSetPeriod(uint32 compare, uint32 period)
    {
    /* USER CODE BEGIN (19) */
        period=period*100000;
    /* USER CODE END */

        rtiREG1->CMP[compare].UDCPx = period;

        /**   @note The function rtiInit has to be called before this function can be used.\n
        *           This function has to be executed in privileged mode.\n
        *           When the corresponding counter block is not stopped,\n
        *           the period will change on the next compare match of the old period.
        */

    /* USER CODE BEGIN (20) */
        /** - Setup compare 1 value. This value is compared with selected free running counter. */
        rtiREG1->CMP[compare].COMPx = period;
    /* USER CODE END */
    }

    and I call this function after the rtiResetCounter:

                /* Reset TimeOut Counter */
                rtiStopCounter(rtiCOUNTER_BLOCK1);
                while(!rtiResetCounter(rtiCOUNTER_BLOCK1));
                rtiSetPeriod(rtiCOMPARE1, TimeOutPeriod);
                rtiStartCounter(rtiCOUNTER_BLOCK1);

    but after few hours of running the code, I see an ECC RAM error. Where can I contact the HalCoGen team?

  • Giacomantonio,

    RAM ECC error has nothing to do with RTI. There must be other issues in your software. To enable RAM ECC, you need to (1) do a RAM initialization and (2) enable ECC for BTCM port using CP15 registers before any RAM access.

    Thanks and regards,

    Zhaohong

  • After about one hour of running in debug mode, the following error occurred:

    without the RTI counters the code running without any problems.

    Thanks in advance for the help.

    Giacomantonio