XMC very slow interrupts

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

cross mob
lock attach
Attachments are accessible only for community members.
Not applicable
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
0 Likes
5 Replies
Not applicable
To what level do you have optimization set? Have you checked the disassembly listing to see how those two 'direct' lines are interpreted?
0 Likes
Not applicable
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
0 Likes
Not applicable
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)

1762.attach

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
0 Likes
Not applicable
Hi Olli,

Thanks for the reply, it was useful. I will have to give your idea a try.

Regards
Enigma
0 Likes
Not applicable
Even though I have not had an opportunity to try it, apparently one simply adds to the end of the function prototype:

__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.
0 Likes