XMC1400: CCU concatenation with underflow in first slice

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

cross mob
Not applicable
Hi,

I am using CCU41 slice 1 to count an event. CCU41 slice 2 is concatenated with slice 1 (TCE bit in CMC). If the counting direction is "UP" everything works as expected.

Example: slice 1 is at 0xFFFF and slice 2 is at 0x0000. After the next event slice 1 is at 0x0000 and slice 2 is at 0x0001. Very good!

But if i use counting direction "DOWN", it does not work as expected.

Example: slice 1 is at 0x0000 and slice 2 is at 0x0000. After the next event (direction = "DOWN") slice 1 is at 0xFFFF and slice 2 is at a random value! The last two times i run it slice 2 was at 0x84AC one time and 0x84F7 the next time. The expected value would of course be 0xFFFF.

What could be the reason for this behavior? Is there some configuration i have to make so underflow is handled correctly if two slices are concatenated?

Thanks!


Edit: I just simplified the program. I am now using a simple count config and i am counting rising edges with slice 0. Slice 1 is concatenated to slice 0. The problem still persists! An underflow of slice 0 (if direction is set to DOWN) is not handled correctly in slice 1.

Has nobody run into this problem before me? It seems crazy to me that this wouldn't work.
0 Likes
2 Replies
lock attach
Attachments are accessible only for community members.
jferreira
Employee
Employee
10 sign-ins 5 sign-ins First like received
Hi,

Find attached an example using the CCU4_CONFIG APPs.
The count direction and the count trigger are controlled by software.
You need to configure the count direction and count trigger events for both slices.
You need to connect the signal (in my case pin signal) controlling the count trigger in both slices.
The count direction signal (in my case pin signal) is only done in the first slice, since the count direction signal is part of the concatenation interface between slices.

Regards,
Jesus
0 Likes
Not applicable
Thank you for the example.

In the main.c there is comment that says:

"The counting direction of the concatenated timer needs to be fixed. The timer can count up or count down, but the direction cannot be updated on the fly."

Is that true? Because that is what i want to achieve. I want a counter that counts rising edges on one pin and uses the direction from another pin (the direction can change at any time).

Edit: Also: If i have to use the same count trigger events on concatenated slices, does this mean that i can only use pin P0_12 for CC40 and only P3_0 for CC41? They are the only pins that have multiple slices from the same CCU.
0 Likes