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

XMC™ Forum Discussions

Not applicable
hey,

after a long time of searching google and this forum for informations about timer concatenation, i'm lost. every answer ends with "use DAVE" or "here's a DAVE sample" but what is with the people who are not allowed to use DAVE?? 🙂 ... i'm using the xmc4500 relax kit
I've used the "xmc4500 user manual" to setup a simple timer which works fine, but when i connect the CCU4 timer CC40 + CC41 + CC42 with the CMC function (what should be an easy way -> so it is called in the user manual) ... it won't work ... maybe there's something buggy in my code, or i forgot to set some bits in any register which isn't named in the manual. i don't know. since i'm new in the uC programming, i hope i'll find some help here.

attached find my code, maybe someone can tell me what's wrong with it. 😉
many thanks in advance!
cheers
Jayman
0 Likes
5 Replies
Travis
Employee
Employee
First like received
Hi jayman,

Base on my understanding from the user manual, all you need to do is to set the CC4yCMC.TCE = 1 which will combine the previous timer.

Maybe you can do a code compare between 2 DAVE coding with and without the timer concatenation. This might be able to give you an ideal on how to setup the SFR.

Best Regards
Travis
0 Likes
Not applicable
Hey Travis,

thanks for your fast reply.
sadly. I wasn't able to compare the two codes like you told me... because I have to submit my project tomorrow and there wasn't enough time for me to do this, though, I'm pretty sure that further tasks of my study will lead to the situation where I have to compare some Dave codes 😉
so, thanks for your advise.

best regards,
Jayman
0 Likes
Not applicable
Jayman,

I'd rather recommend to ask such questions in class or by asking your instructor ... I guess the forum isn't intended for such things 🙂 Anyway why were you missing when the task submission was due?

Cheers,
Martin
0 Likes
User8683
Level 4
Level 4
Hello,

I would like to know what is required for timer concatenation to work in plain code without all the overhead of the DAVE framework. The documentation indicates that it is simply setting the TCE bit and says it is "easy", but the reality is much different. In looking at the DAVE code, you need to perform all the timer configuration twice and set the TCE bit but even my attempt to extract the steps in DAVE is not working for me. Only my low order bits increment. Can someone please tell me what is wrong/missing with the following code?

All I want to code is have a 32 bit timer without exceptions or other triggering.


pCCU4_2->TCCLR = TIMER_CLEAR_SLICE; //Disable the timer
pCCU4_3->TCCLR = TIMER_CLEAR_SLICE;

/* Clear the existing timer configuration */
pCCU4_2->TC &= ~((uint32_t)CCU4_CC4_TC_TCM_Msk | (uint32_t)CCU4_CC4_TC_CMOD_Msk
| (uint32_t)CCU4_CC4_TC_STRM_Msk | (uint32_t)CCU4_CC4_TC_ENDM_Msk | (uint32_t)CCU4_CC4_TC_DITHE_Msk);
pCCU4_3->TC &= ~((uint32_t)CCU4_CC4_TC_TCM_Msk | (uint32_t)CCU4_CC4_TC_CMOD_Msk
| (uint32_t)CCU4_CC4_TC_STRM_Msk | (uint32_t)CCU4_CC4_TC_ENDM_Msk | (uint32_t)CCU4_CC4_TC_DITHE_Msk);

