Thank you, Thomas.
I imported your port files to my project. Аnd had tryed to run following:
~~~
void task1(void *) {
BOOL_8 blink1 = TRUE;
TickType_t xLastWakeTime;
const TickType_t xFrequency = 500;
xLastWakeTime = xTaskGetTickCount();
while(true) {
if (blink1)
cpld_set_bits(ECPLDLeds, CPLD_LED_1);
else
cpld_clear_bits(ECPLDLeds, CPLD_LED_1);
blink1 = (~blink1) & 0x1;
// for (volatile int i=0; i < 8000000; ++i);
// vTaskDelay(500 / portTICK_PERIOD_MS);
vTaskDelayUntil( &xLastWakeTime, xFrequency );
}
}
void task2(void *) {
BOOL_8 blink2 = FALSE;
TickType_t xLastWakeTime;
const TickType_t xFrequency = 500;
xLastWakeTime = xTaskGetTickCount();
while(true) {
if (blink2)
cpld_set_bits(ECPLDLeds, CPLD_LED_2);
else
cpld_clear_bits(ECPLDLeds, CPLD_LED_2);
blink2 = (~blink2) & 0x1;
// for (volatile int i=0; i < 8000000; ++i);
// vTaskDelay(500 / portTICK_PERIOD_MS);
vTaskDelayUntil( &xLastWakeTime, xFrequency );
}
}
extern “C” int c
entry()
{
bool blink5 = true;
isensboard_init();
BaseType_t result = xTaskCreate(
task1,
"task1",
configMINIMAL_STACK_SIZE,
NULL,
tskIDLE_PRIORITY + 1,
&task1Handle
);
(void)result;
BaseType_t result2 = xTaskCreate(
task2,
"task2",
configMINIMAL_STACK_SIZE,
NULL,
tskIDLE_PRIORITY + 1,
&task2Handle
);
(void)result2;
vTaskStartScheduler();
while(true) {
if (blink5)
cpld_set_bits(ECPLDLeds, CPLD_LED_0);
else
cpld_clear_bits(ECPLDLeds, CPLD_LED_0);
blink5 = !blink5;
for (volatile int i=0; i < 16000000; ++i);
}
return 0;
}
~~~
If I run tasks delayed by for() cycle – it works correctly. If I run tasks delayed by vTaskDelay or vTaskDelayUntil functions – it works bad. I see folowing behavior: two times it switch well, but then task1’s led stops. After few secconds (5-10) lights again, then turns off again after random period. Task2’s led blinks stable with 500ms period. This behavior looks like the same as a problem in my first post.