Tool/software:
OS: FreeRTOS
SDK: mcu_plus_sdk_am243x_08_06_00_45
Hi,
If the timer is started before the task is created, the output period of the DAC module is stable, as shown in Figure 1.
Why is the output period of the DAC module unstable when the timer is started after task creation, as shown in Figure 2.
What could be the reason?
Best Regards
uint32_t gv_TaskStack[122880/sizeof(uint32_t)] __attribute__((aligned(32)));
SemaphoreP_Object gv_stObjectSem;
int main(void) {
DAC_Init(void); // DAC module initialization
// TMR3_Start
TimerP_start(gTimerBaseAddr[CONFIG_TIMER3]);
TaskP_Params stTaskParams;
// create its semaphore for task
SemaphoreP_constructBinary(&gv_stObjectSem, 0);
// create task
TaskP_Params_init(&stTaskParams);
stTaskParams.name = "Task1";
stTaskParams.stackSize = 122880;
stTaskParams.stack = (uint8_t*)gv_TaskStack;
stTaskParams.priority = 26;
stTaskParams.taskMain = (TaskP_FxnMain)Task1;
TaskP_construct(&gv_stTaskObj, &stTaskParams);
// If the timer is started here, the output period of the ADC module will be unstable
// TimerP_start(gTimerBaseAddr[CONFIG_TIMER3]);
}
void ISR_TIMER3(void) {
SemaphoreP_post(&gv_stObjectSem);
}
// Callback to call when interrupt is received
void TimerP_isr3(void *args)
{
void ISR_TIMER3(void *args);
ISR_TIMER3(args);
TimerP_clearOverflowInt(gTimerBaseAddr[CONFIG_TIMER3]);
HwiP_clearInt(CONFIG_TIMER3_INT_NUM);
}
void Task1(void *pvdArgs) {
SemaphoreP_pend(&gv_stObjectSemCNC, SystemP_WAIT_FOREVER);
DAC_Output(0, 49152); // The DAC module outputs a voltage of 5V
ClockP_usleep(200);
DAC_Output(0, 32767); // The DAC module outputs a voltage of 0V
}