lab2
.pdf
keyboard_arrow_up
School
McMaster University *
*We aren’t endorsed by this school
Course
4DS4
Subject
Electrical Engineering
Date
Apr 3, 2024
Type
Pages
25
Uploaded by GrandIce96200
McMaster University
Dept. Electrical and Comp. Engineering
4DS4 - Winter 2023
LAB 2
Introduction to FreeRTOS
1
Lab Rules
•
You have to stick to your Lab slot assigned to you on Mosaic.
•
You have to use the Teams you created in Lab0 on github classroom.
•
Prepare a demonstration for all the Lab experiments, and get ready to be asked in any
part of the experiments.
•
The demonstrations of Lab 0 will be held starting from
Feb 26th at the first hour
of each lab slot
.
•
All the activities and questions written in
blue
should be documented and answered in
your lab report.
•
Each team needs to submit one report for all the members, and the first page of the
report should contain the team number and the names of its members.
•
The submission should be through github classroom at 12pm on the day of your demo.
Put the report in a PDF format. submission will be through github classroom.
•
The first page (After the title page) of the report must include a
Declaration of
Contributions
, where each team member writes his own individual tasks conducted
towards the completion of the lab.
•
You also need to submit all source files that you modify or add through out the lab.
General Note:
•
Make sure to push all your code to the assignment repository from the lab computer
before leaving the lab room because your saved work may be deleted after the lab slot.
2
Lab Rules
3
Lab Goals
- Build FreeRTOS and run it on FMUK66.
- Understand and reate tasks in FreeRTOS.
- Learn different techniques for inter-tasks communication and synchronization.
- Configure interrupts inside FreeRTOS.
- Use timers to create single shot and periodic events.
1
McMaster University
Dept. Electrical and Comp. Engineering
4DS4 - Winter 2023
- Setup and use the radio controller.
- Interpret the UART signal returned from the radio receiver.
4
Github Classroom
You should accept the lab assignment through this link:
https://classroom.github.com/a/1Ia7lPTx
Again, you have to use the same Team you have created for your group in Lab0.
5
Lab Components
Prepare the following modules before starting the in-lab experiments.
1. 1x RDDRONE-FMUK66 board.
2. 1x Segger J-Link EDU Mini debugger.
3. 3x micro USB cables.
4. 1x Debug breakout board with the 7-wire cable.
5. 2x Telemetry modules.
2
McMaster University
Dept. Electrical and Comp. Engineering
4DS4 - Winter 2023
6. 1x 6-wire cable.
7. 1x FlySky controller (radio transmitter).
8. 1x FlySky receiver (radio receiver).
3
McMaster University
Dept. Electrical and Comp. Engineering
4DS4 - Winter 2023
6
Experiments
Experiment 1: FreeRTOS Hello World
In this experiment, we import the FreeRTOS “Hello World” project from the SDK to the base
project for all the following experiments. Then we will create multiple tasks with different
priorities.
Experiment Setup: Part A
In this part, we create a task that prints “Hello World” in the console.
1. In the MCUXpresso IDE, select ”Import from SDK examples(s)” under the Quickstart
Panel.
2. Select ”frdmk6ff” and click Next
→
rtos
examples
→
check freertos
hello and select
semihost
→
Finish
3. From Miscellaneous under Quickstart Panel, select Quick Settings
→
SDK Debug Console
→
Semihost
Console.
4. In freertos
hello.c file, clear everything except the includes, and create an empty main
function.
5. Make sure the project builds successfully.
6. Add the following code in the main function.
1
int
main(
void
)
2
{
3
BaseType_t status;
4
5
/* Init board hardware. */
6
BOARD_InitBootPins();
7
BOARD_InitBootClocks();
8
BOARD_InitDebugConsole();
9
10
status = xTaskCreate(hello_task,
"Hello_task"
, 200, NULL, 2, NULL);
11
if
(status != pdPASS)
12
{
13
PRINTF(
"Task creation failed!.\r\n"
);
14
while
(1);
15
}
16
17
vTaskStartScheduler();
18
while
(1)
19
{}
20
}
In line 10, xTaskCreate creates a new task, which has the name “Hello
task”
- the second argument to the function. The first argument is a pointer to the task func-
tion, which we will define below. The third argument is the required stack size for the
task execution, so it should be large enough for the local variables and the function calls
4
McMaster University
Dept. Electrical and Comp. Engineering
4DS4 - Winter 2023
in the task. To pass values to the parameters of the task function, you can provide the
address of those values through the fourth argument. If the task does not require any
arguments, a NULL can be passed as in our case. The fifth argument is used to specify
the priority of the task, where 0 is the lowest priority and 4 is the highest. Finally, the
last argument is for returning a handler for the task, and NULL can be passed if the
handler is not needed.
You do not have to memorize these inputs. Luckily, FreeRTOS documentation is more
than enough to understand its APIs (functions). The documentation is coupled with
the header files. For instance, in your workspace, you can find the documentation for
xTaskCreate in “freertos
→
freertos
kernel
→
include
→
task.h” along with an example
on how to use it.
Alternatively, you can also use the FreeRTOS manual (FreeRTOS
Reference Manual V10.0.0.pdf) uploaded on Avenue under Labs/Documentation. Refer
to Section 2.6 for more details regarding vTaskCreate.
In line 17, vTaskStartScheduler begins the FreeRTOS system scheduler. The tasks will
not execute until the scheduler
7. Add the function of “hello
task” above the main. Note that any task function should
return void and accept void pointer as an input.
void
hello_task(
void
*pvParameters)
{
while
(1)
{
PRINTF(
"Hello World\r\n"
);
vTaskDelay(1000 / portTICK_PERIOD_MS);
}
}
This task will print “Hello World” every second. The delay in the task is created using
vTaskDelay, which is different from the software delays we used to create in the previous
labs.
vTaskDelay removes the task from the running state to the waiting state, and
leaves the CPU free to execute another task. Also, note that vTaskDelay accepts the
delay in terms of number of ticks (FreeRTOS ticks). To convert the ticks to milliseconds,
you need to divide by the constant portTICK
PERIOD
MS (Check the documentation
in task.h or refer to Section 2.9).
8. Connect the J-link debugger to FMUK66.
9. Compile the code and download it to the board. The console must print ”Hello World”
every second.
Experiment Setup: Part B
Now, we build over the previous part by creating another task that accepts arguments passed
from xTaskCreate.
1. Make the following edits to your existing code..
5
McMaster University
Dept. Electrical and Comp. Engineering
4DS4 - Winter 2023
char
* str =
"4DS"
;
int
main(
void
)
{
BaseType_t status;
/* Init board hardware. */
BOARD_InitBootPins();
BOARD_InitBootClocks();
BOARD_InitDebugConsole();
status = xTaskCreate(hello_task,
"Hello_task"
, 200, NULL, 2, NULL);
if
(status != pdPASS)
{
PRINTF(
"Task creation failed!.\r\n"
);
while
(1);
}
status = xTaskCreate(hello_task2,
"Hello_task2"
, 200, (
void
*)str, 2, NULL);
if
(status != pdPASS)
{
PRINTF(
"Task creation failed!.\r\n"
);
while
(1);
}
vTaskStartScheduler();
for
(;;);
}
The code creates another task, Hello
task2, but unlike the original task this one accepts
string through the fourth argument of xTaskCreate.
2. Add the following function, hello
task2, above the main function.
void
hello_task2(
void
*pvParameters)
{
while
(1)
{
PRINTF(
"Hello %s.\r\n"
, (
char
*) pvParameters);
vTaskDelay(1000 / portTICK_PERIOD_MS);
}
}
The input from xTaskCreate reaches the function through its void pointer.
3. Run the code, and you should see both “Hello World” and “Hello 4DS” appear on the
console.
Problem 1
Write a program that contains two tasks.
The first task is responsible for taking an input
string from the user through the console and
save the string globally
. After receiving the
string the task should delete itself. On the other hand, the second task waits until the first
the string is available, and then it keeps printing it every second. The priority of first task is
2 while it is 3 for the second task. Refer to Section 2.11 for details on ”vTaskDelete”.
6
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
Related Questions
DEGREE: ELECTRICAL ENGINEERING SUBJECT/COURSE: AC MACHINETOPIC: SM, CONVERTER, AND RECTIFIER
NOTE: Please solve it in this way. 1. Please have good handwriting, some of the answers are not readable. Thank you!2. GIVEN. (Include symbols and units)3. REQUIRED/FIND/MISSING (with symbol/s and units)4. ILLUSTRATION (Required).5. Step-by-step SOLUTION with Formulas and Symbols. No Shortcut, no skipping, and detailed as possible6. FINAL ANSWERS must be rounded up to two decimal places with the corresponding units.
PROBLEM:A synchronous motor absorbing 60 kW is connected in parallel with a factory load of 240kW having a lagging p.f. of 0.75. If the combined load has an R.f. of 0.98, what is the value of the leading kVAR supplied by the motor, and at what p.f. is it working?
arrow_forward
DEGREE: ELECTRICAL ENGINEERING SUBJECT/COURSE: AC MACHINETOPIC: SM, CONVERTER, AND RECTIFIER
NOTE: Please solve it in this way. 1. Please have good handwriting, some of the answers are not readable. Thank you!2. GIVEN. (Include symbols and units)3. REQUIRED/FIND/MISSING (with symbol/s and units)4. ILLUSTRATION (Required).5. Step-by-step SOLUTION with Formulas and Symbols. No Shortcut, no skipping, and detailed as possible6. FINAL ANSWERS must be rounded up to two decimal places with the corresponding units.
PROBLEM:A synchronous motor takes 25kW from 400V supply mains. The synchronous reactance of the motor is 4ohms. Calculate the power factor at which the motor would operate when the field excitation is so adjusted that the generated EMF is 500volts.
arrow_forward
Project 3: - Design MCU based system to form the following state machine? Proj4:- redesign the project using active low method (method 2) for LEDs? Show all design parts (the circuit and the program) and the state machine diagram.
arrow_forward
What information can be obtained by reading the abstract "THE EFFECT OF PURPOSE ON V2V COMMUNICATION AT JUNCTIONS"
arrow_forward
DEGREE: ELECTRICAL ENGINEERING SUBJECT/COURSE: AC MACHINETOPIC: SM, CONVERTER, AND RECTIFIER
NOTE: Please solve in this way. 1. Please have a good handwriting, some of the answers are not readable. Thank you!2. GIVEN. (Include symbols and units)3. REQUIRED/FIND/MISSING (with symbol/s and units)4. ILLUSTRATION (Required).5. Step-by-step SOLUTION with Formulas and Symbols. No Shortcut, no skipping, and detailed as possible6. FINAL ANSWERS must be rounded up to two decimal places with corresponding unit.
PROBLEM:A synchronous motor absorbing 60 kW is connected in parallel with a factory load of 240kW having a lagging p.f. of 0.75. If the combined load has a R.f. of 0.98, what is the value of the leading kVAR supplied by the motor and at what p.f. is it working?
arrow_forward
DEGREE: ELECTRICAL ENGINEERING SUBJECT/COURSE: AC MACHINETOPIC: SM, CONVERTER, AND RECTIFIER
NOTE: Please solve in this way. 1. Please have a good handwriting, some of the answers are not readable. Thank you!2. GIVEN. (Include symbols and units)3. REQUIRED/FIND/MISSING (with symbol/s and units)4. ILLUSTRATION (Required).5. Step-by-step SOLUTION with Formulas and Symbols. No Shortcut, no skipping, and detailed as possible6. FINAL ANSWERS must be rounded up to two decimal places with corresponding unit.
PROBLEM:A 3-ф, star-connected synchronous motor takes 48 kW at 693 V, the power factor being 0.6 lagging. The induced e.m.f. is increased by 50%, the power taken remaining the same. Find the current and the p.f. The machine has asynchronous reactance of 2ohms per phase and negligible resistance.
arrow_forward
Q1/ Answer the following questions:
a) What is the structure of ANFIS?
b) What is the principal idea of PSO?
c) Why we use triangle MF to design FLC?
d) How we can design the rule of ANN?
arrow_forward
5) A three-layer BPN with 5 neurons in each layer has a total of 50 connections and 50 weights. [ ]true or flase
arrow_forward
Please give me ateast 3 topics in Electrical Engineering thesis ideas.
give atleast 1 paragraph explanation regarding the topics and its uses in the community.
thanks!
arrow_forward
can you help me with this decoding a carbon resistor? thanksDecoding a Carbon Resistor
Resistor No.
Color Coded
Color Coded Value
Actual Resistance Value
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
arrow_forward
Can someone please verify both circuits components are within their min/max limits? I have a hard time understanding the data sheets Will upvote! Same components used for both.
Table with operating voltage and current attached
arrow_forward
Build a thermostat using Arduino Uno, LCD display, temperature sensor and few
LED's.
Write a program in Arduino IDE which will work for the heating and cooling
process. Use the temperature sensor to measure the current temperature. Display
the current temperature on the LCD display. You need to use a loop for
comparison of current temperature with the set temperature. LCD display should
display the current and set temperature. Try to implement red and green LED’s for
heater and cooler side respectively.
Modify the project using the remote given in the kit. You should use the remote to
change the temperature up and down the set temperature.
arrow_forward
A PMMC instrument has internal resistance of 0.8 kΩ and gives full scale deflection for 33 mA. The required resistance value of multiplier resistors for employing the meter as a multi range voltmeter for voltage range 75 V will be __________________ ohms.
a. 226.47
b. -360.00
c. 1472.73
d. 93717.00
arrow_forward
Ohm's law experiment, we calculated and measured using multitester the resistor,voltage and current. Our datas incluse theoretical and experimental.
What do you think are the possible causes or sources of laboratory errors from the data? Do these errors make your data smaller or larger? Why?
arrow_forward
When we want to create an 8x1 multiplexer using the circuit elements we have, which circuit will we need?
a.) 7 pieces of 2x1 MUX
b.) 2 pieces of 4x1MUX
c.) 3 pieces 4x1 MUX
d.) none
e.) 4 pieces 2x1 MUX
arrow_forward
Can anyone help? Use Karnaugh Map for this one
arrow_forward
Question S .Full explain this question and text typing work only We should answer our question within 2 hours takes more time then we will reduce Rating Dont ignore this line
arrow_forward
What can you do in the sim
arrow_forward
HI! HELP ME PLEASE. TYSM.
arrow_forward
Don't use ai to answer I will report your answer Solve it Asap with explanation...
What is a wind rose and how is it used in wind energy analysis?
arrow_forward
Q2. An array of seven LED is used to show the outcome of rolling a die. Design a circuit that illuminates
appropriate LEDS to display the outcome of the die. The distribution of the LEDS on the electronic display
is given below.
a- Derive the Truth Table for the defined function
b- Simplify the function using Karnaugh-map
c- Express the simplified function F and sketch the circuit
c de
f
3.
O CO
arrow_forward
Get the same shape required and Give proper label and title by using OCTAVE and write the program
arrow_forward
5.
Your friend D. G. Tully is very excited because she figured out a way to transmit digital
information wirelessly via a light signal. However, she does not know digital circuits so
she comes to you for help. She shows you the circuit in figure 7. The circuit contains
a Light dependent Resistor (LDR), which changes its resistance from Row when light is
shone on it and Rhigh in the dark.
VDD
R₁
T
for
BRL
(a) Configuration A
Vo
V DD
J
R₁
VDD
Figure 7: LDR Receiver
-L
(b) Configuration B
V₂
(a) Which circuit configuration will give you a non-inverting output i.e the
output of the inverter, V, goes high when the light is bright and low when the light
level is low and which one will give you the inverting output?
arrow_forward
For an RTD the relationship between resistance and temperature is
a. proportional
b. no relation
c. equal
d. inversely proportional
arrow_forward
A simple circuit with one or more chips for Digital Integrated Circuits subject, with a written explanation. it can be anything, but not too simple and also not too complicated.
arrow_forward
Pls help.me answer the following, show neat and whole solution and kindly send a screenshot of simulation.
arrow_forward
2)With neat diagram explain the construction and working principle of strain gauge.(please write by computer and draw by an write )
arrow_forward
Find the state graph for the following parallel counter:
QA
C
clk
clk
clk
(Handwriting solution is needed: include this in your pdf file)
CBA
B
arrow_forward
SEE MORE QUESTIONS
Recommended textbooks for you
Introductory Circuit Analysis (13th Edition)
Electrical Engineering
ISBN:9780133923605
Author:Robert L. Boylestad
Publisher:PEARSON
Delmar's Standard Textbook Of Electricity
Electrical Engineering
ISBN:9781337900348
Author:Stephen L. Herman
Publisher:Cengage Learning
Programmable Logic Controllers
Electrical Engineering
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education
Fundamentals of Electric Circuits
Electrical Engineering
ISBN:9780078028229
Author:Charles K Alexander, Matthew Sadiku
Publisher:McGraw-Hill Education
Electric Circuits. (11th Edition)
Electrical Engineering
ISBN:9780134746968
Author:James W. Nilsson, Susan Riedel
Publisher:PEARSON
Engineering Electromagnetics
Electrical Engineering
ISBN:9780078028151
Author:Hayt, William H. (william Hart), Jr, BUCK, John A.
Publisher:Mcgraw-hill Education,
Related Questions
- DEGREE: ELECTRICAL ENGINEERING SUBJECT/COURSE: AC MACHINETOPIC: SM, CONVERTER, AND RECTIFIER NOTE: Please solve it in this way. 1. Please have good handwriting, some of the answers are not readable. Thank you!2. GIVEN. (Include symbols and units)3. REQUIRED/FIND/MISSING (with symbol/s and units)4. ILLUSTRATION (Required).5. Step-by-step SOLUTION with Formulas and Symbols. No Shortcut, no skipping, and detailed as possible6. FINAL ANSWERS must be rounded up to two decimal places with the corresponding units. PROBLEM:A synchronous motor absorbing 60 kW is connected in parallel with a factory load of 240kW having a lagging p.f. of 0.75. If the combined load has an R.f. of 0.98, what is the value of the leading kVAR supplied by the motor, and at what p.f. is it working?arrow_forwardDEGREE: ELECTRICAL ENGINEERING SUBJECT/COURSE: AC MACHINETOPIC: SM, CONVERTER, AND RECTIFIER NOTE: Please solve it in this way. 1. Please have good handwriting, some of the answers are not readable. Thank you!2. GIVEN. (Include symbols and units)3. REQUIRED/FIND/MISSING (with symbol/s and units)4. ILLUSTRATION (Required).5. Step-by-step SOLUTION with Formulas and Symbols. No Shortcut, no skipping, and detailed as possible6. FINAL ANSWERS must be rounded up to two decimal places with the corresponding units. PROBLEM:A synchronous motor takes 25kW from 400V supply mains. The synchronous reactance of the motor is 4ohms. Calculate the power factor at which the motor would operate when the field excitation is so adjusted that the generated EMF is 500volts.arrow_forwardProject 3: - Design MCU based system to form the following state machine? Proj4:- redesign the project using active low method (method 2) for LEDs? Show all design parts (the circuit and the program) and the state machine diagram.arrow_forward
- What information can be obtained by reading the abstract "THE EFFECT OF PURPOSE ON V2V COMMUNICATION AT JUNCTIONS"arrow_forwardDEGREE: ELECTRICAL ENGINEERING SUBJECT/COURSE: AC MACHINETOPIC: SM, CONVERTER, AND RECTIFIER NOTE: Please solve in this way. 1. Please have a good handwriting, some of the answers are not readable. Thank you!2. GIVEN. (Include symbols and units)3. REQUIRED/FIND/MISSING (with symbol/s and units)4. ILLUSTRATION (Required).5. Step-by-step SOLUTION with Formulas and Symbols. No Shortcut, no skipping, and detailed as possible6. FINAL ANSWERS must be rounded up to two decimal places with corresponding unit. PROBLEM:A synchronous motor absorbing 60 kW is connected in parallel with a factory load of 240kW having a lagging p.f. of 0.75. If the combined load has a R.f. of 0.98, what is the value of the leading kVAR supplied by the motor and at what p.f. is it working?arrow_forwardDEGREE: ELECTRICAL ENGINEERING SUBJECT/COURSE: AC MACHINETOPIC: SM, CONVERTER, AND RECTIFIER NOTE: Please solve in this way. 1. Please have a good handwriting, some of the answers are not readable. Thank you!2. GIVEN. (Include symbols and units)3. REQUIRED/FIND/MISSING (with symbol/s and units)4. ILLUSTRATION (Required).5. Step-by-step SOLUTION with Formulas and Symbols. No Shortcut, no skipping, and detailed as possible6. FINAL ANSWERS must be rounded up to two decimal places with corresponding unit. PROBLEM:A 3-ф, star-connected synchronous motor takes 48 kW at 693 V, the power factor being 0.6 lagging. The induced e.m.f. is increased by 50%, the power taken remaining the same. Find the current and the p.f. The machine has asynchronous reactance of 2ohms per phase and negligible resistance.arrow_forward
- Q1/ Answer the following questions: a) What is the structure of ANFIS? b) What is the principal idea of PSO? c) Why we use triangle MF to design FLC? d) How we can design the rule of ANN?arrow_forward5) A three-layer BPN with 5 neurons in each layer has a total of 50 connections and 50 weights. [ ]true or flasearrow_forwardPlease give me ateast 3 topics in Electrical Engineering thesis ideas. give atleast 1 paragraph explanation regarding the topics and its uses in the community. thanks!arrow_forward
- can you help me with this decoding a carbon resistor? thanksDecoding a Carbon Resistor Resistor No. Color Coded Color Coded Value Actual Resistance Value 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20.arrow_forwardCan someone please verify both circuits components are within their min/max limits? I have a hard time understanding the data sheets Will upvote! Same components used for both. Table with operating voltage and current attachedarrow_forwardBuild a thermostat using Arduino Uno, LCD display, temperature sensor and few LED's. Write a program in Arduino IDE which will work for the heating and cooling process. Use the temperature sensor to measure the current temperature. Display the current temperature on the LCD display. You need to use a loop for comparison of current temperature with the set temperature. LCD display should display the current and set temperature. Try to implement red and green LED’s for heater and cooler side respectively. Modify the project using the remote given in the kit. You should use the remote to change the temperature up and down the set temperature.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Introductory Circuit Analysis (13th Edition)Electrical EngineeringISBN:9780133923605Author:Robert L. BoylestadPublisher:PEARSONDelmar's Standard Textbook Of ElectricityElectrical EngineeringISBN:9781337900348Author:Stephen L. HermanPublisher:Cengage LearningProgrammable Logic ControllersElectrical EngineeringISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
- Fundamentals of Electric CircuitsElectrical EngineeringISBN:9780078028229Author:Charles K Alexander, Matthew SadikuPublisher:McGraw-Hill EducationElectric Circuits. (11th Edition)Electrical EngineeringISBN:9780134746968Author:James W. Nilsson, Susan RiedelPublisher:PEARSONEngineering ElectromagneticsElectrical EngineeringISBN:9780078028151Author:Hayt, William H. (william Hart), Jr, BUCK, John A.Publisher:Mcgraw-hill Education,
Introductory Circuit Analysis (13th Edition)
Electrical Engineering
ISBN:9780133923605
Author:Robert L. Boylestad
Publisher:PEARSON
Delmar's Standard Textbook Of Electricity
Electrical Engineering
ISBN:9781337900348
Author:Stephen L. Herman
Publisher:Cengage Learning
Programmable Logic Controllers
Electrical Engineering
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education
Fundamentals of Electric Circuits
Electrical Engineering
ISBN:9780078028229
Author:Charles K Alexander, Matthew Sadiku
Publisher:McGraw-Hill Education
Electric Circuits. (11th Edition)
Electrical Engineering
ISBN:9780134746968
Author:James W. Nilsson, Susan Riedel
Publisher:PEARSON
Engineering Electromagnetics
Electrical Engineering
ISBN:9780078028151
Author:Hayt, William H. (william Hart), Jr, BUCK, John A.
Publisher:Mcgraw-hill Education,