pCCU4_2->TC |= (((uint32_t)TIMER_EDGE_ALIGNED << (uint32_t)CCU4_CC4_TC_TCM_Pos) & (uint32_t)CCU4_CC4_TC_TCM_Msk)
| (((uint32_t)TIMER_COMPARE_MODE << (uint32_t)CCU4_CC4_TC_CMOD_Pos) & (uint32_t)CCU4_CC4_TC_CMOD_Pos)
| (((uint32_t)TIMER_CLEAR_START_TIMER << (uint32_t)CCU4_CC4_TC_STRM_Pos) & (uint32_t)CCU4_CC4_TC_STRM_Msk)
| (((uint32_t)TIMER_CLEAR_STOP_TIMER << (uint32_t)CCU4_CC4_TC_ENDM_Pos) & (uint32_t)CCU4_CC4_TC_ENDM_Msk);
pCCU4_3->TC |= (((uint32_t)TIMER_EDGE_ALIGNED << (uint32_t)CCU4_CC4_TC_TCM_Pos) & (uint32_t)CCU4_CC4_TC_TCM_Msk)
| (((uint32_t)TIMER_COMPARE_MODE << (uint32_t)CCU4_CC4_TC_CMOD_Pos) & (uint32_t)CCU4_CC4_TC_CMOD_Pos)
| (((uint32_t)TIMER_CLEAR_START_TIMER << (uint32_t)CCU4_CC4_TC_STRM_Pos) & (uint32_t)CCU4_CC4_TC_STRM_Msk)
| (((uint32_t)TIMER_CLEAR_STOP_TIMER << (uint32_t)CCU4_CC4_TC_ENDM_Pos) & (uint32_t)CCU4_CC4_TC_ENDM_Msk);

/* Set the prescaler divider and passive level of the o/p signal */
WR_REG( pCCU4_2->PSC, (uint32_t)CCU4_CC4_PSC_PSIV_Msk, (uint32_t)CCU4_CC4_PSC_PSIV_Pos, CLOCK_DIV_BY_64 );
WR_REG( pCCU4_3->PSC, (uint32_t)CCU4_CC4_PSC_PSIV_Msk, (uint32_t)CCU4_CC4_PSC_PSIV_Pos, CLOCK_DIV_BY_64 );
pCCU4_2->PSL = 0;
pCCU4_3->PSL = 0;

pCCU4_2->PRS = 0XFFFF;
pCCU4_3->PRS = 0XFFFF;

pCCU4_3->CMC |= ((uint32_t)1 << (uint32_t)CCU4_CC4_CMC_TCE_Pos);

/* Request shadow transfer for period, compare, dither and prescalar level */
pCCU4Global->GCSS |= (((uint32_t)1 << ((uint32_t)4 * (uint32_t)TIMER_SLICE_2))
| ((uint32_t)1 << (((uint32_t)4 * (uint32_t)TIMER_SLICE_2) + (uint32_t)1))
| ((uint32_t)1 << (((uint32_t)4 * (uint32_t)TIMER_SLICE_2) + (uint32_t)2)));
pCCU4Global->GCSS |= (((uint32_t)1 << ((uint32_t)4 * (uint32_t)TIMER_SLICE_3))
| ((uint32_t)1 << (((uint32_t)4 * (uint32_t)TIMER_SLICE_3) + (uint32_t)1))
| ((uint32_t)1 << (((uint32_t)4 * (uint32_t)TIMER_SLICE_3) + (uint32_t)2)));

/* Enable the timer */
pCCU4Global->GIDLC |= (((uint32_t)1 << ((uint32_t)CCU4_GIDLC_CS0I_Pos + (uint32_t)TIMER_SLICE_2)));
pCCU4Global->GIDLC |= (((uint32_t)1 << ((uint32_t)CCU4_GIDLC_CS0I_Pos + (uint32_t)TIMER_SLICE_3)));


Can someone from Infineon get the timer concatenation chapter fixed as it is incorrect and vague on details?

Thanks,

Jason
0 Likes
Travis
Employee
Employee
First like received
Hi Jason,

If I am not wrong you have to create 2 CCU slices (eg. CC40 and CC41) of the same configuration for concatenation of 32bit timer and compare. Then you have to set CC41CMC.TCE =1 which will do a concatenation of the actual CCU4 slice with the previous one.

Attached is an example of XMC1300 with CCU4 doing concatenation of 48bit.

So sorry that I do not have an exact solution to your MCU and you have to following the configuration of the software with the user manual.

Good luck
Travis
0 Likes