Timer RJ unit


I am using R5F10BGG microcontroller, I want to run the Timer RJ unit at lower frequency of 15K HZ. I configured the register which is generated through the Applilet by selecting the mode-->count mode, frequency FIL at 1ms. Now if I integrate with my project, I am not getting interrupt which is suppose to give interrupt after TRJ0 register under flows  . If I run the timer RJ at FCKL (main On Chip Clock) clock it is generating the interrupt at 1ms. So what would be the reason for this (which is not giving interrupt at FIL) please suggest.


Rahut Patil

  • Which tools (incl. versions) do you use?
    Do you see that timer RJ runs after you change the count source?
    Do you see timer RJ interrupt request?
  • tool -->IAR,
    --> by changing the count source the timer RJ unit is not counting (it's count is not decrements)
    --> No I am not getting the interrupt.
  • please refer the user manual hardware of f13/f14 it is WUTMMCK0 = 0 ,and sellosc is selection of clock that is required for operation of clock
  • Then why I am not getting the interrupt at FIL....?

    Best Regards,
    Rawootray Patil.
  • did u do the above setting WUTMMCK0 = 0
  • Which manual do you use?

    My manual (V.2.10, R01UH0368EJ0210, page 417) says WUTMMCK0 is "1" for low-sped on-chip oscillator on.


    And it says that WUTMMCKO and SELLOSC both have to be set to "0" to stop the low-speed on-chip oscillator.

  • I found that chapter 5 (clock generator) and chapter 7 (timer RJ) have different descriptions of OSMC.
    But if SELLOSC=1 the setting of OSMC does not matter. It always works.

    This code worked for me (generated by Applilet):
    void R_CGC_Create(void)
    /* Set fSL */
    SELLOSC = 1U;
    /* Set fMX */
    MSTOP = 1U;
    /* Set fMAIN */
    MCM0 = 0U;
    /* Set fMP to clock through mode */
    SELPLL = 0U;
    /* Set fSUB */
    XTSTOP = 1U;
    /* Set fCLK */
    CSS = 1U;

    while (CLS == 0U)

    /* Set fIH */
    HIOSTOP = 0U;
    /* Set RTC clock source */
    RTCCL = _80_CGC_RTC_FIH | _42_CGC_RTC_DIV122;
    /* Set Timer RD clock source to fSL */
    TRD_CKSEL = 1U;

    void R_TMR_RJ0_Create(void)
    SELLOSC = 1U; /* Set fSL */
    TRJ0EN = 1U; /* enable input clock supply */
    TRJCR0 &= (uint8_t)~ 0x01; //_01_TMRJ_COUNT_START; /* disable TMRJ0 operation */
    TRJMK0 = 1U; /* disable INTTRJ0 interrupt */
    TRJIF0 = 0U; /* clear INTTRJ0 interrupt flag */
    /* Set INTTRJ0 low priority */
    TRJPR10 = 1U;
    TRJPR00 = 1U;
    TRJ0 = 0x05DB; //_05DB_TMRJ_TRJ0_VALUE;

    void R_TMR_RJ0_Start(void)
    TRJIF0 = 0U; /* clear INTTRJ0 interrupt flag */
    TRJMK0 = 0U; /* enable INTTRJ0 interrupt */
    TRJCR0 |= 0x01; //_01_TMRJ_COUNT_START; /* enable TMRJ operation */
  • Hi all,

                    Now I am able to get the interrupt at every 1ms after executing the stop mode.

    To run the timer RJ unit at low frequency when the  controller is in sleep mode, i have to enable the low frequency clock.

    i.e .need to configure the OSMC register to 0x10. to enable WUTMMCKO register.

           Datasheet--> r01uh0368ej0210_rl78f13_14.    In this refer page no. 385.

    void R_TMR_RJ0_Create(void)


             OSMC = 0x10;          // to enable low frequency clock

     TRJ0EN = 1U;    /* enable input clock supply */

     TRJCR0 &= (u8)~_01_TMRJ_COUNT_START;    /* disable TMRJ0 operation */

     TRJMK0 = 1U;    /* disable INTTRJ0 interrupt */

     TRJIF0 = 0U;    /* clear INTTRJ0 interrupt flag */

     /* Set INTTRJ0 low priority */

     TRJPR10 = 0U;

     TRJPR00 = 1U;



     TRJ0 = _000E_TMRJ_TRJ0_VALUE;


  • I got the confirmation from Renesas that the description in chapter 5 is correct. WUTMMCKO=1 to switch on low-speed on-chip oscillator.
  • Hi,

       Now i want to run my timer RJ unit in sleep mode after executing the STOP () function. I want to reduce controller's current consumption to micro Amp and parallely i want to run my timer RJ unit also. Now I am getting current reduction of only 3 mili Amp. i.e 23 mili Amp to 20 mili Amp.

    Best Regards,

    Rawootray Patil.

  • Hi,

    I want to run the controller RTC for 10days. How can i configure this in Applilet to generate the auto code. and for ten days counting, to which register I need to config and what value..?. Controller part no. is R5F10BGG.
  • Can you please create a new thread for this? It does not make sense to add a new discussion to the old thread, which has been finalised.
Reply Children
No Data