BUG in XMC_CCU4_SLICE_CaptureInit for XMC1400

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

cross mob
User11637
Level 2
Level 2
In the XMC_lib v2.1.20 library there is a flaw: using the "XMC_CCU4_SLICE_CaptureInit" API, all the settings made in the CC4yCMC register are reset!
The cause of this defect is the following: in the file "xmc_ccu4.c" in line 397 the following statement is written:

slice->CMC = ((uint32_t)capture_init->timer_concatenation << CCU4_CC4_CMC_TCE_Pos);

In this way the entire contents of the register (except for the setting of the "timer_concatenation" flag TCE) is reset, and all settings made previously to the API are lost. 😞

Regards
Andrea
0 Likes
3 Replies
jferreira
Employee
Employee
10 sign-ins 5 sign-ins First like received
Hi Andrea,

It is the task of the Init function to initialize the peripheral. Why are you expecting that the registers would keep their previous value after the Init function is called? What is your use case?

Regards,
Jesus
0 Likes
User11637
Level 2
Level 2
jferreira wrote:
Why are you expecting that the registers would keep their previous value after the Init function is called? What is your use case?

The CC4yCMC register contains the settings valid for all external timer commands (Start, stop, gate, count, capture, etc.).
If I previously used "XMC_CCU4_SLICE_CountConfig" or "XMC_CCU4_SLICE_DirectionConfig" for example, when I call the "XMC_CCU4_SLICE_CaptureInit" function it happens that all settings made by the two functions in the CMC register are lost.
This happens if I want to configure, for example: Event0 = Count, Event1 = direction, Event2 = capture.

Regards
Andrea
0 Likes
User11637
Level 2
Level 2
There is only one way to get around this problem: first do the initialization as "capture" and then edit the other events to do what is necessary.

Andrea
0 Likes