Shadow Register XMC1100

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
User21246
Level 1
Level 1
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.
0 Likes
1 Solution
Vasanth
Moderator
Moderator
Moderator
250 sign-ins 500 solutions authored First question asked
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

View solution in original post

0 Likes
3 Replies
Vasanth
Moderator
Moderator
Moderator
250 sign-ins 500 solutions authored First question asked
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
0 Likes
User21246
Level 1
Level 1
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);
}
0 Likes
Vasanth
Moderator
Moderator
Moderator
250 sign-ins 500 solutions authored First question asked
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
0 Likes