Lab Manual 4 Expts

Download as pdf or txt
Download as pdf or txt
You are on page 1of 16

VIDYA JYOTHI INSTITUTE OF TECHNOLOGY

DEPARTMENT OF ELECTRONICS AND COMMUNICATION


ENGINEERING

EMBEDDED
LAB
MANUAL
2018
LABMANUAL TO HELP STUDENTS TO DO EXPERIMENTS ON FRDM Document

JUNE 2018
EMBEDDED LAB MANUAL 2018

2 VIDYA JYOTHI INSTITUTE OF TECHNOLOGY, AZIZ NAGAR, HYDERABAD-75


EMBEDDED LAB MANUAL 2018

3 VIDYA JYOTHI INSTITUTE OF TECHNOLOGY, AZIZ NAGAR, HYDERABAD-75


EMBEDDED LAB MANUAL 2018

Ex No 1: STUDY OF FRDM –KL25Z


DATE:

Aim: To Study the Internal Architecture of FRDM-KL25Z


Overview of the Controller:
The Freescale Freedom KL25Z hardware, FRDM-KL25Z, is a simple, yet sophisticated
design featuring a Kinetis L series microcontroller, the industry’s first microcontroller built
on the ARM® Cortex™-M0+ core. It features a KL25Z128VLK, a KL2 family device
boasting a max operating frequency of 48MHz, 128KB of flash, a full speed USB controller,
and loads of analog and digital peripherals. The FRDM-KL25Z is the first hardware platform
to feature the Free scale open standard embedded serial and debug adapter known as Open
SDA. This circuit offers several options for serial communications, flash programming and
run-control debugging.
Features of FRDM-KL25Z
The features of the FRDM-KL25Z include:
 MKL25Z128VLK4 in an 80 LQFP package
 Capacitive touch slider
 MMA8451Q accelerometer
 Tri-color (RGB) LED
 Flexible power supply options – USB, coin cell battery, external source
 Battery-ready, power-measurement access points
 Easy access to MCU I/O via Arduino ™ R3 compatible I/O connectors
 Programmable Open SDA debug interface with multiple applications available including:
- Mass storage device flash programming interface
- P&E Debug interface provides run-control debugging and compatibility with IDE
tools
- CMSIS-DAP interface: new ARM standard for embedded debug interface
- Data logging application

Figure 1 Call out of different component of FRDM-KL25Z

4 VIDYA JYOTHI INSTITUTE OF TECHNOLOGY, AZIZ NAGAR, HYDERABAD-75


EMBEDDED LAB MANUAL 2018

Figure 2 Block Diagram of FRDM-KL25Z Microcontroller

SERIAL AND DEBUG ADAPTER (OPENSDA)


OpenSDA is an open-standard serial and debug adapter. It bridges serial and debug
communications between a USB host and an embedded target processor as shown in Figure
3. The hardware circuit is based on a Freescale Kinetis K20 family microcontroller (MCU)
with 128 KB of embedded flash and an integrated USB controller. OpenSDA features a mass
storage device (MSD) bootloader, which provides a quick and easy mechanism for loading
different OpenSDA Applications such as flash programmers, run-control debug interfaces,
serial-to-USB converters, and more

Figure 3 HIGH LEVEL SDA BLOCK DIAGRAM


OpenSDA is managed by a Kinetis K20 MCU built on the ARM® Cortex™-M4 core. The OpenSDA
circuit includes a status LED (D4) and a pushbutton (SW1). The pushbutton asserts the Reset signal to

5 VIDYA JYOTHI INSTITUTE OF TECHNOLOGY, AZIZ NAGAR, HYDERABAD-75


EMBEDDED LAB MANUAL 2018
the KL25Z target MCU. It can also be used to place the OpenSDA circuit into Bootloader mode. SPI
and GPIO signals provide an interface to either the SWD debug port of the KL25Z.

KL25Z Microcontroller
The target microcontroller of the FRDM-KL25Z is the KL25Z128VLK4, a Kinetis L series
device in an 80 LQFP package. The KL25Z MCU features include:
 32-bit ARM Cortex-M0+ core
- up to 48 MHz operation
- Single-cycle fast I/O access port
 Memories
- 128 KB flash
- 16 KB SRAM
 System integration
- Power management and mode controllers
- Low-leakage wakeup unit
- Bit manipulation engine for read-modify-write peripheral operations
- Direct memory access (DMA) controller
- Computer operating properly (COP) Watchdog timer
 Clocks
- Clock generation module with FLL and PLL for system and CPU clock generation
- 4 MHz and 32 kHz internal reference clock
- System oscillator supporting external crystal or resonator
- Low-power 1kHz RC oscillator for RTC and COP watchdog
 Analog peripherals
