Quantcast
Channel: Forums - Recent Threads
Viewing all articles
Browse latest Browse all 262198

RTOS/CC1310: Start/Stop Clock problem

$
0
0

Part Number:CC1310

Tool/software: TI-RTOS

Hello!

Faced an incomprehensible problem.

1. The first iteration of Clock passes without a specified delay period. source code below

void time_ISR(xdc_UArg arg0)
{
    Semaphore_post(mainSemaphore);
}

void *my_Main(void *arg0)
{
    DBG("Start\n");

    Semaphore_Params params;
    Semaphore_Params_init(&params);
    params.mode = Semaphore_Mode_BINARY;
    mainSemaphore = Semaphore_create(1, &params, Error_IGNORE);

    uint32_t period = 1000000;
    Clock_Params clockParams;
    Clock_Handle clock;

    Clock_Params_init(&clockParams);
    clockParams.period = period/Clock_tickPeriod;
    clockParams.startFlag = FALSE;
    clock = Clock_create(time_ISR, 1, &clockParams, NULL);
    Clock_start(clock);

    while(1)
    {
        DBGF("period=%d\n",period);
        Semaphore_pend(mainSemaphore, BIOS_WAIT_FOREVER );
    }

2. Another incomprehensible case is that if I use functions to change the clock period, I generally do not have a delay in the while (1)
source code below:

void time_ISR(xdc_UArg arg0)
{
    Semaphore_post(mainSemaphore);
}

void *my_Main(void *arg0)
{
    DBG("Start\n");

    Semaphore_Params params;
    Semaphore_Params_init(&params);
    params.mode = Semaphore_Mode_BINARY;
    mainSemaphore = Semaphore_create(1, &params, Error_IGNORE);

    uint32_t period = 1000000;
    Clock_Params clockParams;
    Clock_Handle clock;

    Clock_Params_init(&clockParams);
    clockParams.period = period/Clock_tickPeriod;
    clockParams.startFlag = FALSE;
    clock = Clock_create(time_ISR, 1, &clockParams, NULL);
    Clock_start(clock);

    while(1)
    {
        DBGF("period=%d\n",period);
        Semaphore_pend(mainSemaphore, BIOS_WAIT_FOREVER );

        Clock_stop(clock);
        Clock_setPeriod(clock, period/Clock_tickPeriod);
        Clock_start(clock);
    }

what am I doing wrong ?


Viewing all articles
Browse latest Browse all 262198

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>