NOTICE: The Processors Wiki will End-of-Life on January 15, 2021. It is recommended to download any files or other content you may need that are hosted on processors.wiki.ti.com. The site is now set to read only.

C6747 EHRPWM Example

From Texas Instruments Wiki
Jump to: navigation, search

Important Note:

The software discussed on this site is available for download, but is no longer being actively developed. This wiki is in maintenance mode and the software is supported on C67x Single core DSP E2E forum


Project Purpose[edit]

This is an example project for the C6747 EHRPWM module (although this can be used on the OMAP-L137's DSP as well). This example serves to function as a basic starting point for a DSP/BIOS-based project which utilizes the PWM module. The EHRPWM is configured to output a shifting duty cycle which is modified via interrupts at the end of each PRD.

Necessary Hardware/Software[edit]

OMAP-L137/C6747 EVM + semi-populated Prototype Board

While this code should be easily adaptable to something other than what is listed below the hardware and software listed below was used to verify the project.

Hardware[edit]

This project was built and tested using the OMAP-L137/C6747 EVM in addition to the OMAP-L137 EVM Prototype Board. The prototype board was used to allow for access to the EPWM0A output pin for measurement/verification.

Software[edit]

This software was built using CGT v6.1.11 and DSP/BIOS 5.33.06 with CCS v3.3 SR 12.1. It has also been tested with CGT v6.1.10. The code requires the cslr from PSP 1.20.00.

NOTE that much of the initialization code was copied from the EVM GEL file and modified into cslr code.

Project Contents[edit]

This project (downloaded here:C6747_EHRPWM_interrupt_bios.zip) contains the following source files:

  • C6747_EHRPWM_example.c
  • Peripheral_Init.c
  • defines.h

as well as the BIOS configuration file

  • c6747_ehrpwm_interrupt.tcf

NOTE that during the build process several other BIOS-related files will be generated including C6747_EHRPWM_interruptcfg.cmd. Do not be alarmed if you receive a missing file dialog box the first time you open the project. Simply rebuild and the remaining files should populate themselves in the project folder.

C6747_EHRPWM_example.c[edit]

This file contains the main function as well as the ISR function EhrpwmIsr(). Main() simply calls into Peripheral_Init() which then initializes all necessary peripherals (see below). The EhrpwmIsr() simply acknowledges the EHRPWM interrupt by clearing a bit, then either increments or decrements the CMPA value. This shifting CMPA value changes the duty cycle of the output. When the CMPA value reaches a pre-defined min or max value the output is then turned the opposite direction.

Peripheral_Init.c[edit]

This file contains all of the peripheral initialization code that this project requires.

NOTE that if you plan on plugging this code into another project or using it on something other than the C6747/OMAP-L137 EVM that you may need to modify or remove some pieces of this code's initialization. For example, the PLL initialization may need to change for custom hardware or the PINMUX registers could require additional modification so that the appropriate pins are configured.

This file is responsible for:

  • Configuring the PLL
  • Powering up the necessary peripherals (PSC0 and PSC1)
  • Configuring the necessary pins (PINMUX)
  • Enabling up interrupts (IER)
  • Initializing EHRPWM0

Each function in this file need only be called a single time at system startup.

defines.h[edit]

This file holds all of the #includes each file needs as well as some symbol definitions.

Setting up the Prototype Board[edit]

The prototype board ships almost completely unpopulated, so some simple work is necessary. First off, the J1 header must be populated to as to gain access to the EPWM0A pin (J1.29). Once this header is populated, simply flip SW1.4 ON so as to route the EPWM0A pin to the header. Finally, plug the prototype board onto the C6747 EVM.

Rebuilding the Project[edit]

The project was built assuming default installation for the PSP (C:\Program Files\Texas Instruments\pspdrivers_01_20_00\packages). If the PSP is installed elsewhere you will need to modify the Include Search Path inside the Project->Build Options->Compiler tab->Preprocessor Category to point to the proper location.

NOTE that the cslr_ehrpwm.h header includes 5 multiple redefinition warnings. This has been submitted as a bug #SDOCM00060340. For the purposes of this project it poses no risk to proper operation.

Execution[edit]

Now load the .out file to the DSP and execute the code. You should now be able to see the EPWM0A output 'shifting' left and right across an oscilloscope.

Extras[edit]

You can download a movie file (.m4v extension) which illustrates the shifting of the EPWM0A output.

E2e.jpg {{
  1. switchcategory:MultiCore=
  • For technical support on MultiCore devices, please post your questions in the C6000 MultiCore Forum
  • For questions related to the BIOS MultiCore SDK (MCSDK), please use the BIOS Forum

Please post only comments related to the article C6747 EHRPWM Example here.

Keystone=
  • For technical support on MultiCore devices, please post your questions in the C6000 MultiCore Forum
  • For questions related to the BIOS MultiCore SDK (MCSDK), please use the BIOS Forum

Please post only comments related to the article C6747 EHRPWM Example here.

C2000=For technical support on the C2000 please post your questions on The C2000 Forum. Please post only comments about the article C6747 EHRPWM Example here. DaVinci=For technical support on DaVincoplease post your questions on The DaVinci Forum. Please post only comments about the article C6747 EHRPWM Example here. MSP430=For technical support on MSP430 please post your questions on The MSP430 Forum. Please post only comments about the article C6747 EHRPWM Example here. OMAP35x=For technical support on OMAP please post your questions on The OMAP Forum. Please post only comments about the article C6747 EHRPWM Example here. OMAPL1=For technical support on OMAP please post your questions on The OMAP Forum. Please post only comments about the article C6747 EHRPWM Example here. MAVRK=For technical support on MAVRK please post your questions on The MAVRK Toolbox Forum. Please post only comments about the article C6747 EHRPWM Example here. For technical support please post your questions at http://e2e.ti.com. Please post only comments about the article C6747 EHRPWM Example here.

}}

Hyperlink blue.png Links

Amplifiers & Linear
Audio
Broadband RF/IF & Digital Radio
Clocks & Timers
Data Converters

DLP & MEMS
High-Reliability
Interface
Logic
Power Management

Processors

Switches & Multiplexers
Temperature Sensors & Control ICs
Wireless Connectivity