+ Reply to Thread
Results 1 to 1 of 1

Thread: Bug / Undefine behaviour in the PWM_CCU8 / PWM_CCU8_Stop function

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

    Bug / Undefine behaviour in the PWM_CCU8 / PWM_CCU8_Stop function

    In case this helps someone else, I believe there is a bug / undefined behaviour in the PWM_CCU8 App....

    https://www.infineonforums.com/threa...-with-PWM_CCU8


    I am using the PWM_CCU8 App to drive two FET's connected to each end of the primary winding on a centre tapped transformer. The App is configured to generate two pulse trains 180° out of phase with each other as follows...

    Channel 1 Direct Output
    Output enable = TRUE
    Passive State = Before Compare Match
    Passive Level = Low (so the FET is OFF on powerup / reset)

    Channel 1 Inverted Output
    Output enable = TRUE
    Passive State = After Compare Match
    Passive Level = Low (so the FET is OFF on powerup / reset)

    The App generates the two signals correctly when the PWM_CCU8_Start() function is called, however when the PWM_CCU8_Stop() function is called the Direct Output returns to it's Passive Level setting (LOW) as expected but the Inverted Output is set to the INVERSE of it's Passive Level setting (HIGH)

    In my application this leaves one half of the centre tapped transformer permanently on with the resultant current overload.

    I have not been able to resolve this with any App configuration settings so I have created a workaround using my own Stop and Start functions below.

    I hope this helps others.

    Best regards
    PHAB




    //----------------------------------------------------------------------------
    // Workaround for bug / undefined behaviour in DAVE PWM_CCU8 APP which leaves Inverted Output pin high when APP is stopped
    //
    // Stops the PWM then configures the Inverted Output pin of Channel 1 so it is NOT under PWM_CCU8 control and forces pin low
    //----------------------------------------------------------------------------
    //
    // Originator : Aaron Walsh 17 Jan 2020
    //---------------------------------------------------------------------------
    void My_PWM_CCU8_Stop(PWM_CCU8_t* handle_ptr)
    {
    // Call standard function to stop the PWM
    PWM_CCU8_Stop(&OP_ULTRA_A_B);

    // Disconnect PWM_CCU8 APP Channel 1, Output 1 (Inverted Output) from output pin
    // Set Pin mode to XMC_GPIO_MODE_OUTPUT_PUSH_PULL instead of XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT3 (Alternative mode 3 means hardware controlled by PWM_CCU8 on this pin)
    handle_ptr->config_ptr->gpio_ch1_out1_ptr->IOCR[handle_ptr->config_ptr->gpio_ch1_out1_pin >> 2U] &= ~(uint32_t)XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT3 << ((uint32_t)PORT_IOCR_PC_Size * ((uint32_t)handle_ptr->config_ptr->gpio_ch1_out1_pin & 0x3U));
    handle_ptr->config_ptr->gpio_ch1_out1_ptr->IOCR[handle_ptr->config_ptr->gpio_ch1_out1_pin >> 2U] |= (uint32_t)XMC_GPIO_MODE_OUTPUT_PUSH_PULL << ((uint32_t)PORT_IOCR_PC_Size * ((uint32_t)handle_ptr->config_ptr->gpio_ch1_out1_pin & 0x3U));
    }

    //----------------------------------------------------------------------------
    // Workaround for bug / undefined behaviour in DAVE PWM_CCU8 APP which leaves Inverted Output pin high when APP is stopped
    //
    // Configures the Inverted Output pin of Channel 1 so it IS under PWM_CCU8 control then starts PWM APP
    //----------------------------------------------------------------------------
    //
    // Originator : Aaron Walsh 17 Jan 2020
    //---------------------------------------------------------------------------
    void My_PWM_CCU8_Start(PWM_CCU8_t* handle_ptr)
    {
    // Connect PWM_CCU8 APP Channel 1, Output 1 (Inverted Output) to output pin
    handle_ptr->config_ptr->gpio_ch1_out1_ptr->IOCR[handle_ptr->config_ptr->gpio_ch1_out1_pin >> 2U] &= ~(uint32_t)XMC_GPIO_MODE_OUTPUT_PUSH_PULL << ((uint32_t)PORT_IOCR_PC_Size * ((uint32_t)handle_ptr->config_ptr->gpio_ch1_out1_pin & 0x3U));
    handle_ptr->config_ptr->gpio_ch1_out1_ptr->IOCR[handle_ptr->config_ptr->gpio_ch1_out1_pin >> 2U] |= (uint32_t)XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT3 << ((uint32_t)PORT_IOCR_PC_Size * ((uint32_t)handle_ptr->config_ptr->gpio_ch1_out1_pin & 0x3U));

    // Call standard function to start the PWM
    PWM_CCU8_Start(&OP_ULTRA_A_B);
    }
    Last edited by phab; Jan 20th, 2020 at 02:32 AM.

+ 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.