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.

CCS/RM48L952: PWM generation without using HALCogen

Part Number: RM48L952
Other Parts Discussed in Thread: DRV8301, HALCOGEN

Tool/software: Code Composer Studio

Hey there,

I am using TMDXRM48(Control Card) which is placed on DRV8301 kit in order to control the motor operation.

Without using HALCogen, I know that gioInit() and hetInit() are used for GPIO and HET initialization in Code Composer Studio(CCS).

Please help me in

 How can I set my pwm direction?

How can I enable my pwm pin?

How can I define pointers for setting up the duty cycle and period? 

Do tell me if all these things could be done using gpio pins.

but please dont refer any step of HALCogen.

Best Regards,

Hamid 

  • Hello Hamid,

    First, I am curious what your objections to using HalCoGen are? This is the primary reason for having the tool is to streamline the generation of code for use in a project.

    None the less, it sounds like you are not interested in using the N2HET IP either as it seems you want to bit band the PWM on a GPIO?

    Some of your questions are confusing to me and we will need to have some clarifications to proceed.

    hamid trump said:
     How can I set my pwm direction?

    I am not certain what you mean by this question. A PWM has no specific direction. It is generally described by means of a duty cycle and frequency. If you are referring to the direction of the pin, please refer to the TRM SPNU503b and more specifically, the description of the HETDIR register which is used to define the HET pins as either input or output.

    hamid trump said:
    How can I enable my pwm pin?

    Again, in this context, this question is not clear. If you are bit banging the PWM, there is no need to 'enable' the pwm as you would simply set the pin direction, then alternately set and clear the pin using the HETDSET and HETDCLR registers.

    hamid trump said:
    How can I define pointers for setting up the duty cycle and period

    You would define pointers the same as you would for any other pointer to the variables you are using to define the loop counters in your bit banging code.

    hamid trump said:
    Do tell me if all these things could be done using gpio pins.

    If you are bit banging as it seems, you could use any of the pins on the device that have GPIO capability. Each specific module such as CAN, SPI, MibSPI, SCI, etc. have similar DIR, DSET, and DCLR registers; however, since GPIO is not the primary function in these other modules, you will also need to define which pins are to be used in functional mode and which in GPIO mode. There is also a register for this purpose as well in these modules.

    With all the above stated, I would also encourage you to review the N2HET module functionality in the Technical Reference Manual. This module is a programmable timer that has its own micromachine that processes N2HET instructions to generate PWMs autonomously from the MCUs R4F CPU. This allows the PWM generation to be completed with little or no burden on the CPU. In order to generate the PWM, you would need to generate a simple PWM program using the N2HET instruction set and assemble it using the N2HET assembler. Once assembled, the object code can be included in your project and placed into N2HET RAM for execution.

  • Hello Hamid,

    I've done some additional searching for material that might be helpful for you and there is a series of YouTube videos that might be of key interest to you. The series is called TI High End Timer (HET) and was made by a user of the TI Hercules devices. The 3 part series on how to use the tools to create the HET program in the HET IDE, HET Assembler, and how to integrate this into your project would be of greatest value to you. These three videos are located at the links below:

    Part 1: TI Hercules LaunchPad: HOW TO use the HET IDE and assembler language - part 1

    Part 2: TI Hercules LaunchPad: HOW TO use HET - part 2

    Part 3: TI Hercules LaunchPad: HOW TO use HET - part 3

    In addition, you can get the HET IDE from the TI Wiki under the tools category located at this link: http://processors.wiki.ti.com/index.php/Category:RM4#Tools_.26_Software