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.

DRA724: Reading timer handler parameters

Part Number: DRA724
Other Parts Discussed in Thread: SYSBIOS

Hello, 

I have initialized clock in following way:

============================================================

Clock_Params Eth_Phy_Clock_Params;
Error_Block eb_phy_clock;

Error_init(&eb_phy_clock);
Clock_Params_init(&Eth_Phy_Clock_Params);
Eth_Phy_Clock_Params.period = 1000;
Eth_Phy_Clock_Params.arg = 0x5555;
Eth_Phy_Clock_Params.startFlag = FALSE;
Eth_Phy_Clock_Handle = Clock_create(Phy_Clock_Swi, 10, &Eth_Phy_Clock_Params, &eb_phy_clock);
============================================================
This clock is based on timer3. Clock and timers are set up in cfg file:
============================================================
/***********************************************
* CLOCK Module Configuration *
***********************************************/
var Clock = xdc.useModule("ti.sysbios.knl.Clock");
Clock.tickMode = Clock.TickMode_PERIODIC;
Clock.tickSource = Clock.TickSource_USER;

/***********************************************
* Timer Module Configuration *
***********************************************/
var Timer = xdc.useModule('ti.sysbios.timers.dmtimer.Timer');
/* allocate timer 3 for Clock, timer 4 for DoRIS and 11 for DMTimestamp to IPU2 */
var TimerSupport = xdc.useModule('ti.sysbios.family.shared.vayu.TimerSupport');
TimerSupport.availMask = 0x040C;

var timerParams = new Timer.Params();
timerParams.period = 1000;
timerParams.twer.ovf_wup_ena = 1;
timerParams.tiocpCfg.emufree = 1;
timerParams.tiocpCfg.idlemode = 1;
timerParams.tsicr.posted = 0;
Timer.intFreqs[2].hi = 0;
Timer.intFreqs[2].lo = 20000000;
Timer.checkFrequency = false;
Timer.create(2, '&mainIPU2_TimerTick', timerParams);
============================================================
I want to make sure, that parameters of Timer3 won't be changed dynamically somewhere else in the program and frequency of my clock won't change also.
Here is the function, which checks whether the timer parameters has changed.  I am using timer and clock API functions int one place. It is causing errors.

============================================================

void Eth_Diag_Check_Timer_Params(void)
{

Timer_Handle timer_handle = (Timer_Handle)Clock_getTimerHandle();
Types_FreqHz freq;
uint32_t period = Timer_getPeriod(timer_handle);
Timer_getFreq(timer_handle, &freq);

if (period != TIMER3_PERIOD || freq.lo != TIMER3_FREQUENCY)
{
UTILS_assert(FALSE);
}
}
============================================================
without casting Clock_getTimerHandle() output to Timer_Handle type I am getting 
error: a value of type "ti_sysbios_knl_Clock_TimerProxy_Handle" cannot be used to initialize an entity of type "ti_sysbios_hal_Timer_Handle" 
during compilation.
When I do the casting in the code M4 is crashing during execution with following output on A15 terminal.

[HOST] [IPU2 ] 12.864789 s:
[HOST] [IPU2 ] 12.864820 s: ### XDC ASSERT - ERROR CALLBACK START ###
[HOST] [IPU2 ] 12.864881 s:
[HOST] [IPU2 ] 12.865033 s: E_hardFault: FORCED
[HOST] [IPU2 ] 12.865094 s:
[HOST] [IPU2 ] 12.865125 s: ### XDC ASSERT - ERROR CALLBACK END ###
[HOST] [IPU2 ] 12.865186 s:
[HOST] [IPU2 ] 12.865399 s:
[HOST] [IPU2 ] 12.865460 s: ### XDC ASSERT - ERROR CALLBACK START ###
[HOST] [IPU2 ] 12.865521 s:
[HOST] [IPU2 ] 12.865643 s: E_busFault: PRECISERR: Immediate Bus Fault, exact addr known, address: 119395cc
[HOST] [IPU2 ] 12.865735 s:
[HOST] [IPU2 ] 12.865765 s: ### XDC ASSERT - ERROR CALLBACK END ###
[HOST] [IPU2 ] 12.865826 s:
============================================================
How can I get timer handler and read its parameters not to crash M4?
Thanks in advance
Jan Gorecki
  • Hi Jan,

    which SDK you use?

    Regards,

    Yordan

  • Hello,

    I am using VSDK with sys_bios 6.46.06 and ndk 2.25.01.11.

    Best regards,
    Jan

  • Hi Jan,

    When you set Clock as below, it is not associated with timer so you shouldn't call Clock_getTimerHandle(), which will return uninitialized value.

    Clock.tickSource = Clock.TickSource_USER;

    Clock will be triggered by calling Clock_tick(), which is called inside mainIPU2_TimerTick().

    mainIPU2_TimerTick() is triggered by GP Timer 3 based on your configuration below.

    Timer.create(2, '&mainIPU2_TimerTick', timerParams);

    Since GPTimer 3 is set to interrupt every 1ms, Clock will tick at 1ms rate.

    As for the question "that parameters of Timer3 won't be changed dynamically somewhere else in the program and frequency of my clock won't change also."...

    SYSBIOS will setup Timer 3 based on your configuration during BIOS init. Other than that, SYSBIOS will not change the configuration again during run-time.

    However, you have to make sure that, on A15 which is running Linux, timer 3 is excluded from Linux usage so application on A15 won't use Timer 3.

    Regards,

    Stanley

  • Hi Stanley, 

    Thank you for your answer.