Attachments are accessible only for community members.
Not applicable
Jan 20, 2016
07:16 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jan 20, 2016
07:16 AM
Hi All,
I have now made many tests with the PWM and digital input to exhort influence on the PWM output.
My findings so far,
1) Directly connecting inputs to the PWM and making use of either external start, stop etc. has the fastest time to response on the PWM output. To start around 100ns, to stop, around 50ns. This is good.
2) Using TRAP PWM, I get around 50ns, as the fastest time to response on PWM output. This is good.
3) Using an input together with a event detection and event generation followed by an intterupt, the best you can get is around 1.3us as the fastest time to response on the PWM output. Here I have used direct register control within the interrupt to switch off the PWM. This is bad.
What fails so far for me is that if I would like to use multiple digital inputs, I am forced to either use a maximum of 3 (direct to PWM) or I have to accept that I will be slowed down by using interrupts.
Is there any way in which I can increase the response time using interrupts in the XMC micro-controller? The clock is supposed to run at 32MHz, how is it that I have to wait for 1.3us before the cpu does what I want it to do via an interrupt?I have attached code for demonstrating point (3).
Regards
Enigma
I have now made many tests with the PWM and digital input to exhort influence on the PWM output.
My findings so far,
1) Directly connecting inputs to the PWM and making use of either external start, stop etc. has the fastest time to response on the PWM output. To start around 100ns, to stop, around 50ns. This is good.
2) Using TRAP PWM, I get around 50ns, as the fastest time to response on PWM output. This is good.
3) Using an input together with a event detection and event generation followed by an intterupt, the best you can get is around 1.3us as the fastest time to response on the PWM output. Here I have used direct register control within the interrupt to switch off the PWM. This is bad.
What fails so far for me is that if I would like to use multiple digital inputs, I am forced to either use a maximum of 3 (direct to PWM) or I have to accept that I will be slowed down by using interrupts.
Is there any way in which I can increase the response time using interrupts in the XMC micro-controller? The clock is supposed to run at 32MHz, how is it that I have to wait for 1.3us before the cpu does what I want it to do via an interrupt?I have attached code for demonstrating point (3).
Regards
Enigma
5 Replies
Not applicable
Jan 20, 2016
11:11 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jan 20, 2016
11:11 AM
To what level do you have optimization set? Have you checked the disassembly listing to see how those two 'direct' lines are interpreted?
Not applicable
Jan 20, 2016
11:37 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jan 20, 2016
11:37 PM
Hi smays,
I have set the optimization to "Optimize most (-O3)", this is what has been suggested in the past. I did not through the assembly instructions, since I do not have a method to write directly in assembly for this microprocessor and since I am working with direct register control, I can not see which commands would lead me to faster response times. Do you see my dilemma?
Regards
Enigma
I have set the optimization to "Optimize most (-O3)", this is what has been suggested in the past. I did not through the assembly instructions, since I do not have a method to write directly in assembly for this microprocessor and since I am working with direct register control, I can not see which commands would lead me to faster response times. Do you see my dilemma?
Regards
Enigma
Not applicable
Jan 21, 2016
12:37 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jan 21, 2016
12:37 AM
Hi,
i think, that the 1,3µs response time is due to the Interrupt latency of 21 MCLK cycles. (See Reference Manual Chapter 5.1.7)
Maybe you can improve the response time, if you execute the Interrupt from SRAM instead from Flash (because of the wait states).
Best regards
Olli
i think, that the 1,3µs response time is due to the Interrupt latency of 21 MCLK cycles. (See Reference Manual Chapter 5.1.7)
Maybe you can improve the response time, if you execute the Interrupt from SRAM instead from Flash (because of the wait states).
Best regards
Olli
Not applicable
Jan 21, 2016
02:31 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jan 21, 2016
02:31 AM
Hi Olli,
Thanks for the reply, it was useful. I will have to give your idea a try.
Regards
Enigma
Thanks for the reply, it was useful. I will have to give your idea a try.
Regards
Enigma
Not applicable
Jan 21, 2016
12:19 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jan 21, 2016
12:19 PM
Even though I have not had an opportunity to try it, apparently one simply adds to the end of the function prototype:
In my example, the function Current_LoopHandler(void) should be run out of RAM.
__attribute__ ((section (".ram_code")))
void VADC0_C0_1_IRQHandler(void)
{
Current_LoopHandler();
}
void Current_LoopHandler(void) __attribute__ ((section (".ram_code")))
{
// Implement control loop, etc…
}
In my example, the function Current_LoopHandler(void) should be run out of RAM.