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.

Initializing Timer4 from GEL file (DM8168)

Hi,

starting from GEL file provided by spetrum digital I made some small additions:


#define TIMER4_PERIPHERAL_REGS_BASE    0x48044000 
#define TIMER4_SUPPORT_REGS_BASE    0x48045000
 
#define TIMER4_REGS_BASE        TIMER4_PERIPHERAL_REGS_BASE
 
#define    TIMER4_TIDR            ( TIMER4_REGS_BASE + 0x00 )
#define    TIMER4_TIOCP_CFG        ( TIMER4_REGS_BASE + 0x10 )
#define    TIMER4_IRQ_EOI            ( TIMER4_REGS_BASE + 0x20 )
#define    TIMER4_IRQSTATUS_RAW        ( TIMER4_REGS_BASE + 0x24 )
#define    TIMER4_IRQSTATUS        ( TIMER4_REGS_BASE + 0x28 )
#define    TIMER4_IRQENABKE_SET        ( TIMER4_REGS_BASE + 0x2C )
#define    TIMER4_IRQENABKE_CLR        ( TIMER4_REGS_BASE + 0x30 )
#define    TIMER4_IRQWAKEEN        ( TIMER4_REGS_BASE + 0x34 )
#define    TIMER4_TCLR            ( TIMER4_REGS_BASE + 0x38 )
#define    TIMER4_TCRR            ( TIMER4_REGS_BASE + 0x3C )
#define    TIMER4_TLDR            ( TIMER4_REGS_BASE + 0x40 )
#define    TIMER4_TTGR            ( TIMER4_REGS_BASE + 0x44 )
#define    TIMER4_TWPS            ( TIMER4_REGS_BASE + 0x48 )
#define    TIMER4_TMAR            ( TIMER4_REGS_BASE + 0x4C )
#define    TIMER4_TCAR1            ( TIMER4_REGS_BASE + 0x50 )
#define    TIMER4_TSICR            ( TIMER4_REGS_BASE + 0x54 )
#define    TIMER4_TCAR2            ( TIMER4_REGS_BASE + 0x58 )
 
#define PINCTRL203             ( 0x48140B28 )
 
/* ------------------------------------------------------------------------ *
*  StartUp_Timer( )                                                        *
 *      Setup Timer 4                                                     *
 *                                                                          *
 * ------------------------------------------------------------------------ */
StartUp_Timer()
{
    int TMAR_val = 0x00000010;
    int TLDR_val = 0xFFFFFFFF - 0x00000020 + 1;
    int TCLR_val = 0x00001803;
    int PINCTRL203_val = 0x00000000;

    GEL_TextOut( "Timer4 init...\n" );

 
    GEL_TextOut("\tWrite TMAR %x ",,,,,TMAR_val);
    WR_MEM_32(TIMER4_TMAR, TMAR_val);
    
    GEL_TextOut( "\tWrite TLDR %x ",,,,,TLDR_val);
    WR_MEM_32(TIMER4_TLDR, TLDR_val);
    
    GEL_TextOut( "\tWrite TCLR %x ",,,,,TCLR_val);
    WR_MEM_32(TIMER4_TCLR, );
    
    GEL_TextOut( "\tWrite PinControl203 %x ",,,,,PINCTRL203_val);
    WR_MEM_32(PINCTRL203, PINCTRL203_val);
    
    GEL_TextOut( "Timer4 init done\n" );
}

My hope was that there was a PWM signal on pin H33 (TIMER4).

Unfortunately pin H33 doesnt move. I also tried to move this pin "by hand", toggling bit GPO_CFG of TCLR



StartUp_Timer() 
{
    GEL_TextOut( "Timer4 init...\n" );
    
    GEL_TextOut( "Timer4 loop...\n" );
    while(1)
    {
        WR_MEM_32(TIMER4_TCLR, 0x00004000);
        WR_MEM_32(TIMER4_TCLR, 0x00000000);
    }
}

but also in this case nothing happens.

where am I wrong?

best regards