AnsweredAssumed Answered

Port toggling delay in MQX

Question asked by srikar vadlamani on Apr 11, 2011
Latest reply on Apr 22, 2011 by Juraj Vanco

Hello all,

I am trying to toggle a port pin, using the code below, and I see using MQX on a 52259EVB takes a performance hit which I cannot explain.

 

Here is the test code I used in the scenario using MQX

 

      reg_ptr = _PSP_GET_IPSBAR();// Internal Peripheral Base Addr Reg

      gpio_ptr = &reg_ptr->GPIO;

 

      gpio_ptr->PORTAN   = 0x00  ;

      gpio_ptr->DDRAN    = 0xEE  ;  //  Select AN1 thru AN3 and AN5 thru AN7 as output pins

      gpio_ptr->PANPAR   = 0x11  ;  //  Assign AN0 and AN4 to A/D inputs, all others GPIO.

 

      while(1)   

      {

            gpio_ptr->PORTAN |= 0x04; 

            gpio_ptr->PORTAN &= ~0x04;

      }

 

And the test code in non MQX scenario

 

      PORTAN   = 0x00  ;

      DDRAN    = 0xEE  ;  //  Select AN1 thru AN3 and AN5 thru AN7 as output pins

      PANPAR   = 0x11  ;  //  Assign AN0 and AN4 to A/D inputs, all others GPIO.

 

      while(1)   

      {

            PORTAN |= 0x04; 

            PORTAN &= ~0x04;

      }

 

Both the test codes are trying to toggle the a port pin, the non MQX case taking around 500nsec to toggle a port pin, whereas an MQX test code takes around 2.5 usec.

 

I checked the core frequency for both, and they both are equal.

 

So is there something in MQX, which is causing this issue?

 

Srikar

Outcomes