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.

tms570ls0432 - het-pwm duty cycle update

Other Parts Discussed in Thread: HALCOGEN

hi ti,

i m updating the duty cycle and period of the PWM signal via SCI. i wanna know whether the pulse will be missed when updated? i cant see this clearly in oscilloscope.

in TRM it is mentioned that MOV32 instruction can be used when PWM signal is generated using ECMP.

i ve used HALCoGen. in het.c i dint find any ECMP instruction.

 i viewed some sample codes in HET IDE. but codes are in asm.so how to use this instruction?

or else is there any other way to implement this?

thanks

  • Hello Pavithra,

      Here is one example.

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ; This example will illustrate a simple asymmetrical PWM generation. The duty cycle
    ; is to be updated by the host CPU by writing the new duty cycle (compare value) to 
    ; the MOV32 data field. When there is a compare match, the MOV32 instruction will move
    ; the new compare value to the ECMP instruction. The update of the ECMP is considered
    ; synchronous as the update is only done with respect to the LRP (loop resolution period)
    ; and only when there is a compare match.
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    
    
    PWM_PERIOD            .equ 100
    PWM_PIN_NUM           .equ 9
    INIT_COMPARE          .equ 50
    INIT_HR_DELAY         .equ 0
    
    ; PWM with synchronous duty cycle update at compare match event
    L00   CNT { reg=A,irq=ON,max=PWM_PERIOD};
    L01   ECMP { next=L03,hr_lr=HIGH,en_pin_action=ON,cond_addr=L02,pin=PWM_PIN_NUM,action=PULSELO,reg=A,irq=OFF,data=INIT_COMPARE,hr_data=INIT_HR_DELAY};
    L02   MOV32 { remote=L01,type=IMTOREG&REM,reg=NONE,data=INIT_COMPARE,hr_data=INIT_HR_DELAY};
    L03   BR { next= L00, cond_addr=L00, event= NOCOND }

  • thanks for your response Charles!

    example is there in TRM itself. but my question is how to use that in halcogen developed .c file? bcz i dont find any ECMP instruction there.
  • Hi Pavithra,

      The halcogen provides a fixed blackbox code and drivers to implement various PWM and input capture capabilities using NHET. However, the blackbox code does not use ECMP but rather uses PWCNT instruction to generate PWM. If you want to develop a custom NHET program you can do away with the HalcoGen's blackbox code.  For example, you can compile the NHET code (which uses ECMP to generate PWM) that I sent you. It will produce both a .h and .c corresponding to your custom code to be loaded into the NHET RAM. In the HalCoGen, you will bypass the blackbox code by checking the "Enable Advanced Config Mode / Disable BlackBox Driver" checkbox and also provide the new header and C files. See below screenshot.