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

cross mob
Not applicable
Dear forum,

I have made a performance check (simple port pin toggle) between "XMC1200"
and "ST Microelectronics ST32F051" with the following results:

(1) uVision 5 (XMC1200) (2) DAVE3 (XMC1200) (3) uVision4 (STM32F051)
duration while loop: 1,065us 2,87us 839ns
jmp to begin (while): 279ns 609ns 140ns
toggle cycle low/high: 162ns 487ns 153ns


Could anyone please explain to me why the "Infineon XMC1200" is so slow - especially for the jump to the begin
of the endless loop (while) with a duration of 279ns?

Thanks in advance for your hints!


---------------
Following environments have been used:
1. Microcontroller "Infineon XMC1200" (32MHz) + Keil uVision 5, optimize level 3
2. Microcontroller "Infineon XMC1200" (32MHz) + DAVE 3.1.10, optimize level "most"
3. Microcontroller "ST Microelectronics STM32F051" (32MHz) + Keil uVision 4, optimize level 3

Following code has been used for "Infineon XMC1200":
while(1)
{
//P0_5_toggle();
PORT0->OMR = 0x00200020UL;
PORT0->OMR = 0x00200020UL;
PORT0->OMR = 0x00200020UL;
PORT0->OMR = 0x00200020UL;
PORT0->OMR = 0x00200020UL;
PORT0->OMR = 0x00200020UL;
PORT0->OMR = 0x00200020UL;
PORT0->OMR = 0x00200020UL;
PORT0->OMR = 0x00200020UL;
PORT0->OMR = 0x00200020UL;
}

Following code has been used for "ST Microelectronics ST32F051":

while(1)
{
//PA15 toggle
GPIOA->ODR ^= 0x8000;
GPIOA->ODR ^= 0x8000;
GPIOA->ODR ^= 0x8000;
GPIOA->ODR ^= 0x8000;
GPIOA->ODR ^= 0x8000;
GPIOA->ODR ^= 0x8000;
GPIOA->ODR ^= 0x8000;
GPIOA->ODR ^= 0x8000;
GPIOA->ODR ^= 0x8000;
GPIOA->ODR ^= 0x8000;
}

In the attachments are screenshots of the measurements.
0 Likes
4 Replies
chismo
Employee
Employee
First like received
Hi.

This should be due to the wait state performance of the XMC1200 Flash, which ranges from 1 to 3 wait states. To get a better performance, the relevant code should be executed from the SRAM.

Regards,
chismo
0 Likes
WilhelmBrezovit
Employee
Employee
First solution authored Welcome! 10 replies posted
Dear IdontLikeToRegister,

There is no difference in speed between the two microcontrollers.
STM32F051 is a ARM Cortex M0 microcontroller and Infineon’s XMC1200 is a ARM Cortex M0 microcontroller, too. Both should run at 32 MHz.
Unfortunately in your DAVE project you forgot to include the CLK002 App. The CLK002 App configures the Main Clock Frequency (= CPU Clock) to 32 MHz. Without CLK002 App your System runs only at 8 MHz.

All the best,
Wilhelm
0 Likes
WilhelmBrezovit
Employee
Employee
First solution authored Welcome! 10 replies posted
The attachments/pictures in this post belong to the text above – should help.589.attach590.attach591.attach
0 Likes
AndreasG
Employee
Employee
10 replies posted 5 replies posted Welcome!
It may also be worth to note that such a small code snippet is very susceptible to significant variances in results, and as such has only limited value in judging the actual performance of different devices.

Just one example: code alignment. The Cortex M0 has a 16bit instruction set, but fetches 32bit per per instruction fetch, that's two instructions per 32bit flash access in the XMC1000. Taking this example, if the compiled result has an instruction before the actual first port toggle instruction (e.g. the register load operation of the constant and/or target address), the code alignment can have a considerable influence. Basically, "bad" code alignment may add another flash access before the first toggle instruction. With just 11 instructions in your test sequence, that could be a difference of up to ~9% in the total loop execution.
0 Likes