Quantcast
Channel: Processors forum - Recent Threads
Viewing all articles
Browse latest Browse all 17527

Problem while configuring Timer 0

$
0
0

Hi,

I'm using the Tiner 0 on the OMAP L138 chip.I'm using the C6748 chip alone (stand alone mode).I'm using the timer in the 32 bit unchained mode.I configured the timer to operate every 2 secs.I also mapped the timer interrupt to GPIO Bank 1, Pin 10.With the 2 sec configuration , I was able to observe the pulse on the Oscilloscope.When I put breakpoints within the ISR it hit at that line of code.

How ever when  I reduced the the timer period to 625 us, I was not able to observe any pulse.When I put breakpoints within the timer ISR it did not hit at that line of code.Iam getting a message like this No source available for "UTL_halt() at 0x11803c28" .

I'm using the XDS100v2 JTAG emulator.

This is the piece of code for the timer 0

#include"OMAP_Timer.h"
#include"Filter_Developmentcfg.h"

#define DISABLE_INTR_MASK (0x00000000)
#define ENABLE_INTR_MASK (0x00000080)

#define INTRMUXREG1 (volatile unsigned int *)(0x01800104)
#define INTRMUXREG2 (volatile unsigned int *)(0x01800108)
#define INTRMUXREG3 (volatile unsigned int *)(0x0180010C)

#define TIMER0_34EVENT (0X40000000)

void HDW_Intr_Initialise()
{
HWI_enable();
C62_disableIER(DISABLE_INTR_MASK);
C62_enableIER(ENABLE_INTR_MASK);

*(INTRMUXREG1) = TIMER0_34EVENT;

}


/*-------------------------Timer0 Registers-------------------------*/

#define Timer0_REVID (volatile unsigned int *)(0x01C20000)
#define Timer0_EMUMGT (volatile unsigned int *)(0x01C20004)
#define Timer0_GPINTGPEN (volatile unsigned int *)(0x01C20008)
#define Timer0_GPDATGPDIR (volatile unsigned int *)(0x01C2000C)
#define Timer0_TIM12 (volatile unsigned int *)(0x01C20010)
#define Timer0_TIM34 (volatile unsigned int *)(0x01C20014)
#define Timer0_PRD12 (volatile unsigned int *)(0x01C20018)
#define Timer0_PRD34 (volatile unsigned int *)(0x01C2001C)
#define Timer0_TCR (volatile unsigned int *)(0x01C20020)
#define Timer0_TGCR (volatile unsigned int *)(0x01C20024)
#define Timer0_WDTCR (volatile unsigned int *)(0x01C20028)
#define Timer0_REL12 (volatile unsigned int *)(0x01C20034)
#define Timer0_REL34 (volatile unsigned int *)(0x01C20038)
#define Timer0_CAP12 (volatile unsigned int *)(0x01C2003C)
#define Timer0_CAP34 (volatile unsigned int *)(0x01C20040)
#define Timer0_INTCTLSTAT (volatile unsigned int *)(0x01C20044)
#define Timer0_CMP0 (volatile unsigned int *)(0x01C20060)
#define Timer0_CMP1 (volatile unsigned int *)(0x01C20064)
#define Timer0_CMP2 (volatile unsigned int *)(0x01C20068)
#define Timer0_CMP3 (volatile unsigned int *)(0x01C2006C)
#define Timer0_CMP4 (volatile unsigned int *)(0x01C20070)
#define Timer0_CMP5 (volatile unsigned int *)(0x01C20074)
#define Timer0_CMP6 (volatile unsigned int *)(0x01C20078)
#define Timer0_CMP7 (volatile unsigned int *)(0x01C2007C)

/*-----------------------------------------------------------------*/

#define CLEAR_REG (0x00000000)

/*---------------------TGCR REG ENABLE MACRO-----------------------*/

#define ENABLE_TIM34RS (0x00000002)
#define ENABLE_TIMMODE_32UC (0x00000004)
#define ENABLE_PS_COUNT16 (0x00000F00)
/*-----------------------------------------------------------------*/

/*------------------------PRD REG MACRO----------------------------*/
#define MODE34_PRD_2S (0x002DC6C0) //2 SECS
#define MODE34_PRD_1S (0x0016E360) //1 SECS
#define MODE34_PRD_1_2S (0x000B71B0) //0.5 SECS
#define MODE34_PRD_625uS (0x000003AA) //625 uSECS
#define MODE34_PRD_250uS (0x00000177) //250 uSECS
/*-----------------------------------------------------------------*/

/*------------------------TCR REG MACRO-----------------------------*/
#define ENAMODE34_CONT (0x00800000)
/*------------------------------------------------------------------*/

/*-----------------------INTCTLSTAT REG MACRO-----------------------*/
#define ENABLE_INT34 (0x00010000) //PRDINTEN34 BIT
/*------------------------------------------------------------------*/

/*-----------------------GPIO_01 REG MACRO-------------------------*/

#define GPIOBANKDIRECTION_01 (volatile unsigned int *)(0x01E26010)
#define GPIOBANKOUTPUT_01 (volatile unsigned int *)(0x01E26014)
#define GPIOSETDATA_01 (volatile unsigned int *)(0x01E26018)
#define GPIOCLRDATA_01 (volatile unsigned int *)(0x01E2601C)

/*------------------------------------------------------------------*/

/*-----------------------PIN MEX REGISTER---------------------------*/
#define PINMUXREG_02 (volatile unsigned int *)(0x01C14128)
/*------------------------------------------------------------------*/

/*----------------------BANK 1 PIN 10 MACRO--------------------------*/

#define PINMUX02_SEL_GPIO (0x00400000)
#define GPIO_01_BANK1PIN10_SET (0x04000000)
#define GPIO_01_BANK1PIN10_CLR (0xFBFFFFFF)
/*------------------------------------------------------------------*/
/**/

void Timer_Register_Clear()
{

*(Timer0_TGCR) = (CLEAR_REG);
*(Timer0_PRD34) = (CLEAR_REG);
*(Timer0_TCR) = (CLEAR_REG);
*(Timer0_INTCTLSTAT) = (CLEAR_REG);

}

void Timer_Initialize()
{
Timer_Register_Clear();

*(Timer0_TGCR) = (ENABLE_PS_COUNT16|ENABLE_TIMMODE_32UC|ENABLE_TIM34RS);
*(Timer0_PRD34) = (MODE34_PRD_625uS);
*(Timer0_TCR) = (ENAMODE34_CONT);
*(Timer0_INTCTLSTAT) = (ENABLE_INT34);

}

void GPIO_Initialize()
{
*(PINMUXREG_02) = PINMUX02_SEL_GPIO;
*(GPIOBANKDIRECTION_01) = *(GPIOBANKDIRECTION_01) & (0x01FFFFFF);
}

void Timer0_ISR()
{
int i;
*(GPIOBANKOUTPUT_01) = GPIO_01_BANK1PIN10_SET;
for(i=0;i<10;i++);
*(GPIOBANKOUTPUT_01) = GPIO_01_BANK1PIN10_CLR;
for(i=0;i<10;i++);
HWI_enable();
}


Viewing all articles
Browse latest Browse all 17527

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>