XMC Phase - Shifted Carrier Set up

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

cross mob
User11506
Level 2
Level 2
Dear all,

At the moment I am playing with the XMC4400 and I have the timer slices 0, 1 and 3 of Timer Module 0 running

according to example 3 of AP32288: CU8 initialization for 3 phase motor drive.

Everying is working as expected.

What I want to do now, is to introduce a phase shift between the carriers by changing the initial value of the Timer as following at the beguining of the main:

XMC_CCU8_SLICE_SetTimerValue(SLICE00_PTR, 200U);
XMC_CCU8_SLICE_SetTimerValue(SLICE01_PTR, 500U);
XMC_CCU8_SLICE_SetTimerValue(SLICE03_PTR, 1000U);

/* Set period match value of the timer module1 */
XMC_CCU8_SLICE_SetTimerPeriodMatch(SLICE00_PTR, 1499U);
XMC_CCU8_SLICE_SetTimerPeriodMatch(SLICE01_PTR, 1499U);
XMC_CCU8_SLICE_SetTimerPeriodMatch(SLICE03_PTR, 1499U);

for some reason the Period is set correctly but not the Timer value, and when I read it, after having set the value, I get the value 0:

A = XMC_CCU8_SLICE_GetTimerValue(SLICE00_PTR);

Can anyone help me with this ? How do I set the initial Timer value that I want correnctly in order to optain the desired phase-shift?

Thank you very much! 🙂
0 Likes
6 Replies
Eric1
Employee
Employee
Hi paulDBone,

Have you tried to do a shadow transfer?

XMC_CCU8_EnableShadowTransfer(CCU8_MODULE, ((uint32_t)XMC_CCU8_SHADOW_TRANSFER_SLICE_0 |
(uint32_t)XMC_CCU8_SHADOW_TRANSFER_SLICE_1 |
(uint32_t)XMC_CCU8_SHADOW_TRANSFER_SLICE_2 |
(uint32_t)XMC_CCU8_SHADOW_TRANSFER_SLICE_3));

Regards
Eric
0 Likes
User11506
Level 2
Level 2
Hi Erik!!

Thank you very much for your interest!

YES! I tried that as well, but it didn't work.

Eventually I used an External Load to set the initial value of the times right at the start up.

This method is described into the manual, section 21.2.8.5.

2330.attach


What I still don´t understand though, is why functions don´t work!!!
🙂
0 Likes
User7282
Level 4
Level 4
Maybe what you can do is use the Compare Match 2 of the slice 0 to the external start of the timer slice 1, and do the same with the slice 1 and 3.

In this way I think that you can achieve the phase shift that you want.
0 Likes
User11506
Level 2
Level 2
Hi apereira,

Yes, thanks , that would also be a posibility.

It is just that , all the other possible solutions complicate things and it would be so easy with the funcion.

Select the timer and the value that you want, and just change it. Nice and easy 🙂
0 Likes
Eric1
Employee
Employee
Hi paulDBone,

are you sure that the timer is stopped before you write to the TIMER register?

Reference Manual:

Timer Value
This field contains the actual value of the timer. A write access is only possible when the timer is stopped.

You can also check the Slice status run bit: TRB (CC8yTCST)

Regards
Eric
0 Likes
User11506
Level 2
Level 2
Hi Eric,

Yes, I am completely sure.

The Timers are initialized by the following instruction at the end of the initialization.


XMC_SCU_SetCcuTriggerHigh(XMC_SCU_CCU_TRIGGER_CCU80);

Thank you for your answer.
0 Likes