infineon4engineers Facebook

infineon@google+ Google+

infineon@linkedin linkedin

infineon4engi@twitter twitter

infineon@youtube youtube

+ Reply to Thread
Results 1 to 2 of 2

Thread: PWM APP, method for phase shifting / setting initial timer value

  1. #1
    Beginner Beginner phab is on a distinguished road
    Join Date
    Oct 2017
    Posts
    22
    Points
    107.5

    PWM APP, method for phase shifting / setting initial timer value

    Greetings all,

    I have 3 x PWM APP's all running the same duty and period.

    I would like to phase shift them such that the output pulses are spread equally over the period.

    Is there a method for doing this ? I'm thinking I should be able to initialise the timer value of each PWM to different values before I start them. Something like PWM_SetTimerValue().


    Any suggestions would be greatly appreciated.

    PHAB

  2. #2
    Beginner Beginner phab is on a distinguished road
    Join Date
    Oct 2017
    Posts
    22
    Points
    107.5
    OK, so there is a bug in the XMC PWM hardware or library. You cannot set the CCUy TIMER value once the CCUy module has been initialised by "DAVE_Init()". You can't even manually write to the CCUy TIMER value using the debugger. This could be why the Infineon have not published a "SetTimerValue" method for the PWM App.

    I reported this under e-ticket 28586855 some time ago and it has now been closed. I have raised a new e-ticket 303874228.

    In the mean time there is a work-around. Before trying to set the CCUy TIMER value, set the CCUy "General Idle Disable" bits(s) then start the CCUy(s)

    For example...

    Code:
    int main(void)
    {
      PWM_t* HandlePtr;
      uint32_t TimerValue;
    
      DAVE_STATUS_t status;
    
      status = DAVE_Init();           /* Initialization of DAVE APPs  */
    
      HandlePtr = &PWM_DRV2;
    
      // The following line clears the idle states and is a work around for a bug in the PWMSP002 App or hardware
      CCU81->GIDLC |= CCU8_GIDLC_CS3I_Msk | CCU8_GIDLC_CS2I_Msk | CCU8_GIDLC_CS1I_Msk | CCU8_GIDLC_CS0I_Msk;
    
      //  Offset the PWM_DRV2 timer (phase shift)
      XMC_CCU8_SLICE_SetTimerValue(HandlePtr->ccu8_slice_ptr, (uint16_t)10000);
    
      PWM_Start(&PWM_DRV1);
      PWM_Start(&PWM_DRV2);
    
      while(1U)
      {
      }
    }

    I hope this helps someone (took me some time to figure out)
    PHAB
    Last edited by phab; May 19th, 2019 at 10:57 PM.

+ Reply to Thread
Disclaimer

All content and materials on this site are provided “as is“. Infineon makes no warranties or representations with regard to this content and these materials of any kind, whether express or implied, including without limitation, warranties or representations of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. No license, whether express or implied, is granted by Infineon. Use of the information on this site may require a license from a third party, or a license from Infineon.


Infineon accepts no liability for the content and materials on this site being accurate, complete or up- to-date or for the contents of external links. Infineon distances itself expressly from the contents of the linked pages, over the structure of which Infineon has no control.


Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Usage Terms of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Usage Terms of this site. Infineon reserves the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.