Apr 27, 2013
07:24 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Apr 27, 2013
07:24 AM
Hello,
I need for me projekt a periodic microsecond timer (32 bit) to get the time between two calls or to generate a delay.
Is there a app which provide this function?
According to the datasheet for the XMC4500 the module CCU4 and CCU8 should do this.
But there is no app which provide only the function from this modules to generate a periodic timer.
What can i do now ?
Best regards,
Max_Rock
I need for me projekt a periodic microsecond timer (32 bit) to get the time between two calls or to generate a delay.
Is there a app which provide this function?
According to the datasheet for the XMC4500 the module CCU4 and CCU8 should do this.
But there is no app which provide only the function from this modules to generate a periodic timer.
What can i do now ?
Best regards,
Max_Rock
- Tags:
- IFX
9 Replies
Apr 28, 2013
08:07 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Apr 28, 2013
08:07 PM
Hi,
I should like to understand more about the requirement of periodic microsecond timer (32-bit).
Do you mean:
1. From 0 to 0xFFFF FFFFF count, the time taken is 1us... (Period)
2. Or From 0 to 1 count, the time taken is 1us.... (Resolution)
As the CPU clock is 120Mhz, using the smallest resolution, it take 118 count for 1us.. which is only 7-bit..
Thus, a 32-bit container for the period value seem to be an overkill...
I should like to understand more about the requirement of periodic microsecond timer (32-bit).
Do you mean:
1. From 0 to 0xFFFF FFFFF count, the time taken is 1us... (Period)
2. Or From 0 to 1 count, the time taken is 1us.... (Resolution)
As the CPU clock is 120Mhz, using the smallest resolution, it take 118 count for 1us.. which is only 7-bit..
Thus, a 32-bit container for the period value seem to be an overkill...
Apr 28, 2013
10:20 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Apr 28, 2013
10:20 PM
Hi elegantk,
i need the resolution option, every 1us the timer increments.
i need the resolution option, every 1us the timer increments.
Apr 29, 2013
12:38 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Apr 29, 2013
12:38 AM
Hi,
As the CPU clock is 120Mhz. Each CPU cycle is 8.33ns.
The prescaler divider is1,2,4,... 64,128...
If divider is 64... Each resolution is 8.33ns x 64 = 5.33us
If divider is 128... Each resolution is 8.33ns x 128 = 1.066us
Thus, there is no suitable prescaler divider option which will result in the resolution of 1us
As the CPU clock is 120Mhz. Each CPU cycle is 8.33ns.
The prescaler divider is1,2,4,... 64,128...
If divider is 64... Each resolution is 8.33ns x 64 = 5.33us
If divider is 128... Each resolution is 8.33ns x 128 = 1.066us
Thus, there is no suitable prescaler divider option which will result in the resolution of 1us
Apr 29, 2013
12:44 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Apr 29, 2013
12:44 AM
Hi,
Alternative solution = PWMSP001 (for 1us trigger pulse) + CNT001 (to count the number of 1us)
Setup PWMSP001 to 1Mhz frequency... We will be using the PWMSP001 period match (Falling edge) to trigger the increment of count of CNT001.
Signal Connection: PWM Status -> CNT001 -> Input
Setup CNT001 Active Edge for counting = "Falling edge".
**************************************************************************
If you need 200us timer interrupt interval:
Setup Event Count match to "200", count match enable at initialization, start during initialization.
Connect the NVIC002 signal.
Alternative solution = PWMSP001 (for 1us trigger pulse) + CNT001 (to count the number of 1us)
Setup PWMSP001 to 1Mhz frequency... We will be using the PWMSP001 period match (Falling edge) to trigger the increment of count of CNT001.
Signal Connection: PWM Status -> CNT001 -> Input
Setup CNT001 Active Edge for counting = "Falling edge".
**************************************************************************
If you need 200us timer interrupt interval:
Setup Event Count match to "200", count match enable at initialization, start during initialization.
Connect the NVIC002 signal.
May 08, 2013
04:18 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
May 08, 2013
04:18 AM
Hi,
i have tested and it works.
For a 32bit Timer i add a second CNT001 app.
Signal Connection from CNT001/0: Status -> CNT001/1 -> Input.
Setup CNT001/0:
Active Edge for counting = "Falling edge".
Enable Rollover Interrupt at initialization
Setup CNT001/1:
Active Edge for counting = "Falling edge".
i have tested and it works.
For a 32bit Timer i add a second CNT001 app.
Signal Connection from CNT001/0: Status -> CNT001/1 -> Input.
Setup CNT001/0:
Active Edge for counting = "Falling edge".
Enable Rollover Interrupt at initialization
Setup CNT001/1:
Active Edge for counting = "Falling edge".
Not applicable
Jul 29, 2013
05:42 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jul 29, 2013
05:42 AM
Hello everybody,
i need a timer for my project , that could replace the NOP() function , which is not very accurate. Everywhere i look on the internet i see many examples that use the NOP() function.I haven't found so far an example that would use only the CCU4 module. I don't need to use PWMSP001 or CNT001 app as max_rock did . Basically , i need a simple and accurate timer that uses the CC4 module . For example if i have this program:
#include
void delay(unsigned long int i)
{
while(i--)
{
__NOP();
}
}
int main(void)
{
DAVE_Init(); // Initialization of DAVE Apps
while(1)
{
IO004_TogglePin(IO004_Handle0);
IO004_TogglePin(IO004_Handle1);
delay(1000000);
}
return 0;
}
How could i use the CC4 (or what other module) to replace the delay function? i have also read this topic:http://http://www.infineonforums.com/threads/397-CCU4-Modul-PWM?highlight=ccu4 but the user wanted to get a PWM working . I don't need that. All i need is a simple and accurate delay timer.
Thank you
Best regards ,
Alex
i need a timer for my project , that could replace the NOP() function , which is not very accurate. Everywhere i look on the internet i see many examples that use the NOP() function.I haven't found so far an example that would use only the CCU4 module. I don't need to use PWMSP001 or CNT001 app as max_rock did . Basically , i need a simple and accurate timer that uses the CC4 module . For example if i have this program:
#include
void delay(unsigned long int i)
{
while(i--)
{
__NOP();
}
}
int main(void)
{
DAVE_Init(); // Initialization of DAVE Apps
while(1)
{
IO004_TogglePin(IO004_Handle0);
IO004_TogglePin(IO004_Handle1);
delay(1000000);
}
return 0;
}
How could i use the CC4 (or what other module) to replace the delay function? i have also read this topic:http://http://www.infineonforums.com/threads/397-CCU4-Modul-PWM?highlight=ccu4 but the user wanted to get a PWM working . I don't need that. All i need is a simple and accurate delay timer.
Thank you
Best regards ,
Alex
Jul 30, 2013
01:05 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jul 30, 2013
01:05 AM
Use the PWM App and disable on that App the outputs (see the pins configuration). Configure the PWM in edge aligned single shot mode and set the period to the desired time delay. Enable the appropriate interrupt on Period match or just poll the value of the timer in the while loop. It's really easy! To start the timer - just set the run bit.
Not applicable
Jul 30, 2013
04:20 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jul 30, 2013
04:20 AM
Thank you for your quick answer Dmitry Podobedov. I did what you told me to do.I selected PWMSP001 app , i configured the pwm in edge aligned single shot mode , but i can't set the period . I mean , that option(set period) , resolution , and compare are locked. They can't be modified.I attached a screenshot below.
.
The program seems to be working , but i can't modify the period. Also , what should i do if i want to use an interrupt ? I tried to set the period using this command: CCU40_CC40->PRS=0xFFFF; still, no efect.
The program seems to be working , but i can't modify the period. Also , what should i do if i want to use an interrupt ? I tried to set the period using this command: CCU40_CC40->PRS=0xFFFF; still, no efect.
Not applicable
Mar 11, 2015
05:22 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Mar 11, 2015
05:22 AM
Years later, but hey 🙂
"Slice x shadow transfer set enable"
GCSS.SxSE = 1
"Slice x shadow transfer set enable"
GCSS.SxSE = 1