T1024 bare board code under debug and timebase ticks

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

T1024 bare board code under debug and timebase ticks

跳至解决方案
1,011 次查看
eduardkromskoy
Contributor II

Hi,

I am trying to get some timebase ticks in "hello word" example of bare board CW project on T1024 board. 

Init_sram.tcl has following lines

[code]

# enable all cores in Boot Release Register (BRRL)
mem [CCSR_ADDR 0xe00e4] = 0x00000003

# enable timebases
mem [CCSR_ADDR 0xe2084] = 0x00000003

[/code]

However, when I read SPRN_TBRL I seems always get 0. That is

register uint32_t tic;

asm volatile("mfspr %0, 0x10c" : "=r" (tic));

tic is always 0. Did I miss something? How to make more or less precise timing in code running under debugger?

Thank you,

Ed

0 项奖励
回复
1 解答
913 次查看
Pavel
NXP Employee
NXP Employee

See attached simple example for timebase. It is CodeWarrior 10.5.1 project for the T1024RDB board.

Find the sl1_tbu and sl1_tbl variables in main.c file.

 

Have a great day,
Pavel Chubakov

 

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

在原帖中查看解决方案

3 回复数
914 次查看
Pavel
NXP Employee
NXP Employee

See attached simple example for timebase. It is CodeWarrior 10.5.1 project for the T1024RDB board.

Find the sl1_tbu and sl1_tbl variables in main.c file.

 

Have a great day,
Pavel Chubakov

 

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

913 次查看
eduardkromskoy
Contributor II

Hi Pavel.

Indeed I missed Physical Core Time Base Enable Register (RCPM_PCTBENR). Added function 

void timebase_init(void)
{
unsigned int m_gpr = 0;
volatile uint32_t *a = (uint32_t *)(SYS_IMMR + 0xE2000 + 0x1A0);

mtspr(285, m_gpr);
mtspr(284, m_gpr);

*a = 1;
}

Everything work as expected now. Time base registers are more convenient for my tasks as they run at 50Mhz clock as opposed to Alternate time base registers which run at 1200MHz core clock.

Thank you very much,

Ed

0 项奖励
回复
913 次查看
eduardkromskoy
Contributor II

Ok, It might be closed. I am reading Alternate time base registers which are available  at SPR 526, 527. Seems to run at core speed and freeze when debugger suspend code execution.

Thanks for inspiration.

Ed

0 项奖励
回复