+ Reply to Thread
Results 1 to 4 of 4

Thread: Slow Pin toggling using Dave App Method

  1. #1
    Beginner Beginner Markus S. is on a distinguished road
    Join Date
    Jan 2020
    Location
    Switzerland
    Posts
    6
    Points
    70

    Slow Pin toggling using Dave App Method

    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=11l...kphS3aPlF9UOCF).

    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!

  2. #2

    Infineon Employee
    Infineon Employee
    jferreira will become famous soon enough
    Join Date
    Oct 2012
    Posts
    689
    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

    Code:
    __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 <main+0x1a>

    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/Infine...53cce7c2ee0312

    Regards,
    Jesus
    The views expressed here are my personal opinions, have not been reviewed or authorized by Infineon and do not necessarily represent the views of Infineon.

  3. #3
    Beginner Beginner Markus S. is on a distinguished road
    Join Date
    Jan 2020
    Location
    Switzerland
    Posts
    6
    Points
    70
    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

  4. #4

    Infineon Employee
    Infineon Employee
    jferreira will become famous soon enough
    Join Date
    Oct 2012
    Posts
    689
    Hi,

    The v1.12 from 29 Oct 2018 is the lastest version.

    Regards,
    Jesus
    The views expressed here are my personal opinions, have not been reviewed or authorized by Infineon and do not necessarily represent the views of Infineon.

+ Reply to Thread

Tags for this Thread

Disclaimer

All content and materials on this site are provided “as is“. Infineon makes no warranties or representations with regard to this content and these materials of any kind, whether express or implied, including without limitation, warranties or representations of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. No license, whether express or implied, is granted by Infineon. Use of the information on this site may require a license from a third party, or a license from Infineon.


Infineon accepts no liability for the content and materials on this site being accurate, complete or up- to-date or for the contents of external links. Infineon distances itself expressly from the contents of the linked pages, over the structure of which Infineon has no control.


Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Usage Terms of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Usage Terms of this site. Infineon reserves the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.