CCU8 Compare Shadow Transfer

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

cross mob
Not applicable
Hi everyone,

I want to update the compare value of the CCU80 Slice 0 channel 1 via software directly.
I am using the XMCLib functions in the following sequence:
-I configure the Shadow transfer as follows:

XMC_CCU8_EnableShadowTransfer(MODULE_PTR, \
(uint32_t)(XMC_CCU8_SHADOW_TRANSFER_SLICE_0| \
XMC_CCU8_SHADOW_TRANSFER_PRESCALER_SLICE_0));
XMC_CCU8_SLICE_EnableAutomaticShadowTransferRequest(SLICE0_PTR, XMC_CCU8_SLICE_AUTOMAIC_SHADOW_TRANSFER_WRITE_INTO_COMPARE1_SHADOW);

-For changing the compare value I use the following function:

XMC_CCU8_SLICE_SetTimerCompareMatch(SLICE0_PTR,XMC_CCU8_SLICE_COMPARE_CHANNEL_1,(uint16_t) y);

However, it seems that the Duty Cycle is not changing. I suspect that I am not changing well the compare value.
Any help would be highly appreciated
0 Likes
2 Replies
Not applicable
Set the shadow register first, then enable the transfer:


CCU42_CC40->CRS = ((FLY_BACK_PRS - s24V_ParSupplyCtrlLoop.ui16FlyBackPWM) << CCU4_CC4_CRS_CRS_Pos); // Configure the Compare register
CCU42->GCSS |= (1 << CCU4_GCSS_S0SE_Pos); // Shadow transfer for slice 3, for CCU40 Kernel


This code should work for the CCU8.
0 Likes
lock attach
Attachments are accessible only for community members.
jferreira
Employee
Employee
10 sign-ins 5 sign-ins First like received
Hi,

There is an errata on the automatic shadow transfer request feature of the XMC1400. CCU_AI.007 Automatic shadow transfer feature does not work when system PCLK is faster than MCLK.
If the PCLK is kept the same as the MCLK then the feature is working.
See attached example.

  XMC_CCU8_SLICE_WriteImmediateAfterShadowTransfer(CCU81_CC81, XMC_CCU8_SLICE_WRITE_INTO_COMPARE1_CONFIGURATION);


XMC_CCU8_SLICE_EnableAutomaticShadowTransferRequest(CCU81_CC81, XMC_CCU8_SLICE_AUTOMAIC_SHADOW_TRANSFER_WRITE_INTO_COMPARE1_SHADOW);

/* Transfer value from shadow registers to actual timer registers */
XMC_CCU8_EnableShadowTransfer(CCU81, XMC_CCU8_SHADOW_TRANSFER_SLICE_1 |
XMC_CCU8_SHADOW_TRANSFER_DITHER_SLICE_1 |
XMC_CCU8_SHADOW_TRANSFER_PRESCALER_SLICE_1);

Regards,
Jesus
0 Likes