Professional Documents
Culture Documents
Program Code
FRDKL46_MCP
Version
0.4
Effective date
15 Sep 2014
Hanoi, 09/2014
Training Assignments
<CFE >
Issue/Revision: x/y
RECORD OF CHANGES
*A - Added M - Modified D - Deleted
Date
Changes
A*
M, D
Contents
Version
06 Sep 14
All
All
0.1
07 Sep 14
Lecture 01 -> 06
0.2
14 Sep 14
0.3
18 Sep 14
79e-BM/NS/HDCV/FSOFT v1/0
Internal use
2/9
Training Assignments
<CFE >
Issue/Revision: x/y
Contents
Lecture 01 Embedded System Getting Started...................................................................4
Assignment 1: Install Keil & Create simple project..............................................................4
Lecture 02 Embedded Software Development....................................................................4
Assignment 1: N/A..............................................................................................................4
Lecture 03 Getting Started with KL46 freedom board..........................................................4
Assignment 1: Write an example to blink two LEDs with different frequency.......................4
Assignment 2: Write an example to control LEDs by buttons..............................................4
Lecture 04 ARM Cortex-M Architecture Overview................................................................4
Assignment 1: Blink LEDs with given frequency..................................................................4
Lecture 05 ARM Cortex M Exception & Interrupt.................................................................5
Assignment 1: Blink LEDs with dynamic change frequency................................................5
Lecture 06 Peripherals Multipurpose Clock Generator........................................................5
Assignment 1: Write an example to put KL46 to FEI mode from FBE.................................5
Assignment 2: Write an example to put KL46 from FEI mode to PEE.................................5
Lecture 07 - Peripherals PIT Timer.........................................................................................6
Assignment 1: Write an application to trigger the PIT Timer interrupt for every 5.12ms and
30ms................................................................................................................................... 6
Assignment 2: Write an application to trigger the PIT Timer interrupt for every 10min with
chainning both channel 0 & 1..............................................................................................6
Lecture 08 UART.................................................................................................................. 6
Assignment 1: Write a program sends a Hello world! to PC through UART......................6
Assignment 2: Write a program sends a Hello world! to PC through UART with hardware
flow control......................................................................................................................... 6
Lecture 09 RTOS.................................................................................................................7
Assignment 1: Researching the pros/cons on most popular RTOS in the market (VxWorks,
ThreadX, FreeRTOS, Freescale MQX, uTron)....................................................................7
Lecture 10 Introduce to Freescale MQX RTOS...................................................................7
Assignment 1: Task switch..................................................................................................7
Assignment 2: Task create..................................................................................................7
Lecture 11 Freescale MQX Timer........................................................................................7
Assignment 1: Write an application by using an MQX timer to implement a counter, display
a counter value on LCD......................................................................................................7
Lecture 12 Freescale MQX RTOS Task Synchronization....................................................8
Assignment 1: Semaphore..................................................................................................8
79e-BM/NS/HDCV/FSOFT v1/0
Internal use
3/9
Training Assignments
<CFE >
Issue/Revision: x/y
Install Keil IDE & related software for working with FRDKL46 board.
Create a simple project, load & debug on FRDKL46.
79e-BM/NS/HDCV/FSOFT v1/0
Internal use
4/9
Training Assignments
<CFE >
Issue/Revision: x/y
79e-BM/NS/HDCV/FSOFT v1/0
Internal use
5/9
Training Assignments
<CFE >
Issue/Revision: x/y
After 2s
After 4s
79e-BM/NS/HDCV/FSOFT v1/0
Internal use
6/9
Training Assignments
<CFE >
Issue/Revision: x/y
Assignment 2: Write an application to trigger the PIT Timer interrupt for every
10min with chainning both channel 0 & 1.
Description
Create a Keil project for FRD KL46Z256 board
Implement the code to trigger the PIT timer interrupt on 10 seconds with chaining both channel 0 & 1
Estimated time: 2 hours
Lecture 08 UART
Assignment 1: Write a program sends a Hello world! to PC through UART.
Description
-
Create a Keil project for the FRD KL46Z256 which uses printf() function to send a Hello
world to PC using UART module of the FRD KL46Z256.
Baud rate: 115200, Data bit: 8; Parity: None; Stop bits: 1; Flow Control: None.
Lecture 09 RTOS
Assignment 1: Researching the pros/cons on most popular RTOS in the market
(VxWorks, ThreadX, FreeRTOS, Freescale MQX, uTron).
Description
-
Separated class to different team, each team will be responsible for a given RTOS. Team
must research and present with class about following item:
Write a program using RTOS to blink 2 LEDs, one at 1Hz, the other one at 1.5Hz frequency
79e-BM/NS/HDCV/FSOFT v1/0
Internal use
7/9
Training Assignments
<CFE >
Issue/Revision: x/y
Write a program using RTOS to blink 2 LEDs, all at 1Hz frequency. After the led 1 blink 10
times, the led 2 will blink.
Implement a counter increasing on every 1 second, display this counter value on Segment
LCD.
Write a program uses two tasks. All the task need to access the UART port. Task 1 need to
access the UART port to read it and echo the user input. Task 2 need to access the UART
port to write to it (example the hello word). Task 1 will control the UART port first and only
when the user press the a key; the task 1 release the semaphore then task 2 can access the
UART port, the task 2 print for 10 times and give the access to task 1.
Write a program using Massage queue. The user will types some messages to the UART
terminal, when the user type send and then press enter, the content of the messages is
displayed on the screen of PC.
The bugs are the LEDs on the touch buttons. When the bug appears (led turn on),
you must touch the corresponding touch button to kill the bug (the bug killed causes
the led turns off), the bugs will appear for a specified time before the bug escape (the
led turn off).
The bugs are randomized displayed on the LED, some time there are more than one
bugs display on the LED.
79e-BM/NS/HDCV/FSOFT v1/0
Internal use
8/9
Training Assignments
<CFE >
Issue/Revision: x/y
- There are 100 bugs on a game round, the bugs was killed after the game round
finish is the score.
The high score is stored in a variable
The UART port is used to print when a bugs is killed (example the sound Oh), after
a game round finishes, the score will be printed and the high score is printed too.
The time interval between the bugs and the time the bug appear depends on the
programmer.
Button1: Kill bug 1
79e-BM/NS/HDCV/FSOFT v1/0
Internal use
9/9