- 16-bit SAR ADC w/ DMA support
- 12-bit DAC w/ DMA support
- High speed comparator
 Communication peripherals
- Two 8-bit Serial Peripheral Interfaces (SPI)
- USB dual-role controller with built-in FS/LS transceiver
- USB voltage regulator
- Two I2 C modules
- One low-power UART and two standard UART modules
 Timers
- One 6-channel Timer/PWM module
- Two 2-channel Timer/PWM modules
- 2-channel Periodic Interrupt Timer (PIT)
- Real time clock (RTC)
- Low-power Timer (LPT)
- System tick timer
 Human-Machine Interfaces (HMI)
- General purpose input/output controller
- Capacitive touch sense input interface hardware module
 Clock Source
The Kinetis KL2 microcontrollers feature an on-chip oscillator compatible with three ranges
of input crystal or resonator frequencies: 32-40 kHz (low freq. mode), 3-8 MHz (high freq.
mode, low range) and 8-32 MHz (high freq. mode, high range). The KL25Z128 on the
FRDM-KL25Z is clocked from an 8 MHz crystal.

6 VIDYA JYOTHI INSTITUTE OF TECHNOLOGY, AZIZ NAGAR, HYDERABAD-75


EMBEDDED LAB MANUAL 2018
 USB Interface
The Kinetis KL2 microcontrollers feature a dual-role USB controller with on-chip full-speed
and low speed transceivers. The USB interface on the FRDM-KL25Z is configured as a full-
speed USB device. J5 is the USB connector for this interface.
 Serial Port
The primary serial port interface signals are PTA1 and PTA2. These signals are connected to
both the OpenSDA and to the J1 I/O connector.
 Reset
The PTA20/RESET signal on the KL25Z128 is connected externally to a pushbutton, SW1,
and also to the OpenSDA circuit. The reset button can be used to force an external reset event
in the target MCU. The reset button can also be used to force the OpenSDA circuit into
bootloader mode.

Figure 4 KL25Z and Arduino Compatible signals


 Debug
The sole debug interface on all Kinetis L Series devices is a Serial Wire Debug (SWD) port.
The primary controller of this interface on the FRDM-KL25Z is the onboard OpenSDA
circuit. However, an unpopulated 10-pin (0.05”) Cortex Debug connector, J6, provides access
to the SWD signals. The Samtec FTSH-105-02-F-D or compatible connectors can be added
to the J6 through-hole debug connector to allow for an external debug cable to be connected.
 Capacitive Touch Slider

7 VIDYA JYOTHI INSTITUTE OF TECHNOLOGY, AZIZ NAGAR, HYDERABAD-75


EMBEDDED LAB MANUAL 2018
Two Touch Sense Input (TSI) signals, TSI0_CH9 and TSI0_CH10, are connected to
capacitive electrodes configured as a touch slider. Freescale’s Touch Sense Software (TSS)
provides a software library for implementing the capacitive touch slider.
 3-axis Accelerometer
A Freescale MMA8451Q low-power, three-axis accelerometer is interfaced through an I2 C
bus and two GPIO signals. I2C address is 0x1D (SA0 pulled high).
 RGB LED
Three PWM-capable signals are connected to a red, green, blue LED, D3.

 Input/Output Connectors
The KL25Z128VLK4 microcontroller is packaged in an 80-pin LQFP. Some pins are utilized
in on-board circuitry, but many are directly connected to one of four I/O headers. The pins on
the KL25Z microcontroller are named for their general purpose input/output port pin
function. For example, the 1st pin on Port A is referred to as PTA1. The I/O connector pin
names are given the same name as the KL25Z pin connected to it, where applicable.

Figure 5 Pin Diagram of FRDM XL25Z

8 VIDYA JYOTHI INSTITUTE OF TECHNOLOGY, AZIZ NAGAR, HYDERABAD-75


EMBEDDED LAB MANUAL 2018

Figure 5 Pin Diagram of peripherals in FRDM XL25Z


CONCLUSION:
The internal Architecture of the FRDM KL25Z is studied

9 VIDYA JYOTHI INSTITUTE OF TECHNOLOGY, AZIZ NAGAR, HYDERABAD-75


EMBEDDED LAB MANUAL 2018

LIGHT EMMITING DIODE


A LED has Positive (Anode) and Negative (Cathode) ends. A New LED has its positive end
on the longer ends

DIODE CONFIGURATION

 COMMON ANODE CONFIGURATION requires a active low signal to make LED


glow
 COMMON CATHODE CONFIGURATION requires an active high signal to male
LED glow
SURFACE MOUNTED LED (SME)

10 VIDYA JYOTHI INSTITUTE OF TECHNOLOGY, AZIZ NAGAR, HYDERABAD-75


