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.

AM335X SYS/BIOS 6.35.4.50 Timer Oneshot API operation

Other Parts Discussed in Thread: SYSBIOS, AM3359

I am trying to use the Timer module of Sys/Bios 6.35.4.50 for the AM335X in CCS613 to create a triggerable oneshot timer delay function.  The project compiles and runs but I cannot seem to get the timer function to trigger.  If I change the Bios Timer config to continuous, the timer does trigger continuously and my callback function is called OK.  But if I set the timer property to oneshot then call Timer_start() it does not trigger.  I saw a reference to a Timer_trigger() API function, which compiles but crashes. and there is no Help on this in the API reference.  Also, the ARM Bios API reference lists no Timer_trigger() function.  So what is the correct way to use a Bios timer as a oneshot and trigger it from within a HWI() ISR function?  There is very little help available it seems on this Timer module.

  • Which Timer module are you using? Can you share the code you are using to configure the one shot timer?
    Timer_trigger() is an API used only internally for test purposes.

    Here is an example of a statically configured one shot timer that will invoke 'myIsr' 50ms after Timer_start() has been called:

    var Timer = xdc.useModule('ti.sysbios.timers.dmtimer.Timer');
    var timerParams = new Timer.Params();
    timerParams.runMode = Timer.RunMode_ONESHOT;
    timerParams.periodType = Timer.PeriodType_MICROSECS;
    timerParams.period = 50000; /* 50 ms */
    timerParams.startMode = Timer.StartMode_USER;
    Timer.create(-1, '&myIsr', timerParams);

    Alan
  • Thanks, Alan. I am using the Sys/Bios GUI to configure timer, so I have no init code, in the GUI I selected timer 4 and oneshot mode and 1000 microsecond duration. Then Timer_start(timerid) is the only timer function call I use in the code, but my callback function does not get invoked, but if I select continuous mode for the timer in the Bios GUI it will be invoked. My question is if Timer_start() is the correct function to trigger a oneshot timer. There are 8 possible timers in the GUI dropdown box, some will result in compile time errors, but #4 did not, so I used it. I am not explicitly using any timer code, just BIOS. This is an EtherCat AM3359 application with BIOS 6.35 and SDK 1.1.0.1
  • Timer_start(Timer_Handle timerHandle) is the correct API to start the timer. Your code seems to be passing the timer ID (i.e. 4) rather than the timer handle to Timer_start().

    Alan

  • I am passing the name of the Timer in the BIOS cfg page 'Handle' field to the Timer_start() function

    I would paste a screen shot but I cant find the attachment button here and the paste from Word button wont do a Powerpoint slide

    so here are the fields in the Bios GUI:

    Handle:  TIMER_SSR

    Timer ISR function:  timer_ssr_callback

    Timer ID: 4

    Period: 1000  (microseconds)

    Start mode: timer will be started by user

    Run mode: one-shot

    then in my code:

    HWI_interrupt_ISR(void)

    {

    GPIOPinIntClear(SOC_GPIO_0_REGS, GPIO_INT_LINE_1, 0); //clear int flag

    Timer_start(TIMER_SSR);  //1ms delay from trigger interrupt

    }

    void timer_ssr_callback(void)

    {

    //trigger SSR control, 1ms from interrupt

    }

    Anyway, I guess I will give up on using the Bios cfg gui and do it the painful manual way as you suggest

  • Your GUI settings look correct to me. And your use of Timer_start() also seems correct. Are you sure you're getting the interrupt that invokes HWI_interrupt_ISR()? If you set a breakpoint at 'HWI_interrupt_ISR' do you get there as expected?
  • WIth those GUI settings, what content is inserted into the .cfg file? You can see the .cfg text file by clicking on the 'cfg Script' tab at the lower left corner of the GUI window. The new Timer content should be somewhere near the bottom of that text file.
  • Thanks, I used the discrete commands to setup the Timer and it works OK now. It is possible my program had some code interfering with the timer configuration set by the BIOS, as there was already some discrete timer command code in the application I was not aware of.