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.

RTOS/CC1310: Clock problem

Part Number: CC1310


Tool/software: TI-RTOS

Hello!

I tried to make a simple example of using Clock and got the following result. Why is this happening ?

#include <ti/sysbios/knl/Clock.h>


Clock_Struct MainClock;

void mainClockFxn(UArg arg0)
{
    GPIO_toggleDio(CC1310_LAUNCHXL_PIN_RLED);
}

/*
 *  ======== mainThread ========
 */
void *mainThread(void *arg0)
{

    uint32_t period = 125/Clock_tickPeriod;
    Clock_Params clkParams;
    Clock_Params_init(&clkParams);
    clkParams.period = period;
    clkParams.startFlag = TRUE;
    Clock_construct(&MainClock, (Clock_FuncPtr)mainClockFxn, period, &clkParams);

    while(1);
}
On the oscillograph I observe very frequent PIN switching through 4.64 uS
  • Hi Igor,

    There are multiple issues with what you are doing here. First of all, your period variable is effectively 0, because Clock_tickPeriod is by default 1000. This means your clock object will fire each kernel tick.

    The second problem is that the RTOS system tick has jitter. This is what you are observing when some periods are squeezed together.

    Third, using a clock object (in software) to toggle a GPIO signal at such a low resolution will never give you a reliable signal. You should probably use the GPTimer generate the signal in hardware instead of in software.
  • Thanks for the answer. Now everything became clear.