Feb 02, 2020
11:16 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Feb 02, 2020
11:16 AM
I was wondering about how fast a pin is toggled using the XMC2Go Kit and the Digital-IO App Methods.
The Clock configuration is 32MHz MCLK.
The code is simply:
while(1U){
DIGITAL_IO_SetOutputHigh(&DIGITAL_IO_1);
DIGITAL_IO_SetOutputLow(&DIGITAL_IO_1);
}
It takes up to 7.5us to execute one loop!
And the jitter is in the range of 1us (see Picture: https://drive.google.com/open?id=11lC_dxhH07zhpNbUA6kphS3aPlF9UOCF).
I find this behaviour strange: The loop executes extremely slow in my opinion (given the Clock speed), and I can't really explain
where this jitter comes from.
Could anyone advise me?
Many Thanks in Advance!
The Clock configuration is 32MHz MCLK.
The code is simply:
while(1U){
DIGITAL_IO_SetOutputHigh(&DIGITAL_IO_1);
DIGITAL_IO_SetOutputLow(&DIGITAL_IO_1);
}
It takes up to 7.5us to execute one loop!
And the jitter is in the range of 1us (see Picture: https://drive.google.com/open?id=11lC_dxhH07zhpNbUA6kphS3aPlF9UOCF).
I find this behaviour strange: The loop executes extremely slow in my opinion (given the Clock speed), and I can't really explain
where this jitter comes from.
Could anyone advise me?
Many Thanks in Advance!
- Tags:
- IFX
- toggle pin
- xmc2go
3 Replies
Feb 03, 2020
11:37 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Feb 03, 2020
11:37 PM
Hi,
It is about compiler optimization. The default compiler optimization for a new project is none, i.e. -O0. In the project settings (Alt+Enter) you can change the compiler optimization. If you enable -O2 and look into the listing file in the Debug folder you will see a quite reduced while loop generated compared to the one generated using no optimization
Regarding the jitter you mention, which version of the system_XMC1100.c are you using? Since version v1.9 the flash wait states setting is changed from adaptiv to a fixed value of 1.
See https://www.infineon.com/dgdl/Infineon-XMC1000_Datasheet_Addendum-DS-v01_00-EN.pdf?fileId=5546d46253...
Regards,
Jesus
It is about compiler optimization. The default compiler optimization for a new project is none, i.e. -O0. In the project settings (Alt+Enter) you can change the compiler optimization. If you enable -O2 and look into the listing file in the Debug folder you will see a quite reduced while loop generated compared to the one generated using no optimization
__STATIC_INLINE void XMC_GPIO_SetOutputHigh(XMC_GPIO_PORT_t *const port, const uint8_t pin)
{
XMC_ASSERT("XMC_GPIO_SetOutputHigh: Invalid port", XMC_GPIO_CHECK_OUTPUT_PORT(port));
port->OMR = (uint32_t)0x1U << pin;
10001232: 6059 str r1, [r3, #4]
__STATIC_INLINE void XMC_GPIO_SetOutputLow(XMC_GPIO_PORT_t *const port, const uint8_t pin)
{
XMC_ASSERT("XMC_GPIO_SetOutputLow: Invalid port", XMC_GPIO_CHECK_OUTPUT_PORT(port));
port->OMR = 0x10000U << pin;
10001234: 605a str r2, [r3, #4]
10001236: e7fc b.n 10001232
Regarding the jitter you mention, which version of the system_XMC1100.c are you using? Since version v1.9 the flash wait states setting is changed from adaptiv to a fixed value of 1.
See https://www.infineon.com/dgdl/Infineon-XMC1000_Datasheet_Addendum-DS-v01_00-EN.pdf?fileId=5546d46253...
Regards,
Jesus
Feb 04, 2020
05:26 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Feb 04, 2020
05:26 AM
Hello,
thank you very much for this explanation. With optimization level chaned it looks good.
I use Version V1.12 of system_XMC1100.c in this project.
How should I update the projet setting to use newest version?
Regards,
Markus
thank you very much for this explanation. With optimization level chaned it looks good.
I use Version V1.12 of system_XMC1100.c in this project.
How should I update the projet setting to use newest version?
Regards,
Markus
Feb 05, 2020
05:51 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Feb 05, 2020
05:51 AM
Hi,
The v1.12 from 29 Oct 2018 is the lastest version.
Regards,
Jesus
The v1.12 from 29 Oct 2018 is the lastest version.
Regards,
Jesus