7
Lab 1 EENG 3910: Project V - Digital Signal Processing System Design 9/14/2015 Joseph Chandler University of North Texas College of Engineering Electrical Engineering

DSP_Assign_1

Embed Size (px)

Citation preview

Page 1: DSP_Assign_1

Lab 1

EENG 3910: Project V - Digital Signal Processing System Design

9/14/2015

Joseph Chandler

University of North Texas

College of Engineering

Electrical Engineering

Page 2: DSP_Assign_1

IntroductionLab 1 introduces the TivaTM C Series EK-TM4C123GXL. Code Composer Studio (CCS) is used for software support and both the hardware and software are products of Texas Instruments.

Results and Discussion

Problem 1

The first problem is an introduction to CCS. It explains how to configure the TivaTM C Series EK-TM4C123GH6XL. After the hardware parameters are set, a sample program is added to the new project for analysis. The build function is shown and the debug interface is shown.

Problem 2

#include <stdint.h>

This line contains the header file for variable definitions. The header file is already defined in the CCS software. Examples of the values are bit size, precision, and signed or unsigned integers.

#include <stdbool.h>

This line contains the header file for Boolean definitions. The header file is already defined in the CCS software. The file definitions are used for operations, comparing variables, and program control flow.

#include "inc/hw_memmap.h"

This line contains the header file for the Tiva C Series device memory map definitions. The header file contains many of the same definitions used for direct register access. The header file contains macros and definitions to simplify programming the peripheral's registers and interrupt control. The definitions are used by driver libraries and are hidden from the programmer.

#include "inc/hw_types.h"

This line contains the header file for common types and macros. The header file contains many of the same definitions used for direct register access. The values are a wide variety of general use for items such as arithmetic, clock timing, file recognition, and device recognition.

#include "driverlib/sysctl.h"

This line contains the header file for the System Control API definitions and macros. The header file is in the directory "driverlib" of the CCS software. The drivers provide guided control of the peripherals and allows for quick application. Enabling peripherals is an example of this control.

#include "driverlib/gpio.h"

Page 3: DSP_Assign_1

This line contains the header file for GPIO API definitions and macros. The header file is in the directory "driverlib" of the CCS software. The driver provides a set of functions to control the input and output module.

int main(void){

The main process calls and acts on variables, macros, definitions, and other system functions.

uint8_t pin_data=2;

An unsigned 8-bit integer variable is initialized to 2

uint32_t delay_count=2.66e7;

An unsigned 32-bit variable is initialized to 2.66e7

SysCtlClockSet(SYSCTL_SYSDIV_5|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|SYSCTL_OSC_MAIN);System Control Clock Set sets the clocking of the device. Osc_Main configures the oscillator source. XTAL_16MHZ uses a 16 MHZ crystal clock. USE_PLL is a phase locked loop at 400 MHz. SYSDIV_5 divides the clock by the number specified giving control of the frequency

SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);

Enables the peripheral for the general purpose input/output port F

GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3);

This line configures pins for use as GPIO outputs. The first parameter is the base address of the GPIO port. In this application that would be port F. The next parameter is the bit-packed representation of the pins. This function provides proper configuration of the pins without programming registers. Type of output will be the three onboard LEDs that use port F.

while(1) {

The while loop provides a continuous loop when set to "1".

GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3, pin_data);

This line writes a value to the specified pins. The value is contained in the variable "pin_data". The initial state of "pin-data" is 2. Therefore, the value 2 is given to all of the pins. Yet, only one of the pins will correspond to the given value due to a pre-set condition of 2mA, 4mA, and 8mA.

SysCtlDelay(delay_count);

This line provides a delay. The variable "delay_count" holds the value of the delay loop. The constant is 2.66e7. The loop iterates 3 times.

GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3, 0);

Page 4: DSP_Assign_1

This line writes a value to the specified pins. Therefore, the value 0 is given to all of the pins. This essentially clears the LEDs of all "high" input. No LED action.

