FreeRTOS Support Archive
The FreeRTOS support forum is used to obtain active support directly from Real
Time Engineers Ltd. In return for using our top quality software and services for
free, we request you play fair and do your bit to help others too! Sign up
to receive notifications of new support topics then help where you can.
This is a read only archive of threads posted to the FreeRTOS support forum.
The archive is updated every week, so will not always contain the very latest posts.
Use these archive pages to search previous posts. Use the Live FreeRTOS Forum
link to reply to a post, or start a new support thread.
[FreeRTOS Home] [Live FreeRTOS Forum] [FAQ] [Archive Top] [January 2016 Threads]
I'm a beginner at FreeRTOS, I've wrote a simple application that turn on and off between two leds (each task turns a led on and turn off the other).
The problem is i've wrote the two tasks but the schedular puts a task in running and switch to the other and stops at this task without switching again.
Maybe i've missunderstood how it works. So please help would be appreciated. This is the code i've written
~~~~
define F_CPU 8000000UL
include "freertos/FreeRTOS.h"
include "freertos/task.h"
include "freertos/FreeRTOSConfig.h"
void taskone(void *pvParameters);
void tasktwo(void *pvParameters);
int main(void)
{
DDRC = 0xff;
xTaskCreate(taskone, NULL, 50, NULL, 1, NULL);
xTaskCreate(tasktwo, NULL, 50, NULL, 1, NULL);
vTaskStartScheduler();
return 0;
}
void task_one(void *pvParameters)
{
while(1)
{
PORTC = 0x0f;
}
}
void task_two(void *pvParameters)
{
while(1)
{
PORTC = 0xf0;
}
}
~~~~
Do you know the task is still running ok and not just crashed? What code is executing when you pause the debugger? Does the xTickCount variable in tasks.c increment still?
Can you tell me how to check this, please ?
I'm trying to access xTickCount via xTaskGetCount(), But don't know how to check it. Tried printing it on LCD but nothing's showing up. (LCD is working and code its tested).
How do you know the code is running still?
I've tried converting xTaskGetCount() to string and print it on LCD. Here's what I got:
1. xTickCount starts at 0 -> Tasktwo fires. xTickCount becomes 1 -> Taskone fires. xTickCount stops counting afterwards !
2. When I put xTaskDelay(1) inside the two tasks. xTickCount increments normally beyond 1 but still it hangs on one task without switching back and fourth.
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.