MTU2 external clock

I am unsuccessfully trying to use timer 1 to count from an external clock.

I am using RSK + 62N (R0K5562N0C000BE) as a development platform.

A 1kHz external clock connects to P24 MTCLKA-A. (JP22 link to MTIOCAA-A, connector TFT pin 27)


MSTP( MTU1 ) = 0;                /* MTU1 out of standby */

MTUA.TSTR.BIT.CST0 = 1; /* Mtu1 stop */

MTU1.TCR.BIT.CCLR = 1;   /* TCNT cleared by TGRA */


MTU1.TCR.BIT.CKEG = 0;   /* Count at rising edge */

MTU1.TCR.BIT.TPSC = 4;   /* External clock: TCLKA pin input */

MTU1.TMDR.BIT.MD = 2;   /* MTU1 mode: PWM mode 1 */

MTU1.TGRA  = 0x100;

MTU1.TGRA  = 0x080;

MTUA.TSTR.BIT.CST1 = 1; /* Mtu1 start */

MTU1.TCNT does not count 

If I change MTU1.TCR.BIT.TPSC = 1; the timer counts.

If I check PORT2.PORT.B4 I can see a level change from the external clock.


Is there another register setting apart from TPSC to make P24 the MTCLKA-A input?






  • Hi,

    Have you configured P24 pin working as MTCLKA-A function in PFCMTU register and I/O register?
  • In reply to Toan Tran:

    Hi Toan,

    The PTCMTU default setting is to select P24 as MTCLKA-A.

    The missing setting is:

    PORT2.ICR.BIT.B4 = 1;      /* P24 as peripheral function input */

    The description of this setting is in section 17.1.3 of the Group Hardware Manual but is not cross references in other sections.


    Thanks for your help.

  • This thread will be archived due to inactivity

    Mike Clements
    RenesasRulz Moderator