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.

TMS570LS1227: TMS570LS1227 HET1 configure for PWM output

Part Number: TMS570LS1227
Other Parts Discussed in Thread: HALCOGEN

Hi,

For our Project Requirement, we require 20 PWM outputs.

In TMS570LS1227PGE, N2HET1 peripheral has 32 channels and each could be configured as PWM outputs. N2HET2 peripheral has 9 channels out of which 6 channels are shared with N2HET1. So total 32+9-6 = 35 PWM outputs can be configured as per the datasheet.

But HALCoGen software tool (we are using this tool to configure the I/O of microcontroller) is allowing only 8 PWM outputs in N2HET1 and 8 PWM outputs in N2HET2.

So from the HALCoGen software tool, we are able to configure only 16 PWM outputs using N2HET. Is the software tool restricting or the microcontroller itself has the limitation to configure only 16-PWM at a time?

Is there a sample code to configure all 32 channels of N2HET1 as PWM output?
Thanks!

  • Hi Abrar,

    The HALCoGen only provides the configurations for 8-PWM, 8-edge counter, and 8-input capture. You can configure all the channels (NHET1, NHET2) for PWM.

    I don't have example code to configure 32 channels PWM. HET IDE is good tool to generate PWM code, and do the simulation.
    http://www.ti.com/tool/HET_IDE
  • Hi,
    Thanks for your message.
    I found that the code generated by halcogen is different from the code generated by HET IDE. HET IDE does not display HET1, HET2 separately.
    Do you suggest to use a combination of both Halcogen & HET IDE to generate 32 channels of N2HET1 as PWM output?

    The code generated by halcogen (V 04.06.00) for HET1 is as follows:
    static const hetINSTRUCTION_t het1PROGRAM[58U] =
    {
    /* CNT: Timebase
    * - Instruction = 0
    * - Next instruction = 1
    * - Conditional next instruction = na
    * - Interrupt = na
    * - Pin = na
    * - Reg = T
    */
    {
    /* Program */
    0x00002C80U,
    /* Control */
    0x01FFFFFFU,
    /* Data */
    0xFFFFFF80U,
    /* Reserved */
    0x00000000U
    },
    /* PWCNT: PWM 0 -> Duty Cycle
    * - Instruction = 1
    * - Next instruction = 2
    * - Conditional next instruction = 2
    * - Interrupt = 1
    * - Pin = 28
    */
    {
    /* Program */
    0x000055C0U,
    /* Control */
    (0x00004006U | (uint32)((uint32)28U << 8U) | (uint32)((uint32)3U << 3U)),
    /* Data */
    0x00000000U,
    /* Reserved */
    0x00000000U
    },
    .....
    }

    The code generated by HET IDE (V 03.05.01) is as follows:
    HET_MEMORY const HET_INIT0_PST[7] =
    {

    /* L00_0 */
    {
    0x00002C20,
    0x00000002,
    0x00000000,
    0x00000000
    },

    /* L01_0 */
    {
    0x00004000,
    0x00404048,
    0x000000C0,
    0x00000000
    },
    ....
    }

    Thanks!
  • Yes, the PWM code generated through HALCoGen is different from the example code in HET IDE. Both work.

    You can use PWCNT, DJZ, MOV64 to generate PWM in HET IDE. MOV64 is used to update the parameters of PWCNT, DJZ, ECMP, etc
  • Thank you for your support.

    However I am new to HET IDE and finding it difficult to follow the manual to generate 20 PWM at the same time.

    Is there a video tutorial on using HET IDE ?

    Thanks.

  • Hello Abrar,

    There is one short video for NHET IDE:

    www.ti.com/.../foldersGallery.tsp
  • Hi,
    Following is the code I tried using HET IDE. But it's not generating the PWM on the pin number 8 when I observed using the simulation.
    Do you suggest to program the TMS570 microcontroller and check?
    Thanks.


    ; PWM Configuration Parameters
    PIN_PWM0 .equ 8
    DUTY_LOAD0 .equ 353
    PERD_LOAD0 .equ 703
    ;/----------------------------------------------------------------------------------------------/
    ;/ ADDITIONAL CONFIGURATION /
    ;/----------------------------------------------------------------------------------------------/
    PERD_CNT0 .equ 0
    DUTY_CNT0 .equ 0
    ;/----------------------------------------------------------------------------------------------/
    ;/ INSTRUCTIONS /
    ;/----------------------------------------------------------------------------------------------/
    ; The N2HET loop starts at FIRST_INS instruction
    ; Global CNT instruction
    FIRST_INS CNT { next=DPWM_0,reg=T,comp=EQ,irq=OFF,max=33554431,data=33554431};
    ; DPWM_0 is instructions to produce PWM signal
    DPWM_0 PWCNT { next=PPWM_0, hr_lr=LOW, cond_addr=PPWM_0, pin=PIN_PWM0, action=PULSEHI,
    reg=NONE, irq=OFF, data=DUTY_CNT0, hr_data=0};
    PPWM_0 DJZ { next=FIRST_INS, cond_addr=DLOAD_0, reg=NONE, irq=OFF, data=PERD_CNT0};
    ; DLOAD_0 is for updating the instructions DPWM_0 when the DJZ counts reach zero(i.e. one time period ends)
    DLOAD_0 MOV64 { next=PLOAD_0, remote=DPWM_0, en_pin_action=OFF, cond_addr=PPWM_0,
    pin=PIN_PWM0, comp_mode=ECMP, action=PULSEHI, reg=NONE,irq=ON,data=DUTY_LOAD0};
    PLOAD_0 MOV64 { next=FIRST_INS, remote=PPWM_0, cond_addr=DLOAD_0,
    pin=PIN_PWM0, comp_mode=ECMP, reg=NONE, irq=ON, data=PERD_LOAD0};
  • Hello Abrar,

    Please enabled the pin action in the first MOV64 instruction:

    ; PWM Configuration Parameters

    PIN_PWM0 .equ 8

    DUTY_LOAD0 .equ 353

    PERD_LOAD0 .equ 703

    ;/----------------------------------------------------------------------------------------------/

    ;/ ADDITIONAL CONFIGURATION /

    ;/----------------------------------------------------------------------------------------------/

    PERD_CNT0 .equ 0

    DUTY_CNT0 .equ 0

    ;/----------------------------------------------------------------------------------------------/

    ;/ INSTRUCTIONS /

    ;/----------------------------------------------------------------------------------------------/

    ; The N2HET loop starts at FIRST_INS instruction

    ; Global CNT instruction

    FIRST_INS CNT { next=DPWM_0,reg=T,comp=EQ,irq=OFF,max=33554431,data=33554431};

    ; DPWM_0 is instructions to produce PWM signal

    DPWM_0 PWCNT { next=PPWM_0, hr_lr=LOW, cond_addr=PPWM_0, pin=PIN_PWM0, action=PULSEHI,

    reg=NONE, irq=OFF, data=DUTY_CNT0, hr_data=0};

    PPWM_0 DJZ { next=FIRST_INS, cond_addr=DLOAD_0, reg=NONE, irq=OFF, data=PERD_CNT0};

    ; DLOAD_0 is for updating the instructions DPWM_0 when the DJZ counts reach zero(i.e. one time period ends)

    DLOAD_0 MOV64 { next=PLOAD_0, remote=DPWM_0, en_pin_action=ON, cond_addr=PPWM_0,pin=PIN_PWM0, comp_mode=ECMP, action=PULSEHI, reg=NONE,irq=ON,data=DUTY_LOAD0};

    PLOAD_0 MOV64 { next=FIRST_INS, remote=PPWM_0, cond_addr=DLOAD_0, pin=PIN_PWM0, comp_mode=ECMP, reg=NONE, irq=ON, data=PERD_LOAD0};