TMS570LS Microcontrollers: MibADC Example

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

Exercise: PWM Generation using the N2HET

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

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

TUTORIAL Auto Code Generation for F2806X Target

F28069 ControlCard Lab1

TUTORIAL Auto Code Generation for F2803X Target

F28335 ControlCard Lab1

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

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

ABSTRACT. Table of Contents

HALCoGen TMS570LS31x Help: example_sci_uart_9600.c

What is Functional Safety?

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

Introduction to EZ430 RF2500

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

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

C File System File Functions EXPERIMENT 1.2

Programming in the MAXQ environment

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

Diploma in Embedded Systems

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

Renesas Starter Kit for RX111

CoLinkEx_LPC11C14 EVB Kit User Guide

MSP430 Interface to LMP91000 Code Library

XDS200 ISO Operating Guide

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

Homework 9: Software Design Considerations

Moses Jones Application Note ECE 480 Design Team 7 Programming Altimeters. Using MSP 430 Launch Pad 11/8/2013

UART Devices. ECE 480: Design Team 3. Application Note. By: Hoyoung Jung. Date: 4/3/15

Floating-Point Unit. Introduction. Agenda

MSP430 Interface to LMP91000 Code Library

EPM900 - Overview. Features. Technical Data

Heterogeneous multi-processing with Linux and the CMSIS-DSP library

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

Using Code Composer Studio IDE with MSP432

Application Note: AN00144 xcore-xa - xcore ARM Boot Library

Getting Started with STK200 Dragon

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

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

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

XDS560V2 Installation Guide

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

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

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

Embedded Systems and Software

TUTORIAL Auto Code Generation for F2833X Target

ELEC 3040/3050 Lab Manual Lab 2 Revised 8/20/14. LAB 2: Developing and Debugging C Programs in MDK-ARM for the STM32L100RC Microcontroller

BASICS OF THE RENESAS SYNERGY TM

L2 - C language for Embedded MCUs

Application Note: AN00142 xcore-xa - xcore ARM Bridge Library

Keil uvision development story (Adapted from (Valvano, 2014a))

XC866 Getting Started on EasyKit & Toolkits

Bluetooth 4.0 Development Board (B-DB001 Base Board with B-001 core module)

UART. Introduction. Agenda

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

UT32M0R500-EVB Development Board User Manual

Changing the Embedded World TM. Module 3: Getting Started Debugging

EKK-LM3S811 QUICKSTART

