Exercise: PWM Generation using the N2HET

Similar documents
TMS570LS Microcontrollers: MibADC Example

TMS570LS Microcontrollers: Using the NHET as a General Purpose I/O Pin

TMS470M. Cortex -M3 based Hercules Microcontrollers ARM. 1 Day Workshop

Hercules TM Safety Microcontrollers. Introduction to Hercules ARM Cortex TM -R4F MCUs

F28069 ControlCard Lab1

QUICKSTART CODE COMPOSER STUDIO Stellaris Development and Evaluation Kits for Code Composer Studio

HALCoGen TMS570LS31x Help: example_sci_uart_9600.c

F28335 ControlCard Lab1

Getting Started in C Programming with Keil MDK-ARM Version 5

TUTORIAL Auto Code Generation for F2803X Target

Getting Started in C Programming with Keil MDK-ARM Version 5

User Manual. LPC-StickView V3.0. for LPC-Stick (LPC2468) LPC2478-Stick LPC3250-Stick. Contents

Quick Start Guide TRK-KEA. Kinetis EA Series MCUs for Automotive Electronics Applications. StarterTRAK

Hercules ARM Cortex -R4 System Architecture. Processor Overview

TUTORIAL Auto Code Generation for F2806X Target

Using Code Composer Studio IDE with MSP432

What is Functional Safety?

Lab 0 Introduction to the MSP430F5529 Launchpad-based Lab Board and Code Composer Studio

Getting Started in C Programming with Keil MDK-ARM Version 5

You have a PC with a USB interface, running Microsoft Windows XP (SP2 or greater) or Vista You have the Workshop Installation Software Flash Drive

ABSTRACT. Table of Contents

Note that FLIP is an Atmel program supplied by Crossware with Atmel s permission.

System Framework Overview Guide and Instructions on How to Use the Template Projects

User Manual. LPC-StickView V1.1. for LPC-Stick. Contents

Section Objective: Acquaint with specifications of Launchpad Acquaint with location of switches, LEDs, power-on switch, powering the board.

Debugging in AVR32 Studio

UART Implementation Using the N2HET

Floating-Point Unit. Introduction. Agenda

UART Bootloader for Hercules TMS570LS04x MCU

Migrating from CubeSuite+ to Eclipse RL78 Family

Getting Started with Qorivva Fast

As CCS starts up, a splash screen similar to one shown below will appear.

DAVE 3 Hands on / Quick Start Tutorial. Presentation Tutorial Start 1 v1.1: Creating a simple Project using PWM and Count Apps

TWR-KV10Z32 Sample Code Guide for IAR Board configuration, software, and development tools

Installation and Quick Start of isystem s winidea Open in DAVE. Tutorial Version 1.0, May, 2014

Programming in the MAXQ environment

ArduCAM CC3200 UNO board

Section 2: Getting Started with a FPU Demo Project using EK-LM4F232

Hibernation Module. Introduction. Agenda

TUTORIAL Auto Code Generation for F2833X Target

Quick Start Guide TWR-S08PT60. 5-Volt S08P Family of 8-bit MCUs for Industrial and Appliance Applications TOWER SYSTEM

Diploma in Embedded Systems

Start a New Project with Keil MDK-ARM Version 5 and ST Micro Nucleo-F446RE

SKP16C26 Tutorial 1 Software Development Process using HEW. Renesas Technology America Inc.

As CCS starts up, a splash screen similar to one shown below will appear.

Release Notes for ADSP-CM41x EZ-Kit Lite Board Support Package For Keil MDK

ECGR 4101/5101, Fall 2016: Lab 1 First Embedded Systems Project Learning Objectives:

TWR-KV10Z32 Sample Code Guide for CodeWarrior Board configuration, software, and development tools

A tool based estimation computation method of MCU random failure rate &functional safety metrics

APPENDIX A. CODE COMPOSER STUDIO (CCS) v5: A BRIEF TUTORIAL FOR THE DSK6713

Freescale Semiconductor Inc. Vybrid DS-5 Getting Started Guide Rev 1.0

User s Guide IoT Microcontroller Development Kit

ECE2049 Embedded Computing in Engineering Design. Lab #0 Introduction to the MSP430F5529 Launchpad-based Lab Board and Code Composer Studio

Hands-On with STM32 MCU Francesco Conti

XC866 Getting Started on EasyKit & Toolkits

Software Installation Guide for S32 Design Studio IDE (S32DS): FRDM-KEAZ128Q80 FRDM-KEAZ64Q64 FRDM-KEAZN32Q64

