Hello. I am new to FreeRTOS.
I have analyzed and understood the Scheduling method using Task.
I want to run the PID control source through FreeRTOS scheduling.
I included several functions in the FreeRTOS, such as the libraries tmstm32f4
delay.h and tmstm32f4
delay.c, which were imported from outside, and found that SysTickHandler duplicated.
stm32f4_delay.c defines the millis and delay functions we need to do the PID.
To solve this problem, I commented out the SysTickHandler in the section of tm
stm32f4delay.c and solved the compilation problem. I understood that [[#define xPortSysTickHandler SysTick
Handler]], which is embedded in FreeRTOS, is used for interrupts and is absolutely necessary.
After all, we need to implement the Delay function needed for the PID. The tool I am using is IAR.
The above is a description of the situation I experienced, and the questions are as follows.
- I want to use the function defined in the header file included in TaskFunction via vTaskDelay. Can this header file serve as a delay through a function called vTaskDelay?
- I read the contents of https://www.freertos.org/FreeRTOSSupportForumArchive/November2013/freertosconfigTICKRATEHZ8fc54ac4j.html, but I do not understand.
We implemented a delay using the vTaskDelay function, but this did not allow accurate ms Delay.
I set it to #define configTICKRATEHZ ((TickTypet) 1000) and I wanted a delay of 500ms, but when I measured it with an oscilloscope, it took about 2 seconds of delay.
There is only one externalLED_TASK task to operate.
// const TickTypet xDelay = 500 / portTICK
unsigned int n
iCnt = 0;
// vTaskList (ptrTaskList);
// printf (“ptrTaskList n”);
if ((niCnt% 2) == 0)
SetBits (GPIOD, GPIOPin
else if ((niCnt% 2) == 1)
ResetBits (GPIOD, GPIOPin
// puts (“LED2”);
printf (“PD4 ::::% d n”, n_iCnt);
TASK (void * pvParameter)
I have implemented a for (;;) loop in externaldelay
test, which is not implemented as a loop in TaskFunction itself.
We have confirmed that it works well when scheduling multiple TaskFunctions.
- Is the structure I think is wrong? If so, can you use vTaskDelay to delay for exactly one second? Or can I re-implement Delay?
I need help.