+ Reply to Thread
Results 1 to 3 of 3

Thread: PWM_CCU4: How to find out if in active or passive part of cycle

  1. #1
    New Member New Member 3one5 is on a distinguished road
    Join Date
    Jul 2019
    Location
    Austria
    Posts
    2
    Points
    35

    PWM_CCU4: How to find out if in active or passive part of cycle

    Hi,

    in my project using an XMC1100 with DAVE Apps I trigger ADC_MEASUREMENT by an PWM_CCU4
    on Period match as well as Compare match while counting up.
    An interrupt handler for ADC_MEASUREMENT then evaluates the results.

    Since I switch a power MOSFET with the PWM output signal my measurements have rather different meanings
    whether PWM is in active vs. inactive phase. How can I determine in which phase the PWM_CCU4 is currently?

    PWM frequency is low (sub 1kHz). Thus PWM state will not have changed from the one it had during the ADC
    did its measurements.

    By the way, PWM_CCU4 will not signal Compare match while counting up when Duty Cycle is set to 0.0%, right?

    Markus

  2. #2

    Infineon Employee
    Infineon Employee
    jferreira will become famous soon enough
    Join Date
    Oct 2012
    Posts
    601
    Hi,

    You could use the GCST register.

    Regards,
    Jesus
    The views expressed here are my personal opinions, have not been reviewed or authorized by Infineon and do not necessarily represent the views of Infineon.

  3. #3
    New Member New Member 3one5 is on a distinguished road
    Join Date
    Jul 2019
    Location
    Austria
    Posts
    2
    Points
    35
    Thanks! That did the job. If you have the same problem here is my code snippet (you need to include XMC1100.h for that which is automatically done by including DAVE.h):

    #include <DAVE.h>

    ...

    // Register GCST contains the information whether the CCU4 is in its active or
    // inactive phase (its state thus ST).
    // The slice number of the CCU4 slice (0-3) used can be found out using the
    // resource report (button in DAVE).
    if ((CCU40->GCST & CCU4_GCST_CC41ST_Msk) == CCU4_GCST_CC41ST_Msk) {
    ...
    }

    Triggering the ADC conversion from the PWM CCU4 works fine for me as long as I trigger only on "Compare match while counting up". Since I want to trigger on start as well as the end of the active PWM cycle I tried this:

    Click image for larger version

Name:	Capture1.PNG
Views:	0
Size:	6.8 KB
ID:	4086
    Click image for larger version

Name:	Capture2.PNG
Views:	0
Size:	11.6 KB
ID:	4087

    Now the ADC conversion will not trigger any more at all.

    I had to introduce an additional Interrupt App which is triggered on the CCU4 "Period match". In the IRQ handler routine the ADC conversion is then started. Not a beautiful workaround.

    Markus

+ Reply to Thread

Tags for this 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.