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.

Timer_create causes reset to main()

Other Parts Discussed in Thread: SYSBIOS

Hello,

I'm trying to create a timer-based function that repeats every 250 useconds.  But it keeps resetting to main(), when making the Timer_create call.  Any suggestions on what might be causing that, or how to debug it, would be appreciated.  The code and revisions are below.

Regards,

Robert

 

int16_t init_timer( void )
{
     Timer_Params timer_params;

      Timer_Params_init( &timer_params );

      timer_params.period = 250;

      timer_params.periodType = Timer_PeriodType_MICROSECS;

      Timer_create( 0, (ti_sysbios_interfaces_ITimer_FuncPtr)irq_timer, &timer_params, NULL );

      return 0;
}

ti_sysbios_interfaces_ITimer_FuncPtr irq_timer( void )
{
      return 0
}


IPC 1.22.3.23

SYS/BIOS 6.31.4.27

XDAIS 6.23

XDC 3.20.7.86

  • Robert,

    By passing EB=NULL, the create function will not return, so I'm thinking that the memory alloc call may be vectoring an abort.  Passing in an actual eb parameter might help you debug this in terms of handling the error condition more sanely, plus giving you additional error information.

    Another possibility is the timer ID is not valid.  What device are you using?

    Dave

  • Thanks for the reply (my apologies ... didn't see it until just now).

    I changed the Timer_create() call to use eb, and it doesn't crash anymore.  But the timer is not working.  Please see the code listed below., and the resulting eb structure result.  Seems that it's an invalid id?  Is 0 the SYS/BIOS tick timer, so can't be used?

    Regards,

    Robert

    ---------------------------------------------------------------------- code -----------------------------------------------------------------------------------------


    ti_sysbios_interfaces_ITimer_FuncPtr irq_timer_acq( void );

    int16_t i_timer( void )
    {
         Timer_Params timer_params;

         Error_Block eb_timer;

         Error_init( &eb_timer );

         Timer_Params_init( &timer_params );

         timer_params.period = 250;

         timer_params.periodType = Timer_PeriodType_MICROSECS;

         timer_params.startMode = Timer_StartMode_AUTO;

         timer_params.runMode = Timer_RunMode_CONTINUOUS;

         Timer_create( 0, (ti_sysbios_interfaces_ITimer_FuncPtr)irq_timer_acq, &timer_params, &eb_timer );

         return 0;
    }


    ti_sysbios_interfaces_ITimer_FuncPtr irq_timer_acq( void )
    {
        return 0;
    }

     

    ------------------------------------------------------------------ eb result ----------------------------------------------------------------



    eb_timer = {...}
    unused = 0
    data = {...}
    id = 194641920
    msg = 0xC1011D52 "E_notAvail"
    site = {...}
    xtra = 0xC1013DD8

  • changing the id from 0 to 1 in the Timer_create() call resulted in the following eb:

    eb_timer = {...}
    unused = 0
    data = {...}
    id = 0
    msg = Memory map prevented reading of target memory at 0x00000000
    site = {...}
    xtra = 0xC1013DD8

  • This looks correct to me. Timer id 0 was in use (probably by the Clock module). Timer id 1 is available and therefore the returned EB showed no errors.

  • Ok, it does appear to be working properly now, configured as Timer id 1.  The eb msg = Memory map prevented reading of target memory at 0x00000000 initially threw me off, thinking it still had not configured correctly.

    Thanks,

    Robert