EMBEDDED LAB MANUAL 2018

TRI COLOR LED

An RGB LED is actually three LEDs, red, green, and blue inside one package. LEDs need to
be turned on and off very fast for dimming (changing the voltage across it does not work like
it does in incandescent bulbs).The on and off times are so fast that human vision does not see
a flicker on the LED and only the average value is perceived. Three PWM output bits would
normally be used so that the brightness of each of the three LEDs can be controlled
independently. In the mbed APIs, three PWM Outs would be used to control the RGB LED.
A PWM value of 0.0 would be off and a 1.0 full on for each color LED. This allows a
program to vary both the color and brightness level of the LED. Typically an RGB LED has
four pins. One common pin and one for each of the three LEDs. In the LED seen below, the
common pin is the longest pin. If hardware PWM pins are not available, SoftPWM can
produce PWM signals on any pin by using software with timer interrupts.

11 VIDYA JYOTHI INSTITUTE OF TECHNOLOGY, AZIZ NAGAR, HYDERABAD-75


EMBEDDED LAB MANUAL 2018

Ex No 2: BLINKING OF LIGHT EMITTING DIODE


DATE:

Aim: To write a Program in Embedded C++ to blink the led for specific time period
Apparatus used:
FRDM KL25Z with Samtec FFSD IDC cable,
Hardware Interfacing Diagram:

ALGORITHM:
Step 1: Initialize the LED1 as digital out pin
Step 2: When the FRDM Board is powered high the while loop is tru and program stats
executing
Step 3: Make LED1 as high and call for a delay for 1 second
Step 4: Make LED2 as low and call for a delay for 1 second
Step 5: Make the program as infinite loop so that the LED blnks

12 VIDYA JYOTHI INSTITUTE OF TECHNOLOGY, AZIZ NAGAR, HYDERABAD-75


EMBEDDED LAB MANUAL 2018

PROGRAM
#include "mbed.h"
DigitalOut myled(LED1);
int main() {
while(1) {
myled = 1;
wait(1);
myled = 0;
wait(1);
}
}

CONCLUSION:
Thus a Embedded C++ program to blink an LED for a stipulated time was written and got
verified.

13 VIDYA JYOTHI INSTITUTE OF TECHNOLOGY, AZIZ NAGAR, HYDERABAD-75


EMBEDDED LAB MANUAL 2018

Ex No 3: BREATH OUT OF LED


DATE:

Aim: To increase and decrease the brightness of the LED alternatively


Apparatus used:
FRDM KL25Z with Samtec FFSD IDC cable,
Hardware Interfacing Diagram:

Program:
#include "mbed.h"
PwmOut led(LED1);
int main() {
while(1) {
for(float p = 0.0; p < 1.0; p += 0.1) {
led = p;
wait(0.2); }
for(float p = 1.0; p > 0.0 ; p -= 0.1) {
led = p;
wait(0.2); } } }
Note: Change the Led pin for different colour led to control its brightness
Conclusion: Thus the brightness of the LED was increased and decreased alternatively.

14 VIDYA JYOTHI INSTITUTE OF TECHNOLOGY, AZIZ NAGAR, HYDERABAD-75


EMBEDDED LAB MANUAL 2018

Ex No 4: COLOR CIRCLE (PATTERN OF GLOWING LED)


DATE:

Aim: To drive different colours from a Tricolor LED using a different combination infinitely
Apparatus used:
FRDM KL25Z with Samtec FFSD IDC cable,
Hardware Interfacing Diagram:

COLOR TABLE:
LED1(Red) LED2 (Green) LED3 (Blue) Color obtained
0 0 0
0 0 1
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 1

15 VIDYA JYOTHI INSTITUTE OF TECHNOLOGY, AZIZ NAGAR, HYDERABAD-75


EMBEDDED LAB MANUAL 2018
PROGRAM:
#include "mbed.h"

DigitalOut rled(LED1);
DigitalOut gled(LED2);
DigitalOut bled(LED3);
int main() {
while(1) {
rled = 0;
gled = 0;
bled = 0;
wait(1);
rled = 0;
gled = 0;
bled = 1;
wait(1);
rled = 0;
gled = 1;
bled = 0;
wait(1);
rled = 0;
gled = 1;
bled = 1;
wait(1);
rled = 1;
gled = 0;
bled = 0;
wait(1);
rled = 1;
gled = 0;
bled = 1;
wait(1);
rled = 1;
gled = 1;
bled = 0;
wait(1);
rled = 1;
gled = 1;
bled = 1;
wait(1);
}
}

Conclusion: A Pattern of LED glowing was demonstrated and got verified.

16 VIDYA JYOTHI INSTITUTE OF TECHNOLOGY, AZIZ NAGAR, HYDERABAD-75

You might also like