Copyright 2015 by Stephen A. Zajac & Gregory M. Wierzba. All rights reserved..spring 2015.

UART. Introduction. Agenda

Reduce SW Development Time with DAVE 3. March, 2012

XC2287M HOT. Solution ASC. Uses a timer triggered LED to toggle with ASC Interrupt

XDS560V2 Installation Guide

Zigbee Development Board (Z- DB001) with Z-001 or Z-002 Module

Interfacing TPS65381 With Hercules Microcontrollers

PSIM Tutorial. How to Use SimCoder with TI F28335 Target Powersim Inc.

CoLinkEx_LPC11C14 EVB Kit User Guide

F28027 USB Stick Lab1_3

Getting Started With the Stellaris EK-LM4F120XL LaunchPad Workshop. Version 1.05

Homework 9: Software Design Considerations

Hercules ARM Cortex -R4 System Architecture. Memory Protection Unit (MPU)

LDC1000 SENT Bridge MSP-EXP430F5529LP based Getting Started

EKK-LM3S811 QUICKSTART

Lab 1 Introduction to Microcontroller

Introduction to EZ430 RF2500

Contents. About This Guide... 2 Audience... 2 Revision History... 2 Conventions... 3 Definitions, Acronyms, and Abbreviations... 3

MSP430 Interface to LMP91000 Code Library

ATOLLIC TRUESTUDIO FOR STM32 QUICK START GUIDE

MSP430 Interface to LMP91000 Code Library

UT32M0R500-EVB Development Board User Manual

Use Vivado to build an Embedded System

BASICS OF THE RENESAS SYNERGY TM

BASICS OF THE RENESAS SYNERGY TM

Cookery-Book, V1.0, February XMC1400 BootKit HelloWorld

Project Debugging with MDK-ARM

Emulating Dual SPI Using FlexIO

STM32 Ecosystem workshop. T.O.M.A.S Team

Getting Started with the Texas Instruments ez430

1. Opening the sample code workspace Loading the selected sample code project and Opening sample code source files... 5

DAVE (Version 4) Introduction

XC2287M HOT. Solution CAN_2 Serial Communication using the CAN with external CAN BUS

DEVKIT-MPC5748G QUICK START GUIDE (QSG) Ultra-Reliable MCUs for Industrial and Automotive Applications. EXTERNAL USE

Hands on Experience with AVR32

ADC Data Capture using Capture Demo and CCS Memory Browser IWR14xx/AWR14xx example. Document Version V

Base Timer Channel (BT) Features. General Description. When to Use a PDL_BT Component 1.0

TMS320C5502 ezdsp Quick Start Guide

VORAGO VA108x0 GCC IDE application note

POWERLINK Slave Xilinx Getting Started User's Manual

EMBEDDED SYSTEMS: Jonathan W. Valvano INTRODUCTION TO THE MSP432 MICROCONTROLLER. Volume 1 First Edition June 2015

Getting Started with MCUXpresso SDK CMSIS Packs

Getting Started with Qorivva Fast

MEM MEM Control Applications of DSP. Lab 2. Project Creating & GPIO DSP28355 & CCSv5

Transcription:

Exercise: PWM Generation using the N2HET 1

Overview In this exercise we will: Create a new HALCoGen Project Configure HALCoGen to generate A basic PWM with a period of 1 second and a duty cycle of 75% Use the PWM to toggle the NHET[8] LEDs on the board Generate and Import code into Code Composer Studio Build and Deploy our code to the microcontroller Required Hardware: Windows Based PC (WinXP, Vista, 7) TMS570LS04 LaunchPad or RM48 LaunchPad Required Software: HALCoGen Code Composer Studio 2

HALCoGen GUI Overview Menus and Icons Help Module Selection/Configuration Device Block Diagram Device/ Output File Explorer Output/Status 3

HALCoGen Help HALCoGen s embedded help window provides full documentation of each communication drivers, implemented functions, file dependencies and examples. 4

HALCoGen File Dependencies and Function Listing File Information Control File Explorer File Dependency Diagram Function Listing 5

Set up a New HALCoGen Project To launch HALCoGen go to: Programs Texas Instruments Hercules HALCoGen Create a new project: File New Project 1 For the TMS570 Kit: Choose Family: TMDX570LS04x Device:TMDX570LS0432PZ For the RM42 Kit: Choose Family: RM42x Device:RM42PZ 2 3 Then define a name: N2HET Location: C:\myWorkspace 6