acret Ameya Centre for Robotics & Embedded Technology Syllabus for Diploma in Embedded Systems (Total Eight Modules-4 Months -320 Hrs.

The industrial technology is rapidly moving towards ARM based solutions. Keeping this in mind, we are providing a Embedded ARM Training Suite.

Kinetis SDK Freescale Freedom FRDM-KL03Z Platform User s Guide

STM32L100C-Discovery Board Projects

Debugging in AVR32 Studio

F28027 USB Stick Lab1_3

Delfino TMS320F28377D controlcard R1.1 Information Guide

Figure 26 CC Debugger Interface

Stellaris LM3S3748 Evaluation Kit README FIRST

Introduction to L.A.P. 1

ArduCAM CC3200 UNO board

I Introduction to Real-time Applications By Prawat Nagvajara

General Purpose GUI Overview

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

Software Setup and Introductory Assembly programs for the MSP430 *

Release Notes for ADuCM4x50 EZ-KIT Board Support Pack 1.0.0

LM3S5732 ROM USER S GUIDE ROM-LM3S5732-UG-461. Copyright Texas Instruments Incorporated

ADuC7XXX MicroConverter Get Started Guide

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

CORTEX Microcontroller and Joystick User Guide

A Simple Console Application for Z8 Encore! XP MCUs

Part I. "Hello, world"

Multifunction Serial Interface (PDL_MFS) Features. General Description. When to Use a PDL_MFS Component. Quick Start 1.0

How2Use DT-AVR ATMEGA168 BMS. By: IE Team. Picture 1 The layout of DT-AVR ATMEGA168 BMS

mbed Kit User Guide of NQ62x daughter board

Hibernation Module. Introduction. Agenda

MSP430 Microcontroller Basics

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

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

Comparison of different microcontroller development boards for power electronics applications

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

MicroConverter. QuickStart Development System

Wireless M-Bus Suite for Panasonic Evaluation Boards. Quick Start Guide

muse Capstone Course: Wireless Sensor Networks

SMT943 APPLICATION NOTE 1 APPLICATION NOTE 1. Application Note - SMT372T and SMT943.doc SMT943 SUNDANCE MULTIPROCESSOR TECHNOLOGY LTD.

Getting Started in Assembly Programming with Keil uvision and MSP432

The Road to CCSv4. Status Update

How to: Flash the DC/DC LED Lighting Kit s F28035 controlcard so that it works with the GUI

Basic SigmaDSP Microcontroller Integration

TMS570LS Architecture Overview: Memory Map, Clocking, Exceptions

Transcription:

TMS570LS Microcontrollers: MibADC Example 1

Overview In this example we will: Create a TMS570 HALCoGen Project Generate and import code into Code Composer Studio Write code to take analog to digital (ADC) conversions from the ambient light sensor on the development board (USB Stick or MDK) and display the conversion values to a PC using the SCI (UART) port. Build, deploy and execute the code to the microcontroller Required Hardware: Windows Based PC (WinXP, Vista, 7) TMS570LS2x USB Development Stick or Microcontroller Development Kit Required Software: TMS570 HALCoGen Code Composer Studio v4.x 2

Setting up a New HALCoGen Project Launch HALCoGen Start Programs Texas Instruments HALCoGen File > New > Project Family: TMDX570 Device: TMDX570LS20USB (for USB Stick) OR TMDX570LS20MDK (for MDK) Name: TMS570 MibADC Location: C:\myWorkspace For more help with HALCoGen, see this getting started video: LINK 3

The HALCoGen Interface 4

Configuring the Peripheral Drivers Select the peripherals that are required for this project. In this example we need to enable the SCI and ADC drivers 5

Setting up an ADC Conversion Group The TMS570 has two ADC Modules, each with 3 conversion groups. The ADC Group Event can only be hardware triggered The other groups can use either a software or hardware trigger. We will be using a software trigger. Select the ADC1 Group 1 tab. AD1EVT AD1IN[7..0] ADSIN[15..8] VccAD VssAD VrefHi VrefLo AD2IN[7..0] AD2EVT Self-Test & Calibration MibADC1 MibADC2 Self-Test & Calibration To Peripheral Bus To Peripheral Bus 6

ADC Group 1 Settings We are only making one conversion so set the FiFo Size to 1 At the bottom, in the ADC1 Group 1 Channel Selection area, check the Enable Pin 9 box The ambient light sensor is on ADC 1 Pin 9 7

Generate Code The HALCoGen Settings are now complete, The next step is to generate the code using the File Generate Code menu. 8

HALCoGen Help Information about the files and functions that HALCoGen creates can be found in the HALCoGen Help menu Help can be launched from the main title bar under Help Help Topics 9

Setting up Code Composer Studio 4 Launch Code Composer Studio v4.x (CCS) Start Programs Texas Instruments Code Composer Studio v4 Code Composer Studio v4 When it launches, CCS will ask you to select a workspace, we will chose C:\myWorkspace Once it loads, go to File New CCS Project For more help with Code Composer Studio, see this getting started video: LINK 10

Setting up our Project Our project name needs to match the name of our HALCoGen Project, TMS570 ADC Then Click next On the next page, make sure that your project type is set to ARM and Debug and Release are both checked Then Click next 11

Setting up our Project (cont.) We are not using any referenced projects so click next again 12

Setting up the Project (cont.) Lastly, set the Device Variant to Cortex R and TMS570LS20216SPGE Click Finish 13

Getting Started On the left hand side in the C/C++ Projects explorer, open sys_main.c When ever you generate code in HALCoGen, the program overwrites user code, except specific sections marked by USER CODE BEGIN (x) and USER CODE END For code placement we will be referring to the number within the User Code block /* USER CODE BEGIN (0) */ /* USER CODE END */ 14

Writing the Code Inside User Code 1, copy the code below to include the necessary header files for the project. /* USER CODE BEGIN (1) */ #include sci.h #include adc.h unsigned char command[8]; /* USER CODE END */ 15

Writing the Code cont Then in User Code 3, copy the code below. /* USER CODE BEGIN (3) */ adcdata_t adc_data; //ADC Data Structure adcdata_t *adc_data_ptr = &adc_data; //ADC Data Pointer unsigned int i, 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; for(i=0; i<8; i++) //Convert ADC value into a char array { command[i] = (value>>28)&15; if (command[i] > 9) command[i] +=7; command[i] +=48; value=value<<4; } scisend(scireg1, 2, (unsigned char *)"0x"); //Sends '0x' hex designation chars scisend(scireg1, 8, command); //Sends the ambient light sensor data on the SCI/UART scisend(scireg1, 2, (unsigned char *)"\r\n"); //Sends new line character } /* USER CODE END */ 16

Notifications Lastly we must insert a function that would be called if interrupts were enabled. Without these, the code will fail to build /* USER CODE BEGIN (4) */ /* Notification functions not used, but required by compiler */ void adcnotification(adcbase_t *adc, unsigned group) { return; } void scinotification(scibase_t *sci, unsigned flags) { return; } /* USER CODE END */ 17

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

Creating a Target Configuration Before we begin, we must make a new target configuration, this tells CCS4 what device this project is designed for. Target New Target Configuration A new window will appear, we will make our file name TMS570.ccxml Click Finish 19

Creating a Target Configuration A new tab will appear with a list of emulators and devices. Connection: Texas Instruments XDS100v2 USB Emulator In the text box labeled Type Filter Text, type TMS570. This will narrow the search down to just TMS570 devices, select TMS570LS20216SPGE Click Save on the right 20

Flash Programming Configuration It is possible to make the flash programming process much faster by only the necessary erasing and programming the necessary regions of flash memory. To do so go to Project Properties In the window that appears select CCS Debug In the CCS Debug window select the TMS570LS20216SPGE Flash Settings option in the Target tab. Then select the Necessary Sectors Only option in the Erase Options area, then click the Apply button. NOTE: This option is only available in CCSv4.2 and newer 21

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

Testing your code Upon Completion open your preferred terminal program. Note: A terminal program is included in CCSv4. To enable it go to View -> Other and select Terminal from the Show View menu. (See the next page for more information). Setup the terminal program with the following properties: Baud rate: 9600 Data bits: 8 No parity, 2 Stop bits 23

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

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 Hit the reset button on the board and view the ADC data in the terminal. Use the LED flashlight included with the TMS570 development kit to change the light level supplied to the ambient light sensor on the board. Congratulations! You have completed the example. 25

For More TMS570 Information TMS570 Web Page: www.ti.com/tms570 Data Sheets Technical Reference Manual Application Notes Software & Tools Downloads and Updates Order Evaluation and Development Kits TMS570 Forum: http://e2e.ti.com/support/microcontrollers/tms570/default.aspx News and Announcements Useful Links Ask Technical Questions Search for Technical Content TMS570 WIKI: http://processors.wiki.ti.com/index.php/category:tms570 How to guides Intro Videos General Information 26

Thank You! For completing this TMS570 example 27