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

XMC™ Forum Discussions

User14974
Level 1
Level 1
Hi,

im using Dave 3 and want to start two PWM002 at the same time


with PWMSP002_Start(&PWMSP002_Handle0) and PWMSP002_Start(&PWMSP002_Handle1) i got 4 PWM with two inverted signals which was my goal!

but i noticed that the two inverted and the not inverted signals do not start at the same time, but they are 50% phase shifted, which i don't understand, is there somthing to do to get a synchronised start?


Fethi
0 Likes
8 Replies
User14974
Level 1
Level 1
anyone? i'm asking a stupid question ?
0 Likes
Eric1
Employee
Employee
Hi Fethi,

I suggest to use DAVE4 instead of DAVE3.
The inverted and not inverted Signals are a feature of the CCU8.
Generally they are made to behave exactly like this because this is required at their major application: half bridges.

In the XMC45 you can generate per slice: 2 PWM Signals with independent duty cycle but the same frequency. + the inverted signals.
The best picture to see this is the Figure 23-26 in the reference manual (page 2347 @v1.6)
3273.attach

Best Regards
Eric
0 Likes
User14974
Level 1
Level 1
Hi Eric 🙂

Thanks for the answer. Im using DAVE 4 now.


I needed 8 PWM ( 4 inverted) to control a Dual active bridge, im using CCU80.out20/CCU80.out21 to control the Half bridge A CCU80.out30/CCU80.out31 and to control B, CCU81.out00/CCU81.out01 and CCU81.out20/CCU81.out21 to control D see the the picture blow 3274.attach



With DAVE PWM_CCU8 im getting close to my aim 3275.attach

now with GLOBAL_CCU8_SyncStartTriggerHigh(GLOBAL_CCU8_CCUCON_Msk); im Starting all the PWM at the same Time.

my question now, how can i Start the half bridge D and C at the same time but after a Phase shift so they start after A and B 3276.attach


i tried to start A and B separately with XMC_SCU_SetCcuTriggerHigh(XMC_SCU_CCU_TRIGGER_CCU80); and D and C with XMC_SCU_SetCcuTriggerHigh(XMC_SCU_CCU_TRIGGER_CCU81); but i does not work 😕


do i need a Delay Function?


Fethi
0 Likes
Eric1
Employee
Employee
Hi Fethi,

I'm glad that you are close to your aim.
The easiest solution is to preload the timer value for phase D and C e.g. with the half of the period.

You only should make sure that the timer is not configured with start & clear.

Regards
Eric
0 Likes
User14974
Level 1
Level 1
Hi Eric,
thanks a lot, what do you mean with ''preload the timer value'' is it done within the Timer APP or in the main.c?

can you explain please 🙂

Regards,

Fethi
0 Likes
User14974
Level 1
Level 1
Hi im getting with this code a phase shift between the two full-bridges 3285.attach

int main(void)
{



DAVE_STATUS_t status;

status = DAVE_Init(); /* Initialization of DAVE APPs */

if(status == DAVE_STATUS_FAILURE)
{
/* Placeholder for error handler code. The while loop below can be replaced with an user error handler */
XMC_DEBUG(("DAVE APPs initialization failed with status %d\n", status));
while(1U)
{
}
}

//delayms(0.5);
/* Start PWM_CCU8_0 Slice*/
PWM_CCU8_Start(&Bridge_A);
PWM_CCU8_Start(&Bridge_B);
XMC_SCU_SetCcuTriggerHigh(XMC_SCU_CCU_TRIGGER_CCU80); /* Start PWM_CCU8_0 Slice*/





//delayms(0.5);
//XMC_CCU8_SLICE_SetTimerValue(&TIMER_0,10000);

PWM_CCU8_Start(&Bridge_C);
PWM_CCU8_Start(&Bridge_D);


/* Start PWM_CCU8_1 Slice*/
XMC_SCU_SetCcuTriggerHigh(XMC_SCU_CCU_TRIGGER_CCU81);


but i can not control it 😕 if i change the postion of "XMC_SCU_SetCcuTriggerHigh"i get a variation but im not pleased i need to find how to change the length of d


Regards,

Fethi
0 Likes
Eric1
Employee
Employee
Hi Fethi,

you need to start the timer first.
The APP is checking if you have enabled sync. Start. if this is the case it will only init the timer and not run.
Then you have to write into the timer register. Because the CCU needs to be initialized but the timer must not run.
After this you can enable the Trigger for all Moduls.

The timer Set value was not defined as standard function for the PWM_CCU8 APP so there is no API for it.
But you already wrote the solution by using the LIB function.

In my example I enabled the sync start for two PWM_CCU8 APP instances: PWM_CCU8_0 and PWM_CCU8_1:


PWM_CCU8_Start(&PWM_CCU8_0);
PWM_CCU8_Start(&PWM_CCU8_1);

XMC_CCU8_SLICE_SetTimerValue(PWM_CCU8_0.ccu8_slice_ptr,10000);
XMC_SCU_SetCcuTriggerHigh(XMC_SCU_CCU_TRIGGER_CCU80|XMC_SCU_CCU_TRIGGER_CCU81);


Regards
Eric

EDIT:
FYI there is no space in the symbol CCU80 between 8 and 0. By copying my editor creates a space.
0 Likes
User14974
Level 1
Level 1
Hi Eric,

thanks it works :)!!

this is my code:


PWM_CCU8_Start(&Bridge_A);
PWM_CCU8_Start(&Bridge_B);
XMC_CCU8_SLICE_SetTimerValue(Bridge_A.ccu8_slice_ptr,400); /** ccu8_slice_ptr XMC_CCU8_SLICE_SetTimerValue(Bridge_B.ccu8_slice_ptr,400); /** ccu8_slice_ptr

PWM_CCU8_Start(&Bridge_C);
PWM_CCU8_Start(&Bridge_D);


XMC_CCU8_SLICE_SetTimerValue(Bridge_C.ccu8_slice_ptr,200); /** ccu8_slice_ptr XMC_CCU8_SLICE_SetTimerValue(Bridge_D.ccu8_slice_ptr,200); /** ccu8_slice_ptr;
//Synchronously start PWM_CCU8_0 and PWM_CCU8_1 Slices*/
GLOBAL_CCU8_SyncStartTriggerHigh(GLOBAL_CCU8_CCUCON_Msk);

Regards,

Fethi
0 Likes