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(¶ms); params.mode = Semaphore_Mode_BINARY; mainSemaphore = Semaphore_create(1, ¶ms, 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(¶ms); params.mode = Semaphore_Mode_BINARY; mainSemaphore = Semaphore_create(1, ¶ms, 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 ?