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.

OMAP L138 boot use TIMER0

Other Parts Discussed in Thread: OMAP-L138, CCSTUDIO

Dear,

I start the boot development on the OMAP L138 experimenter kit. I use data on the folder "OMAP-L138_FlashAndBootUtils_2_40'".

But I have a problem when I want to start the timer0.

I join 3 files with this message: device.c , device.h and uptate.c (not the complete file)

When I read the register INTCTLSTAT on TIMER0, the field PRDINSTAT12 = 0x00000002 when TIM12 and PRD12 when I see "View Memory" in CCStudio but when I test the value it equals 0.
Furthermore, when I try to clear the bit PRDINSTAT12 (write a 1 in this bit) it doesn't work.

An other point, I don't understand why the address of the define TIMER0 is 0x01C21400 while on the SPRS586D OMAP-L138 timer register start at:
0x01C20000
0x01C21000


Thanks a lot for your help and sorry for my english.

Bastien

----------------------------------------------------------------------------------------------------------------------------------------------------------

device.c

Uint32 DEVICE_TIMER0Init(void)
{
// Put timer into reset
TIMER0->EMUMGT_CLKSPD = 0x00000003;
TIMER0->TCR = 0x00000000;

// Setup as 2 unchained 32-bit timers
TIMER0->TGCR = 0x00000005;

// Reset timers to zero
TIMER0->TIM12 = 0x00000000;

// Set period to 5 sec
TIMER0->PRD12 = 0x019BFCC0;

TIMER0->INTCTL_STAT = 0x00000002; //clear the bit PRDINTSTAT12

return E_PASS;
}

void DEVICE_TIMER0Start(void)
{
// Put timer out in reset
TIMER0->TGCR &= ~(0x00000001);

// Reset the timer counter to zero
TIMER0->TIM12 = 0x00000000;

// Set for one-time run
TIMER0->TCR = 0x00000040;

// Take timer out of reset
TIMER0->TGCR = 0x00000005;
}

void DEVICE_TIMER0Stop(void)
{
// Put timer in reset
TIMER0->TCR = 0x00000000;
TIMER0->TGCR = 0x00000000;

// Reset timer count to zero
TIMER0->TIM12 = 0x00000000;
}

Uint32 DEVICE_TIMER0Status(void)
{
return TIMER0->INTCTL_STAT;
}

device.h

// Timer Register structure - See spruee5a.pdf for more details.
typedef struct _DEVICE_TIMER_REGS_
{
VUint32 PID12; // 0x00
VUint32 EMUMGT_CLKSPD; // 0x04
VUint8 RSVD0[8]; // 0x08
VUint32 TIM12; // 0x10
VUint32 TIM34; // 0x14
VUint32 PRD12; // 0x18
VUint32 PRD34; // 0x1C
VUint32 TCR; // 0x20
VUint32 TGCR; // 0x24
VUint32 WDTCR; // 0x28
VUint8 RSVD1[12]; // 0x2C
VUint32 REL12; // 0x34
VUint32 REL34; // 0x38
VUint32 CAP12; // 0x3C
VUint32 CAP34; // 0x40
VUint32 INTCTL_STAT; // 0x44
}
DEVICE_TimerRegs;

#define TIMER0 ((DEVICE_TimerRegs*) 0x01C21400)


uptate.c

do
{
DEVICE_TIMER0Init();
DEVICE_TIMER0Start();
while (DEVICE_TIMER0Status() != 2)
{
UART_sendHexInt(hUartInfo, DEVICE_TIMER0Status()); // send the value of the PRDINTSTAT12 for debug
}
UART_sendString(hUartInfo, delocRdy, TRUE);
}