T1024 bare board code under debug and timebase ticks

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

T1024 bare board code under debug and timebase ticks

ソリューションへジャンプ
1,010件の閲覧回数
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 解決策
912件の閲覧回数
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 返答(返信)
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!
-----------------------------------------------------------------------------------------------------------------------

912件の閲覧回数
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 件の賞賛
返信
912件の閲覧回数
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 件の賞賛
返信