Driver Enable In Driver Enable tab enable the HET1 driver. 1 2 3 7

N2HET PWM Configuration In Driver Enable tab enable the NHET driver. In HET1 PWM 0-7 tab: Configure PWM 0 to 75% Duty Cycle, with a Period 1000000.00uS on Pin 8 8

N2HET Output Configuration In the HET1 Pin 0-7 tab: Make sure that the output on Pin 8 is enabled 2 1 Generate Code: File Generate Code 9

Setting up Code Composer Studio Launch Code Composer Studio (CCS) Start Programs Texas Instruments Code Composer Studio v5 Code Composer Studio v5 When it launches, CCS will ask you to select a workspace, we will chose C:\myWorkspace Once CCS loads, go to File New CCS Project 10

Setting up our Project From the New Project window, expand the Code Composer Studio folder. Select CCS Project Click Next NOTE: This step may not be required. Only some versions on CCS require this step. 1 2 3 11

Setting up our Project Our project name needs to match the name of our HALCoGen Project, Exercise Make sure that your project Family is set to ARM 1 Next, set the Variant to Cortex R For the TMS570 kits: Choose: TMS570LS043x 2 3 For the RM42 kits: Choose : RM42L432 5 4 Then set the Connection to the Texas Instruments XDS100v2 6 Then click Finish 12

Setting up our Project First delete expand the project and delete file main.c from CCS Project Explorer Note: CCSv5.2 and earlier will create a file named main.c automatically when a new project is created. Since we are using code that HALCoGen created for us, we will not need this file. This step is not necessary when creating a new empty project with CCSv5.3 and newer. 1 N2HET 2 13

Setting up our Project Drag the HalCoGen created folders to the CCS Project

Setting up our Project Following window pop out Choose Link to files and recreate Check box Create link locations relative

Setting up our Project Next we need to add our include directory to the project from the CCS Project Explorer Right click on the N2HET project in the Project Explorer 1 Then choose Properties 2 16

Setting up our Project Then in the Properties window expand the Build -> ARM Compiler category and select Include Options 1 2 Then select the + button to add the directory with our.h header files 3 4 In the Add directory path window, click the Workspace button Finally, put "${PROJECT_LOC}../../inc lude/ and click OK 17

Enter Code into the CCS Project Expand the project and open the sys_main.c file from the CCS Project Explorer Note: Since the HALCoGen and CCS project have the same project name, all the startup and driver files generated by HALCoGen will be automatically included in the CCS project. Use the sys_main.c file for your main program code. 18

Code Composer Studio In the Code Composer Project and enter the following code: Inside User Code 1, insert the code below. /* USER CODE BEGIN (1) */ #include "het.h" /* USER CODE END */ Then in User Code 3, insert the code below. /* USER CODE BEGIN (3) */ hetinit(); while(1); /* USER CODE END */ 19

Compiling the Project The code is now complete and we are ready to build our project. Go to Project Build All Now that we have our.out file, we need to program the microcontrollers Flash memory. 20

Programming the Flash We are now ready to program the flash. Go to Run Debug A new window should appear as it programs the flash memory. This may take a few moments. 21

Testing our Program Click the green arrow on the debug tab to run our program Alternatively the program can be run without the debugger connected by Clicking the red square on the debug tab to terminate the debugger s connection Hitting the reset button on the board and observe the behavior of the N2HET LEDs Congratulations! You have completed the exercise. 22

Exercise: Using the MibADC to collect Ambient Light Sensor data percentage df 23

ADC Exercise Overview In this exercise we will: Acquire data from the ambient light sensor using the ADC module Send the converted ADC value back through the SCI/UART module to the PC. 00111011000100100110 24

Set up a New HALCoGen Project To launch HALCoGen go to: Programs Texas Instruments Hercules HALCoGen Create a new project: File New Project 1 For the TMS570 Kit: Choose Family: TMDX570LS04x Device:TMDX570LS0432PZ For the RM42 Kit: Choose Family: RM42x Device:RM42PZ 2 3 Then define a name: ADC Location: C:\myWorkspace 25

Driver Enable Enable the SCI and ADC drivers in the Driver Enable sub tab of the device 26

SCI Configuration Select the SCI2 tab and then the SCI/LIN Data Format subtab Ensure that the SCI module is setup with the following parameters: Baud rate: 9600 Data bits: 8 No parity, 2 Stop bits 27

