Feb 21, 2021
10:48 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Feb 21, 2021
10:48 PM
Hello,
I'm trying to implement a WS2812 control with a XMC1100. Therefore I want to drive it with the Dave4 PWM_CCU4 Module. When I set a new PWM value in the interrupt routine it requires a few cycles until it sets the new pwm and thus my timing is totally wrong.
Now through googling I found the shadow register in the XMCs, but I don't understand how they are set and triggered. Especially when I configure my chip using Dave apps.
I'm trying to implement a WS2812 control with a XMC1100. Therefore I want to drive it with the Dave4 PWM_CCU4 Module. When I set a new PWM value in the interrupt routine it requires a few cycles until it sets the new pwm and thus my timing is totally wrong.
Now through googling I found the shadow register in the XMCs, but I don't understand how they are set and triggered. Especially when I configure my chip using Dave apps.
Solved! Go to Solution.
- Tags:
- IFX
1 Solution
Feb 22, 2021
07:10 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Feb 22, 2021
07:10 PM
Hi,
How are you updating the value in the ISR ? Are you using functions provided by Dave app ? Can you try calling XMC_CCU4_EnableShadowTransfer() just after the value update? Any call to XMC_CCU4_SLICE_SetTimerPeriodMatch(), XMC_CCU4_SLICE_SetTimerCompareMatch(),
,XMC_CCU4_SLICE_SetPrescaler(),XMC_CCU4_SLICE_Comp areInit(), XMC_CCU4_SLICE_CaptureInit() must be succeeded by XMC_CCU4_EnableShadowTransfer API. This is taken care in the dave app functions.
Best Regards,
Vasanth
How are you updating the value in the ISR ? Are you using functions provided by Dave app ? Can you try calling XMC_CCU4_EnableShadowTransfer() just after the value update? Any call to XMC_CCU4_SLICE_SetTimerPeriodMatch(), XMC_CCU4_SLICE_SetTimerCompareMatch(),
,XMC_CCU4_SLICE_SetPrescaler(),XMC_CCU4_SLICE_Comp areInit(), XMC_CCU4_SLICE_CaptureInit() must be succeeded by XMC_CCU4_EnableShadowTransfer API. This is taken care in the dave app functions.
Best Regards,
Vasanth
3 Replies
Feb 22, 2021
07:10 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Feb 22, 2021
07:10 PM
Hi,
How are you updating the value in the ISR ? Are you using functions provided by Dave app ? Can you try calling XMC_CCU4_EnableShadowTransfer() just after the value update? Any call to XMC_CCU4_SLICE_SetTimerPeriodMatch(), XMC_CCU4_SLICE_SetTimerCompareMatch(),
,XMC_CCU4_SLICE_SetPrescaler(),XMC_CCU4_SLICE_Comp areInit(), XMC_CCU4_SLICE_CaptureInit() must be succeeded by XMC_CCU4_EnableShadowTransfer API. This is taken care in the dave app functions.
Best Regards,
Vasanth
How are you updating the value in the ISR ? Are you using functions provided by Dave app ? Can you try calling XMC_CCU4_EnableShadowTransfer() just after the value update? Any call to XMC_CCU4_SLICE_SetTimerPeriodMatch(), XMC_CCU4_SLICE_SetTimerCompareMatch(),
,XMC_CCU4_SLICE_SetPrescaler(),XMC_CCU4_SLICE_Comp areInit(), XMC_CCU4_SLICE_CaptureInit() must be succeeded by XMC_CCU4_EnableShadowTransfer API. This is taken care in the dave app functions.
Best Regards,
Vasanth
Feb 23, 2021
02:09 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Feb 23, 2021
02:09 PM
I tried it like this now but it takes ~ 14 PWM period until the value is changed and a new duty cycle is output.
void CompareMatchIRQHandler(void)
{
if (upDown) {
pwm = 6400;
} else {
pwm = 3600;
}
if (pwm == 3600) {
upDown = true;
}
else if (pwm == 6400) {
upDown = false;
}
PWM_CCU4_SetDutyCycle(&PWM_CCU4_0, pwm);
XMC_CCU4_EnableShadowTransfer(&PWM_CCU4_0, XMC_CCU4_SHADOW_TRANSFER_SLICE_0);
PWM_CCU4_ClearEvent(&PWM_CCU4_0, XMC_CCU4_SLICE_IRQ_ID_COMPARE_MATCH_UP);
}
Apr 16, 2021
09:26 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Apr 16, 2021
09:26 AM
Hi,
In case you are using Dave apps, you dont have to call that API as I told in the previous response. I tried a similar code at my end and I could see the compare value getting updated in the next cycle. Could you try flagging the compare
match in the ISR and later in main loop updating the dutycycle ?
Best Regards,
Vasanth
In case you are using Dave apps, you dont have to call that API as I told in the previous response. I tried a similar code at my end and I could see the compare value getting updated in the next cycle. Could you try flagging the compare
match in the ISR and later in main loop updating the dutycycle ?
Best Regards,
Vasanth