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.

TMS570LS3137: TMS570LS3137: HOW to generate 20 PWMs by HET IDE tool? Are there any examples?

Part Number: TMS570LS3137
Other Parts Discussed in Thread: HALCOGEN,

I want to configure 20 PWMs as output for TMS570LS3137, but HALCOGEN tool does not support it. I used HET IDE tool to configure PWM generation, but the configuration result is not correct. Do you have similar HET IDE examples or tell me how to configure to get the result I want?

  • Hi Lijian,

    The IDE contains several examples for generating PWM: 1 channel, 3 channels and 4 channels. I don't have a ready example for 20 PWMs.

  • hello Mr. Wang

  • hello Mr. Wang

  • hello Mr. Wang

  • hello Mr. Wang

    I know what you present. In practice, the memory contents generated by HET-IDE is not same with the  HALCOGEN. I mean the pwm0-pwm7. So I try to modify the het.c directly so as to get the 9th pwm according to the existing contents which are generated by HALCOGEN. I only modified the PWCNM, DJZ, MOV64(period update and duty cycle). After that the result is bad, and the pwm0-pwm7 not output, the 9th pwm is not, too. So i want to know how to modify the het.c directly. i think that is quickly compare with HET-IDE. i want to control many step motors, so the 20 pwms is a must in my project. thanks foy your help.

  • Hi Lijian,

    Don't modify the HAlCOGen generated code manually. Please use the HET IDE to generate C code, and header file, then copy the IDE generated C code to NHET RAM.

  • Hi Mr.Wang,I'm sorry for not replying to you in the past period of time.As you told me, I used the HEt-IDE tool to generate a multi-channel PWM. Because of the use of this tool, in practice the HAL tool does not use the het.c file, but the related files generated by the HEt-IDE. This prevents me from using the pwmSetDuty function to change the PWM duty cycle. In fact, I tried using this function, but nothing worked. The initialized duty cycle does not change. Therefore, I would like to know how to adjust duty cycle in project after theHEt-IDE tool generates PWM waveform.

    Thanks

     Lijian Wang

  •  I

     I set 8-channel PWM with 50% duty cycle in THE HEt-IDE tool. When I tried to change the duty cycle in the program, as shown in the picture, I used the pwmSetDuty function, but it had no effect. The duty cycle did not change. Did I set the parameters wrong? Does the second argument to this function depend on the order in which the ET-IDE is set? Or can this function not be used in conjunction with the HET-IDE?

  • Hi Lijian,

    Normally we use ECMP to generate PWM signal, and use MOV32 or MOV64 to update the duty cycle. Updating the duty cycle by changing the data field of ECMP directly will lead to a missing pulse. 

    The HET IDE generates C file. You need to replace the default code (het1PROGRAM[]) generated by HALCOGen with the c file (HET_INIT0_PST[]) generated by HET IDE.

    The code generated by HAlCoGen:

    static const hetINSTRUCTION_t het1PROGRAM[58U] =
    {

     .........

    }

    The code generated by HET IDE:

    HET_MEMORY const HET_INIT0_PST[4] =
    {

         ....

    }

    You need to copy HET_MEMORY const HET_INIT0_PST[4] to your project, and change the memcpy in het.c

    change:

        (void)memcpy((void *)hetRAM1, (const void *)het1PROGRAM, sizeof(het1PROGRAM));

    to:

        (void)memcpy((void *)hetRAM1, (const void *)HET_INIT0_PST, sizeof(HET_INIT0_PST));

  • You can not use the API directly to change the duty cycle.

    In HALCoGen generated code, the instruction for changing the PWM duty cycle is (pwm << 1U) + 41U which "MOV64 instruction for this PWM"

    For the HET IDE generated code (example as below), the instruction is L01

    ; PWM with synchronous duty cycle update at period end
    L00 CNT { reg=A, irq=OFF, max= 10 }
    L01 MOV32 { remote=L02, z_cond=ON, type=IMTOREG&REM, reg=NONE, data=1, hr_data=20} ; CPU to write to this data field
    L02 ECMP { en_pin_action=ON, pin=0, action=PULSELO, reg=A, data= 2, hr_data=80}
    L03 BR { next= L00, cond_addr=L00, event= NOCOND }