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.

Task_Sleep in TI RTOS 2.14

Other Parts Discussed in Thread: CC2650, SYSBIOS

Hello,

I plan to use Task_sleep() in one of my tasks with priority 1. I can not figure out how to set the resolution of this function. As I have in posts here, I am supposed to configure the task_sleep function. Could you help me figure out how to set a resolution of 1 microsecond? This means that if i give Task_sleep(1); in my code, I will get a delay of 1us.

I am using CC2650 for a project. The task is that of PWM. I need to give precise delays while generating my desired signal. 

Thanks in advance. 

  • Siddharth,

    The ‘nticks’ argument to Task_sleep() is the number of system Clock ticks that the Task should sleep for.  So the resolution of the sleep delay is based upon the configured Clock tick period, which is specified with the Clock.tickPeriod configuration parameter.

    On this family of devices the Clock module uses the RTC timer, which increments at a 32,768Hz rate.  So you will not be able to get precise 1 microsecond accuracy from the Clock module.  You could conceivably change the application configuration to use a different timer peripheral to drive Clock, but you will lose a lot of capability, including power management, which leverages the continuously running RTC timer for Clock.

    For a 1 microsecond accuracy for interrupts you will need to use one of the general purpose timers, and the Timer APIs. See this module: ti.sysbios.family.arm.lm4.Timer.

    Also, in the recent TI-RTOS 2.15.00.17 release there is a preliminary PWM driver included (see tirtos_cc13xx_cc26xx_2_15_00_17\products\tidrivers_cc13xx_cc26xx_2_15_00_26\packages\ti\drivers\pwm).  This driver is functional, but some slight API modifications will be made before it is called ‘complete’ for the next TI-RTOS release.  This preliminary driver might be usable for you, or a good reference for what you are trying to implement...

    Regards,
    Scott

  • Thank you Scott. This helps a lot in my understanding.

    I am using that PWM driver itself. Was provided to me by someone from TI a few days back.