SysCtlDelay(delay_count);

This line provides a delay. The variable "delay_count" holds the value of the delay loop. The constant is 2.66e7. The loop iterates 3 times.

if(pin_data == 8)

The "if" statement is checking if the current value of the pin variable is equal to 8.

pin_data = 2;

The value of the pin variable is set to 2.

else

The "else" statement is used when the current value of the pin variable is not equal to 8.

pin_data = pin_data*2;

The value of the pin variable is multiplied by 2.

Problem 3

The EK-TM4C123GXL LED clock rates are increased when the number of system divisions are decreased.

SysCtlClockSet(SYSCTL_SYSDIV_10|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|SYSCTL_OSC_MAIN);20 MHz

SysCtlClockSet(SYSCTL_SYSDIV_5|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|SYSCTL_OSC_MAIN);40 MHz

SysCtlClockSet(SYSCTL_SYSDIV_4|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|SYSCTL_OSC_MAIN); 50 MHz

SysCtlClockSet(SYSCTL_SYSDIV_2_5|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|SYSCTL_OSC_MAIN); 80 MHz

Next, the values of the variable "delay_count" were determined for 1 second according to the rise in frequency. The desired frequency was divided by 3 cpu cycles to determine the time delay interval needed in the system variable "delay_count".

uint32_t delay_count=0.66e7; // For about 1s delay at 20 MHz clock rate.20MHZ/3 = 0.67e7

uint32_t delay_count=1.33e7; // For about 1s delay at 40 MHz clock rate.

Page 5: DSP_Assign_1

40MHZ/3 = 1.33e7

uint32_t delay_count=1.66e7; // For about 1s delay at 50 MHz clock rate.50MHZ/3 = 1.67e7

uint32_t delay_count=2.66e7; // For about 1s delay at 80 MHz clock rate.80MHZ/3 = 2.67e7

Finally, the variable "delay_count" was changed to the results above. The result of the LED display is 1 second delay.

Problem 4

An Introduction to the Tiva C Series Platform of Microcontrollers was an overview of TI's next generation of ARM Cortex M4 processors. The report on the new microprocessors boasted of the new 32-bit architecture and high precision. The series has a large instruction set and better resolution for capturing samples of analog signals and converting them to digital. Multi-tasking and real-time application has greatly improved. Also, the durability has improved along with low energy consumption.

TivaWare Peripheral Driver Library is a set of drivers that make the TIVA C Series easier to program. They are written in C for the most part and efficient. There are multiple software packages that are available to use all the drivers are mapped out for direct register access. The driver library can be used along with direct register access for more efficient programming. The general purpose input/output module has 8 pins that can be configured as an input or an output with different capabilities. Also, more than one pin can be operated on at one time. The system control gives more flexibility with abilities to change frequency, timing, clock-type, energy use, and three different operating modes.

The TM4C123GH6PM Microcontroller Overview gives detailed information about the Core, Performance, Flash, System SRAM, EEPROM, Internal ROM, Security, Communication Interfaces, System Integration, Advanced Motion Control, Analog Support, and hardware layout.

The three LEDs are connected through port F of the GPIO module. The schematic shows the three LEDs have diodes controlling the input. The diodes turn on for the gates that correspond to 2, 4, and 8. This refers to the mA that activates each LED. If it does not contain the right amount of mA the transistor is not activated. Each iteration of the loop sends a "0" or "off" to all the gates before the new loop iteration is calculated.

Summary and ConclusionThe Tiva C Series TM4C123G Microcontroller was attached by USB to the CPU and there were not any problems with powering on or compatibility with Windows 7. CCS was very user friendly and offered different hardware implementation. The programs were built without error and ran according to plan. CCS programs used software drivers to map most of the hardware and applications.

Page 6: DSP_Assign_1

References Texas Instruments. (2014). TivaWare Peripheral Driver Library: User's Guide. Austin, Texas: TI.