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 won't start

Other Parts Discussed in Thread: SYSBIOS

Hi all,

I'm trying to create a timer with sysbios 6 (6.32.05.24) with the LogicPD SOM OMAP l138. I want to create a timer that will call a function every 1us. I will use this function to create a delay in us.

var ADC_timerParams = new Timer.Params();
ADC_timerParams.instance.name = "ADC_timer";
ADC_timerParams.period = 1;
ADC_timerParams.startMode = xdc.module("ti.sysbios.interfaces.ITimer").StartMode_AUTO;
ADC_timerParams.arg = "&NULL";
Program.global.ADC_timer = Timer.create(0, "&Delay_us", ADC_timerParams);

The Delay_us function just increment a global variable. The problem is that the variable never increment. I post you my main:

void main(void)
{

PSCModuleControl(SOC_PSC_1_REGS, HW_PSC_GPIO, PSC_POWERDOMAIN_ALWAYS_ON,PSC_MDCTL_NEXT_ENABLE);

//setup the mux for GPIO
GPIOMuxSetup();
GPIODirSetup();


//setup a on board mux
GPIOPinWrite(SOC_GPIO_0_REGS,GPIO_MUX3_A0,GPIO_PIN_LOW);
GPIOPinWrite(SOC_GPIO_0_REGS,GPIO_MUX3_A1,GPIO_PIN_LOW);
GPIOPinWrite(SOC_GPIO_0_REGS,GPIO_MUX4_A0,GPIO_PIN_HIGH);

Timer_start(ADC_timer);

BIOS_start(); // start the sysBIOS
}

I'm probably missing something but i can'T see it...

thanks

Vince
  • Hi Vince,

    Since you have the timer as StartMode_AUTO, you do not need to call Timer_start. Please remove the call and see if that helps. Also, it looks like you do not need ADC_timerParams.arg. You can just remove that line and take the default (which is null).

    Todd

  • Hi Todd,

    it's not working...

    I try to blink a led using the timer to make a delay, here is my code:

    uint8_t ADC_delay_us(uint32_t usec)
    {
    if(ADC_delay==usec)
    {
    ADC_delay=0;
    return TRUE;
    }
    else
    {
    return FALSE;
    }
    }

    The function Delay_us is call by the timer:

    void Delay_us(void)
    {
    ADC_delay++;
    }
    The following function it's a task, the task work fine without the ADC_delay_us but with it nothing work....
    void test(void)
    {
    ADC_delay=0;
    while(1)
    {
    // Sets the GP0[0] to low.
    GPIOPinWrite(SOC_GPIO_0_REGS, 1,GPIO_PIN_LOW);
    while(!(ADC_delay_us(6)));
    // Sets the GP0[0] to high.
    GPIOPinWrite(SOC_GPIO_0_REGS, 1,GPIO_PIN_HIGH);
    while(!(ADC_delay_us(6)));

    Task_sleep(200);
    }
    }
  • What does the timers look like in ROV?

    Does the Task just get stuck in the first ADC_delay_us?

    Is the Timer used by SYSBIOS working? You by looking at the Clock's module ROV page. The ticks should be increasing.

    Todd

  • i find why its doesn't work, i can't put "==" in this if(ADC_delay==usec), because the timer is too fast for the function so the variable was greater than usec and its never go in the if...

    thanks