Difference between revisions of "Embedded System Tutorial Tasks"
From Embedded Systems Learning Academy
Line 16: | Line 16: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | Further | + | <H3>Further Guidelines</H3> |
* Use FreeRTOS xTaskCreate() to create tasks and use example code for reference. | * Use FreeRTOS xTaskCreate() to create tasks and use example code for reference. | ||
*: You may have to take some things for granted, such as "stack size" and 2048 bytes is enough stack size to run these tasks | *: You may have to take some things for granted, such as "stack size" and 2048 bytes is enough stack size to run these tasks | ||
Line 22: | Line 22: | ||
* Do not use printf, instead use uart0_puts() function from #include "uart0_min.h" | * Do not use printf, instead use uart0_puts() function from #include "uart0_min.h" | ||
− | Hints | + | <H3>Hints</H3> |
* The printf data appears over 38400bps UART, which can roughly send 4 characters per millisecond | * The printf data appears over 38400bps UART, which can roughly send 4 characters per millisecond | ||
*: When you send 20 chars (aaaaaaaaaaaaaaaaaaaa), it would take roughly 5ms to send the data | *: When you send 20 chars (aaaaaaaaaaaaaaaaaaaa), it would take roughly 5ms to send the data | ||
* The SJ-One board RTOS runs at 1Khz | * The SJ-One board RTOS runs at 1Khz | ||
+ | <H3>Assignment</H3> | ||
Observe and turn in with your assignment: | Observe and turn in with your assignment: | ||
* How come 4(or 3 sometimes) characters are printed from each task? Why not 2 or 5, or 6? | * How come 4(or 3 sometimes) characters are printed from each task? Why not 2 or 5, or 6? |
Revision as of 16:59, 13 January 2018
The objective of the assignment is to create multiple tasks and observe how they behave. Please create two tasks, and have them run the following code:
// Create a task and run this code in a while(1) loop
void task_one_code(void)
{
uart0_puts("aaaaaaaaaaaaaaaaaaaa");
vTaskDelay(100);
}
void task_two_code(void)
{
uart0_puts("bbbbbbbbbbbbbbbbbbbb");
vTaskDelay(100);
}
Further Guidelines
- Use FreeRTOS xTaskCreate() to create tasks and use example code for reference.
- You may have to take some things for granted, such as "stack size" and 2048 bytes is enough stack size to run these tasks
- Use vTaskDelay() to "sleep"
- Do not use printf, instead use uart0_puts() function from #include "uart0_min.h"
Hints
- The printf data appears over 38400bps UART, which can roughly send 4 characters per millisecond
- When you send 20 chars (aaaaaaaaaaaaaaaaaaaa), it would take roughly 5ms to send the data
- The SJ-One board RTOS runs at 1Khz
Assignment
Observe and turn in with your assignment:
- How come 4(or 3 sometimes) characters are printed from each task? Why not 2 or 5, or 6?
- Alter the priority of one of the tasks, and note down the observations. Note down WHAT you see and WHY.
Turn in (to Canvas):
- Relevant code
- Your observation and explanation
- Snapshot of the output for all scenarios.