GPIOs number of the IMX93

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

GPIOs number of the IMX93

跳至解决方案
1,721 次查看
Embedded-world
Contributor IV

Dear Experts,

I'm working on the IMX93 board bring-up. During testing of the RS485 peripherals, we used one of the GPIO pins (i.e., GPIO2_IO00) to toggle between logic 0 and logic 1.

While researching resources about GPIO configuration for the IMX93, I came across the method to find GPIO numbers using:

cat /sys/kernel/debug/gpio
 

Our board is based on the IMX9352 processor. For GPIO2_IO00, I used the GPIO number 512,
Screenshot 2025-01-27 112838.png
and it worked correctly for the board. but, I would like to understand how this GPIO is configured. How is the GPIO number calculated for the IMX93 processor? Is there a specific formula for determining this? If so, could you please provide it?

 

Thanks & Regards

Ravikumar

0 项奖励
回复
1 解答
1,700 次查看
Manuel_Salas
NXP TechSupport
NXP TechSupport

Hello @Embedded-world 

 

I hope you are doing very well.

 

Linux kernel base the GPIO number based on the index, in this case:

  • gpiochip0: GPIOs 512-543, parent: platform/43810000 (real GPIO is GPIO2)
  • gpiochip1: GPIOs 544-575, parent: platform/43820000 (real GPIO is GPIO3)
  • gpiochip2: GPIOs 576-607, parent: platform/43830000 (real GPIO is GPIO4)
  • gpiochip3: GPIOs 608-639, parent: platform/47400000 (real GPIO is GPIO1)

But as I said, Linux kernel take as reference the index, so Real index:

  • Real GPIO2 is Index 0
  • Real GPIO3 is Index 1
  • Real GPIO4 is Index 2
  • Real GPIO1 is Index 3

You can use this formula to calculate your desired pin:

 

GPIO_NUMBER = GPIO_BASE_INDEX + PIN_INDEX

 

As example, we can take the GPIO2_IO00:

GPIO_NUMBER = (512) + (0) = 512.

 

Also, you can take a look to the gpiod tool installed by default in our BSP. It is easy to use (gpiodetect, gpioset, gpioget, etc.):

Alejandro_Salas_0-1738084836544.png

 

I hope this can helps to you.

 

Best regards,

Salas.

在原帖中查看解决方案

2 回复数
1,688 次查看
Embedded-world
Contributor IV

Hi @Manuel_Salas 

Thanks for sharing the this information, It's very useful.

 

 

 

Best Regards,

Ravikumar

1,701 次查看
Manuel_Salas
NXP TechSupport
NXP TechSupport

Hello @Embedded-world 

 

I hope you are doing very well.

 

Linux kernel base the GPIO number based on the index, in this case:

  • gpiochip0: GPIOs 512-543, parent: platform/43810000 (real GPIO is GPIO2)
  • gpiochip1: GPIOs 544-575, parent: platform/43820000 (real GPIO is GPIO3)
  • gpiochip2: GPIOs 576-607, parent: platform/43830000 (real GPIO is GPIO4)
  • gpiochip3: GPIOs 608-639, parent: platform/47400000 (real GPIO is GPIO1)

But as I said, Linux kernel take as reference the index, so Real index:

  • Real GPIO2 is Index 0
  • Real GPIO3 is Index 1
  • Real GPIO4 is Index 2
  • Real GPIO1 is Index 3

You can use this formula to calculate your desired pin:

 

GPIO_NUMBER = GPIO_BASE_INDEX + PIN_INDEX

 

As example, we can take the GPIO2_IO00:

GPIO_NUMBER = (512) + (0) = 512.

 

Also, you can take a look to the gpiod tool installed by default in our BSP. It is easy to use (gpiodetect, gpioset, gpioget, etc.):

Alejandro_Salas_0-1738084836544.png

 

I hope this can helps to you.

 

Best regards,

Salas.