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.

No output for Timer 5 on DM8168

Hi,

I'm trying to configure Timer5 as PWM, but no signal is output on timer 5 pin.

my slice of code is:

#define    CM_ALWON_L3_SLOW_CLKSTCTRL    (*(volatile unsigned long *)0x48181400)
#define    CM_ALWON_SYSCLK4_CLKSTCTRL    (*(volatile unsigned long *)0x48181420)
#define    CM_ALWON_TIMER_5_CLKCTRL    (*(volatile unsigned long *)0x48181580)
#define    CM_TIMER5_CLKSEL        (*(volatile unsigned long *)0x481803A0)

#define PINCTRL203    (*(volatile unsigned long *)0x48140B28)
#define PINCTRL204    (*(volatile unsigned long *)0x48140B2C)
#define PINCTRL205    (*(volatile unsigned long *)0x48140B30)
#define PINCTRL206    (*(volatile unsigned long *)0x48140B34)

#define TIMER5BASE    ((volatile unsigned long *)(0x48046000))

#define    TLDR    (*(volatile unsigned long *)(((unsigned long)TIMER5BASE) + 0x40))
#define    TMAR    (*(volatile unsigned long *)(((unsigned long)TIMER5BASE) + 0x4C))
#define    TCLR    (*(volatile unsigned long *)(((unsigned long)TIMER5BASE) + 0x38))
#define    TTGR    (*(volatile unsigned long *)(((unsigned long)TIMER5BASE) + 0x44))
#define    IRQENABLE_CLR    (*(volatile unsigned long *)(((unsigned long)TIMER5BASE) + 0x30))
#define    TIOCP_CFG    (*(volatile unsigned long *)(((unsigned long)TIMER5BASE) + 0x10))


void setupTimer(void)
{
    CM_ALWON_SYSCLK4_CLKSTCTRL |= (1<<10); // enable L3 slow clock
    CM_ALWON_L3_SLOW_CLKSTCTRL |= (1<<24); // enable TIMER 5 clock
    CM_ALWON_TIMER_5_CLKCTRL = 0x00000002; // enable TIMER 5
    CM_TIMER5_CLKSEL = 0x00000002; // choose CLKIN 27MHz for TIMER 5
    
    // setting up pin multiplexer
    PINCTRL204 = 0x00000000;
    
    TIOCP_CFG = 1<<2; // no-idle
    IRQENABLE_CLR = 0x00000007; // disable interrupts
    TLDR = 1000;        // load register
    TMAR = 0xFFFFFFFF - 500;    // match register
    
    /* control register:
    PT = 1 (toggle)
    TRG = 2 (trigger on ovf and match)
    TCM = 0 (no capture)
    SCPWM = 0
    CE = 1 (Compare mode)
    PRE = 0 (no prescaler)
    PTV = 0
    AR = 1 (auto reload)
    ST = 1 (start timer)
    */
    TCLR = 0x00001843;    // control register
    TTGR = 1;    // TRIGGER
}

where am I wrong?

best regards