RT1050-EVK GPIO fast pin toggel

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

RT1050-EVK GPIO fast pin toggel

2,749 次查看
danielbuergin
Contributor I

Hi Guys, I try to get familiar with my i.MX RT1050 EVK Board (what a beast...).

For that i would like to toggle a pin (GPIO_AD_B1_08) as fast as possible. With the following code i get to ~4.4Mhz.

What can i expect ?  

Is my configuration ok, or did i miss something ?

And maybe i already didn't understand bit manipulation or why does bit toggling with "GPIO1->DR ^= (24U)" not working ?

#include "board.h"
#include "fsl_gpio.h"
#include "pin_mux.h"
#include "clock_config.h"
#include "fsl_common.h"
#include "fsl_iomuxc.h"

int main(void)
{
   gpio_pin_config_t tst_config = {kGPIO_DigitalOutput, 0, kGPIO_NoIntmode};

   BOARD_ConfigMPU();
   BOARD_BootClockRUN();

   /* Init Test-Port GPIO1 Pin 24 (GPIO_AD_B1_08) */
   GPIO_PinInit(GPIO1, (24U), &tst_config);

   IOMUXC_SetPinConfig(IOMUXC_GPIO_AD_B1_08_GPIO1_IO24, 0xB0E9u);
   /* 0xB0E9u:
   Slew Rate Field: Fast Slew Rate
   Drive Strength Field: R0/5
   Speed Field: max(200MHz)
   Open Drain Enable Field: Open Drain Disabled
   Pull / Keep Enable Field: Pull/Keeper Enabled
   Pull / Keep Select Field: Pull
   Pull Up / Down Config. Field: 100K Ohm Pull Up
   Hyst. Enable Field: Hysteresis Disabled
   */

   while (1)
   {
      // GPIO1->DR ^= (24U); // Does not work ??
      GPIO1->DR |= (1U << (24U)); // Low
      GPIO1->DR &= ~(1U << (24U)); // High
   }
}

Any hint would be great.

Regards, Daniel

 

标签 (1)
标记 (1)
0 项奖励
回复
3 回复数

1,987 次查看
art
NXP Employee
NXP Employee

Your configuration seems to be OK. The measured toggle speed is also something like expected, since it is limited by some internal bus arbitration delays to access GPIO register etc.


Have a great day,
Artur

1,987 次查看
markomarusic25
Contributor II

Hi,

I have the same 'problem' like danielbuergin. But I managed to toggle pin at 20MHz, which also seemed to slow to me. Until I read your answer saying that internal bus arbitration delays are to blame.

Can you maybe tell me what are those delays, why and when do they happen? Or point me in some direction to where to find answers.

0 项奖励
回复

1,866 次查看
mjbcswitzerland
Specialist V

Hi

Much faster speeds can be obtained using the hi-speed GPIO option in the i.MX Rt 106x parts as shown here:

https://community.nxp.com/t5/i-MX-RT/Demonstrating-Hi-Speed-GPIO-in-the-i-MX-RT-106x/m-p/1212701#M12...

Regards

Mark
[uTasker project developer for Kinetis and i.MX RT]
Contact me by personal message or on the uTasker web site to discuss professional training, solutions to problems or rapid product development requirements

For professionals searching for faster, problem-free Kinetis and i.MX RT 10xx developments the uTasker project holds the key: https://www.utasker.com/iMX/RT1064.html

0 项奖励
回复