ADC Group Configuration In the ADC tab and ADC Group 1 Subtab, Configure FIFO Size, Trigger Source and ADC channel as shown below Only one conversion per software trigger is done SW Trigger as Trigger Source Ambient light sensor is connected to MibADC1 Pin9 Generate code: File Generate Code or click 28

MibADC Exercise Insert the following code in the corresponding sections within the sys_main.c file USER CODE BEGIN (0) - #include header section /* USER CODE BEGIN (0) */ #include "sci.h" #include "adc.h" #include "stdlib.h" unsigned char command[8]; /* USER CODE END */ 29

MibADC Exercise USER CODE BEGIN(3) - Main() section void main(void) {/* USER CODE BEGIN (3) */ adcdata_t adc_data; //ADC Data Structure adcdata_t *adc_data_ptr = &adc_data; //ADC Data Pointer unsigned int NumberOfChars, value; //Declare variables sciinit(); //Initializes the SCI (UART) module adcinit(); //Initializes the ADC module while(1) // Loop to acquire and send ADC sample data via the SCI (UART) { adcstartconversion(adcreg1, 1U); //Start ADC conversion while(!adcisconversioncomplete(adcreg1, 1U)); //Wait for ADC conversion adcgetdata(adcreg1, 1U, adc_data_ptr); //Store conversion into ADC pointer value = (unsigned int)adc_data_ptr->value; NumberOfChars = ltoa(value,(char *)command); scisend(scilinreg, 2, (unsigned char *)"0x"); //Sends '0x' hex designation chars scisend(scilinreg, NumberOfChars, command); //Sends the ambient light sensor data scisend(scilinreg, 2, (unsigned char *)"\r\n"); //Sends new line character } /* USER CODE END */} 30

Testing your code Upon completion open your preferred terminal program. Note: A terminal program is included in CCS. To enable it go to View -> Other and select Terminal from the Show View menu. If the Terminal option is not available it can be added as an eclipse plug-in by following these instructions: http://processors.wiki.ti.com/index.php/how_to_install_the_terminal_plugin_in_ccsv5 Setup the terminal program with the following properties: Baud rate: 9600 Data bits: 8 No parity, 2 Stop bits Click the Run button to run the program Now you should see the ADC results in the terminal program Use the LED flashlight included in the development kit to change the light level supplied to the ambient light sensor on the board and notice the output values change in the terminal program. 31

Enabling the CCS Terminal 1) Select View Other 3) Enter the proper communication settings for the Terminal Tab 2) Then select Terminal from the Show View menu. 32

Additional Hercules Information 33

Additional Information Hercules Web Page: www.ti.com/hercules RM4 Web Page: www.ti.com/rm4 TMS570 Web Page: www.ti.com/tms570 TMS470M Web Page: www.ti.com/tms470m Data Sheets Technical Reference Manual Application Notes Software & Tools Downloads and Updates Order Evaluation and Development Kits Engineer 2 Engineer Support Forum: www.ti.com/hercules-support News and Announcements Useful Links Ask Technical Questions Search for Technical Content Hercules WIKIs: RM4 WIKI: www.ti.com/hercules-rm4-wiki TMS570 WIKI: www.ti.com/hercules-tms570-wiki TMS470M WIKI: www.ti.com/hercules-tms470m-wiki How to guides Intro Videos General Information 34

Want Additional Training? Safety Critical Design and Programming with Hercules Microcontrollers: Day 1 Day 2 Day 3 Welcome and Intro Hercules Product Overview / MCU Roadmap Safety Standards and Hercules Safety Features / Exercise HALCoGen / Exercise Code Composer Studio / Demonstration Compiler Flash Overview Flash Tools: nowflash, nowecc / Exercise Summary / Questions ARM Cortex -R4F CPU System Module Overview Device setup/startup, Real Time Interrupt Module, Vectored Interrupt Manager CRC Controller, CPU Compare Module, Error Signaling Module, Dual Clock Compare, JTAG Security Module General Purpose I/Os / Exercise Direct Memory Access Controller (DMA) Serial Communication Interface (SCI/UART) / Exercise Summary / Questions Multi-Buffer ADC (MIBADC) / Exercise Multi-Buffer Serial Peripheral Interface (SPI / MIBSPI-P) DCAN FlexRay External Memory Interface (EMIF) / Parameter Overlay Module (POM) Ethernet USB Host / Device HET (High End Timer) IDE N2HET & Transfer Unit / Exercise Summary / Questions / Survey 35

Thank You! Please fill out the Training Class Survey 36