Jul 27, 2019
01:03 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jul 27, 2019
01:03 PM
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
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 Replies
Jul 29, 2019
03:20 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jul 29, 2019
03:20 PM
Hi,
You could use the GCST register.
Regards,
Jesus
You could use the GCST register.
Regards,
Jesus
Aug 04, 2019
05:51 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Aug 04, 2019
05:51 AM
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
...
// 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:
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
#include
...
// 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:
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