Tool/software: TI-RTOS
Hi expert,
Customer has a question about CLOCK module in SYS/BIOS.
Hardware:TMS320C6747,50M crystal,DSP run in 300M;
Software:CCS5.5,SYS/BIOS 6.37.5.35,XTOOLS 3.25.6.96
BIOS enable CLOCK、TIMER、TimeStamp,and make sure the input frequency of Timer0/Timer1 is 50M,create a clock before BIOS is boot
Error_init(&eb);
Clock_Params_init(&clkParams);
clkParams.period = 5;
clkParams.startFlag = false;
gs_clk = Clock_create(ClockSwiHandler, 100, &clkParams, &eb);
Assert(NULL != gs_clk);
When this clock start by Clock_start(), use UART to get the TimeStamp for each time it run, and found the time gap isn't the setting 5ms, it's almost 5.005ms.
------------------------------------------------------------------------------------------------------
When using the HWI in Timer1_34 to do the same process.
void timer1_setup(void)
{
static const uint32_t TIMER_PERIOD12 = 50000000u/1000u - 1u;
static const uint32_t TIMER_PERIOD34 = 50000000u/200u - 1u;
tmr1Regs->TCR = 0;
tmr1Regs->TGCR = 0;
tmr1Regs->TGCR |= 0x04;
tmr1Regs->TGCR |= 0x03;
tmr1Regs->PRD12 = TIMER_PERIOD12;
tmr1Regs->TIM12 = 0;
tmr1Regs->PRD34 = TIMER_PERIOD34;
tmr1Regs->TIM34 = 0;
tmr1Regs->TCR &= ~0x1000100;
tmr1Regs->TCR |= 0x800080;
}
This setting can produce the setting time gap.
When the period don't minus 1:
static const uint32_t TIMER_PERIOD12 = 50000000u/1000u
static const uint32_t TIMER_PERIOD34 = 50000000u/200u;
...
The effort is same with CLOCK module in SYS/BIOS.
So is the CLOCK module in SYS/BIOS need minus 1 when configurated it ?
Thanks,
Wesley.