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/TMS570LS0432: Can't select N2HET Pin for PWM

Part Number: TMS570LS0432
Other Parts Discussed in Thread: HALCOGEN

Tool/software: Code Composer Studio

Hi,

i have generated with the HET IDE a simple code to generate a pwm on my TMS570 Launchpad. This part is working and i am able to set the frequency and the duty cycle in sys_main.c like the code below:

/*This code is working well*/

int main(void)
{
/* USER CODE BEGIN (3) */
    HETPROGRAM0_UN * pHETprogram;


    hetInit();

    pHETprogram = (HETPROGRAM0_UN*)hetRAM1;


    pHETprogram -> Program0_ST.L00_0.cnt.max = 2047;
    pHETprogram -> Program0_ST.L01_0.ecmp.data = 2000;


    while(1)
    {

    }
/* USER CODE END */

    return 0;
}

This part is working well. But everytime i am trying to select the pin manually there is no output signal at the selected pin. I have already set the wanted pin in HALCOGEN as output. Does someone know what is the problem or can help me to find the solution?

/*This code doesen't generate an output signal*/

int main(void)
{
/* USER CODE BEGIN (3) */
    HETPROGRAM0_UN * pHETprogram;


    hetInit();

    pHETprogram = (HETPROGRAM0_UN*)hetRAM1;


    pHETprogram -> Program0_ST.L00_0.cnt.max = 2047;

    pHETprogram -> Program0_ST.L01_0.ecmp.pin_select = 0;       //With this line there is no output signal.
    pHETprogram -> Program0_ST.L01_0.ecmp.data = 2000;


    while(1)
    {

    }
/* USER CODE END */

    return 0;
}

  • Mohammad,

    For the version of code that works, what pin is the output coming on? I believe this should be a pin that you selected when configuring NHET within the Halcogen tool. Also, if you want to change this on the fly as you have shown, you would need to also insure that new pin is configured properly as an output pin and, if muxed behind other functionality by default, enabled via the pinmux feature prior to selecting it.
  • Thanks for your reply.

    For the working version pin 2 is setting as output. The new pin 0 is also setting as output when configuring NHET within Halcogen. But the problem is just the same. I can not change the pin within my main code.
  • No one is there who can help?

  • I was finally able to solve the problem. Like the last post you need to set the wanted pins as outputs. The working code which is able to change the pin within the main code is shown below:

    #include "sys_common.h"

    /* USER CODE BEGIN (1) */
    #include "het.h"
    #include "TEST.h"
    /* USER CODE END */

    /** @fn void main(void)
    *   @brief Application main function
    *   @note This function is empty by default.
    *
    *   This function is called after startup.
    *   The user can use this function to implement the application.
    */

    /* USER CODE BEGIN (2) */
    /* USER CODE END */

    int main(void)
    {
    /* USER CODE BEGIN (3) */
        HETPROGRAM0_UN * pHETprogram;





        pHETprogram = (HETPROGRAM0_UN*)hetRAM1;

        hetInit();

        pHETprogram -> Program0_ST.L00_0.cnt.max = 2047;

        pHETprogram -> Program0_ST.L01_0.ecmp.data = 500;

    //Steps to change the pin
        pHETprogram -> Program0_ST.L01_0.ecmp.pin_select = 2;
        pHETprogram -> Program0_ST.L01_0.ecmp.en_pin_action = 1;
        pHETprogram -> Program0_ST.L01_0.ecmp.sub_opcode = 0;
        pHETprogram -> Program0_ST.L01_0.ecmp.pin_action = 0;
        pHETprogram -> Program0_ST.L01_0.ecmp.opposite_action = 1;


        while(1)
        {


        }
    /* USER CODE END */

        return 0;
    }

  • Mohammed,

    Great to hear you solved it. Please let us know if there are any other questions that come up.