This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS570LC4357: RE: TMS570LC4357: Assign Specific Output Pin for PWM signal

Part Number: TMS570LC4357
Other Parts Discussed in Thread: HALCOGEN

I finally figured out how to result the issue I was having in assigning output to spefific pins.  HalCoGen Initialized the pins, then code can be used freely to assign them.  Steps 1-6 are covered in the video https://www.youtube.com/watch?v=O1BlOvi8Sn0.  However, I give some additional information for the specific problem I'm working on.  The order of Steps 1-6 is does not matter and may be different in the referenced video.  Be sure to choose your specific device and not the one in the video.

Step 1: Create New Project in HalCoGen.  I named it PWM.

Step 2: (HalCoGen) Enable all HET1 pins in HalCoGen

Step 3: (HalCoGen) Under HET1 tab, enable PWM0-7 and assign output pins.  I assigned PWM0-->0 ... PWM7-->7 for simplicity.

Step 4: (HalCoGen)  Initialize pin frequencies and duty cycles to whatever arbitrary value.

Step 5: (HalCoGen) Enable HET1 driver.  All are enabled by default.  However, for faster compilation disable all but this one.

Step 6: (HalCoGen) Generate Code (F5).  This will generate the necessary header files for your project to run properly.

Step 7: (CCS) Create new Project in Code Composer Studio as detailed in referenced video.  UI is slightly different in newer version of CCS.

Step 8: (CCS) Once you open the file 'HL_sys_main.c.  Edit only within the USER CODE BEGIN (x) and User CODE END portions to avoid conflicting with the code auto-generated by HalCoGen.  When you generate code using HalCoGen, it overwrites all code outside of these commented sections.  This is also explained in the video if not clear here.  The code I edited is below.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

/* USER CODE BEGIN (0) */
#include "HL_het.h"
#include "HL_system.h"
/* USER CODE END */

/* USER CODE BEGIN (1) */
uint16_t pwmDUTY;                                               // Create a 16 bit integer variables to modify the Duty cycle
hetSIGNAL_t pwmSignal;  // hetSIGNAL_t is a struct which defined in het.h
/* USER CODE END */

/* USER CODE BEGIN (2) */
uint8   emacAddress[6U] =   {0xFFU, 0xFFU, 0xFFU, 0xFFU, 0xFFU, 0xFFU};
uint32  emacPhyAddress  =   1U;
/* USER CODE END */

/* USER CODE BEGIN (3) */
    //gioSetDirection(hetPORT1, 0xFFFFFFFF);
        hetInit();                                                      // Initialize HET driver
        pwmSignal.duty = 25;
        pwmSignal.period = 1000; // us period
        pwmSetSignal(hetRAM1,pwm0,pwmSignal);
        pwmSignal.duty = 50;
        pwmSignal.period = 1000; // us period
        pwmSetSignal(hetRAM1,pwm1,pwmSignal);

        while(1){                                                       // Start an infinite loop

        }
/* USER CODE END */

Step 9: (CCS) Save source file 'HL_sys_main.c'.

Step 10: (Hardware) Check all connections (USB, probes, etc.)

Step 11: (CCS) Run Debug (F11)

Step 12: Wait for Debug to complete.

Step 13: Click Resume (F8)

NOTE: Without making the edits in Step 8, all PWM outputs will be at the values initialized in Step 4.  Step 8 used code to change PWM0 and PWM1 to 25% and 50% respectively.

Step 14: (LaunchPad Board) If red 'ERR' light in on. Press 'RESET' button.  This light sometimes comes on immediately after load or if there is a fault.