Dec 18, 2018
01:38 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dec 18, 2018
01:38 AM
Hello,
My XMC4400 runs at 120[MHz] which is also the input clock frequency to CCU4 (and 8). In order to make my timer tick every microsecond I need to divide the input clock by 120, but the best available match is 128.
Is there a way to achieve the desired frequency without interrupts, without the SysTick etc.? PWM generation is quite flexible, but can it be used to maintain a free running timer (again, minimizing software
involvement in counter management)?
Thanks in advance.
My XMC4400 runs at 120[MHz] which is also the input clock frequency to CCU4 (and 8). In order to make my timer tick every microsecond I need to divide the input clock by 120, but the best available match is 128.
Is there a way to achieve the desired frequency without interrupts, without the SysTick etc.? PWM generation is quite flexible, but can it be used to maintain a free running timer (again, minimizing software
involvement in counter management)?
Thanks in advance.
- Tags:
- IFX
6 Replies
Dec 18, 2018
02:52 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dec 18, 2018
02:52 AM
You can use CCU timer concatenation for this. Configure one slice to run at 1 MHz and then use this an an input to the next timer slice.
Dec 18, 2018
03:04 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dec 18, 2018
03:04 AM
Thanks, but I don't see how this helps me, as I initially strived to do exactly what you suggest - set my timer frequency to 1[MHz] (but that does not seem to be possible if my CCU's input clock is 120[MHz]...?).
Attachments are accessible only for community members.
Dec 18, 2018
04:00 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dec 18, 2018
04:00 AM
The following is based on XMC4300/4800, I hope it is similar to XMC4400:
You can define the timer period in register PRS, which marks the top to which the timer will run (starting from 0).
Please see the attached code for XMC4300/4800. Try calling TIMER_init(0, 120, true) to generate in interrupt every 1 us. Could be there's not enough time to do anything in ISR, because 1 us is very fast.
You can define the timer period in register PRS, which marks the top to which the timer will run (starting from 0).
Please see the attached code for XMC4300/4800. Try calling TIMER_init(0, 120, true) to generate in interrupt every 1 us. Could be there's not enough time to do anything in ISR, because 1 us is very fast.
Dec 18, 2018
04:18 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dec 18, 2018
04:18 AM
Maybe I can connect a high frequency CCU unit (120[MHz], 8,3[ns]) to another CCU unit, and trigger CCU timer increment upon 120 counts.
Dec 18, 2018
04:18 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dec 18, 2018
04:18 AM
As an example, the following code will set the period CCU40_CC40 to 1 microsecond, assuming a 120 MHz clock:
Then make sure to set timer_concatenation = true when configuring CCU40_CC41. This slice will now run with 1 MHz input clock from slice 0.
#define PERIOD_1US (120U)
XMC_CCU4_SLICE_SetTimerPeriodMatch(CCU40_CC40, PERIOD_1US - 1);
XMC_CCU4_SLICE_SetTimerCompareMatch(CCU40_CC40,PERIOD_1US / 2);
Then make sure to set timer_concatenation = true when configuring CCU40_CC41. This slice will now run with 1 MHz input clock from slice 0.
Dec 18, 2018
04:29 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dec 18, 2018
04:29 AM
I see what you mean, which is actually almost identical to what I posted just before you. In both cases I need 2 slices. Thanks.