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: Center Aligned PWM ADC trigger - reloaded

Part Number: TMS570LS3137


Hi everybody (and hopefully hi Anthony),

this is a follow-up to https://e2e.ti.com/support/microcontrollers/c2000/f/902/t/477694?tisearch=e2e-sitesearch&keymatch=hercules%20Center%20align
I started with the given pwm3ph example and managed to change the polarity (I have an active low HW driver Interface) and set all desired values via the main CPU in the "normal" program flow.

However I come across a problem I could not solve until now:

The HET program is started at the START label which enables everything: timer, PWM outputs, ADC triggering, ...
What I need is a permanently running timer to do things like ADC conversion and interrupt triggering all the time, but a seperate enable to the PWM output.
I was thinking about using the pin output registers of the HET for that, but its not synchronized.

Or is use of a second CNT instruction a way to go? But how to synchronize the two timers?

Any good ideas or solutions to solve this (what I think might be a "standard" Problem)?

Thank you,
Ralph

  • Hello Ralph,

    The code has several instructions (mov32) to update the data filed values and the selected ALU register at the remote location. MOV32 doesn't modify the control field at the remote address. But MOV64 can modify both data filed and control filed. Please replace the MOV32 with MOV64 for the following statements for updates:

    ;; jump from PERCLR
    HPUPDATES:
               MOV64 {type=IMTOREG&REM, reg=NONE, remote=AHIOFFPIN, data=0, hr_data=0}
    NXTALOON   MOV64 {type=IMTOREG&REM, reg=NONE, remote=ALOONPIN, data=0, hr_data=0}
    NXTBHIOFF   MOV64 {type=IMTOREG&REM, reg=NONE, remote=BHIOFFPIN, data=0, hr_data=0}
    NXTBLOON   MOV64 {type=IMTOREG&REM, reg=NONE, remote=BLOONPIN, data=0, hr_data=0}
    NXTCHIOFF   MOV64 {type=IMTOREG&REM, reg=NONE, remote=CHIOFFPIN, data=0, hr_data=0}
    NXTCLOON   MOV64 {type=IMTOREG&REM, reg=NONE, remote=CLOONPIN, data=0, hr_data=0, next=PWMPINS}

    And use this kind of command to disable the PWM output of phase A.

    hetRAM->Instruction[pHET_NXTAHIOFF_0].Control  &= ~(uint32)0x00400000U;

    where pHET_NXTAHIOFF_0 is instruction 78 which is defined in pwm3ph.h.

  • Hi QJ Wang,

    thanks for your input, this points into to right direction.
    However, still some issues: the syntax of MOV64 is a bit different compared to MOV32.
    Something like
    NXTAHIOFF   MOV64 {en_pin_action=ON, comp_mode=ECMP, reg=T, pin=PHAHI_SH, action=SET, cond_addr=AHIOFFCLR, remote=AHIOFFPIN, data=0, hr_data=0}
    would be syntactically correct, but does not work as expected.
    I'm not sure how to realize what I was hoping to achieve: the MOV64 will modify the control bits of the remote address, OK.
    But what I want to change is only the en_pin_action to OFF, but "permanently" until the main CPU changes it to ON again.

    Still struggeling with the HET...

    Thank you,
    Ralph

  • Hello Ralph,

    My understanding is that you want to tuen on/off the PWM output through CPU command manually. MOV64 copies the whole control field and data field rather than a specific bit field.

    What problem does MOV64 introduce?
  • Hi QJ Wang,

    well, the MOV64 just does not work as expected: I can change the enable_pin_action bit at the remote address from 0 to 1 and back, but the pin will no longer toggle. So I suspect some of the other control bits to be wrong. And there are other sources using the same remote address, so there might be conflics...

    Regards,

    Ralph