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.

Time delay in TI RTOS V 6

Hi,

I am working on TI RTOS sys/bios version bios_6_76_03_01

I want to achieve something simple as adding a delay between high and low pulse on a pin. Something like this:

GPIO_write(STEP_INDEX,HIGH);
delay();
GPIO_write(STEP_INDEX, LOW);
delay();

Is there a function that I can use something like delay(1000) ?

I went through this forum post :https://e2e.ti.com/support/legacy_forums/embedded/tirtos/f/355/t/537919?time-delay-ti-rtos

where you suggest using a clock, but in that case I would need to call that function which needs to be executed after the time delay period.

This is not feasible for me as I am using the above lines in a bigger function whose main purpose is more than just the lines mentioned here. 

Please suggest another way to add delay between these two lines using any simple internal function if available.

Also, I am not sure if this is the right forum to ask this question. But I couldn't post questions on TI RTOS forum (Its says its archived) , please also suggest a way to directly ask questions related to TI RTOS to in the correct forum.

Thank you,
Arshiya Tabassum

  • Hi Arshiya,

    1. What device are you using?
    2. What type of thread needs the delay...for example Hwi, Swi or Task? 
    3. If it is a task, do you want the delay to be block (e.g. equal or lower priority tasks can run) or polling (so only higher level Tasks/Swi/Hwi can preempt it).

    Todd

  • Hi Todd,

    1. BeagleBone Black (AM335x)

    2. Swi 

    3. It is not inside a task

    Thank you,

    Arshiya Tabassum

  • Hi Arshiya,

    Since you are in a Swi, you cannot block. So you need to do some type of polling in your delay function. Note: while your in the delay, you are blocking all tasks (and lower priority Swis) from running. 

    I'm not sure what the units are for your delay. The Clock module generally has a 1ms granularity. If the units in delay align with that, you can use a Clock function that could be used to unblock the polling. Note, the time will fluctuate since it depends on where in the 1ms period you call delay. You could use a dedicated timer. This will be more accurate. You could query the Timestamp module.

    Todd