GPIOs number of the IMX93

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

GPIOs number of the IMX93

Jump to solution
2,269 Views
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 Kudos
Reply
1 Solution
2,248 Views
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.

View solution in original post

2 Replies
2,236 Views
Embedded-world
Contributor IV

Hi @Manuel_Salas 

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

 

 

 

Best Regards,

Ravikumar

2,249 Views
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.

%3CLINGO-SUB%20id%3D%22lingo-sub-2034372%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EGPIOs%20number%20of%20the%20IMX93%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2034372%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3E%3CSTRONG%3EDear%20Experts%2C%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3EI'm%20working%20on%20the%20IMX93%20board%20bring-up.%20During%20testing%20of%20the%20%3CEM%3ERS485%20peripherals%3C%2FEM%3E%2C%20we%20used%20one%20of%20the%20GPIO%20pins%20(i.e.%2C%20%3CSTRONG%3EGPIO2_IO00%3C%2FSTRONG%3E)%20to%20toggle%20between%20logic%200%20and%20logic%201.%3C%2FP%3E%3CP%3EWhile%20researching%20resources%20about%20GPIO%20configuration%20for%20the%20IMX93%2C%20I%20came%20across%20the%20method%20to%20find%20GPIO%20numbers%20using%3A%3C%2FP%3E%3CDIV%20class%3D%22%22%3E%3CDIV%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3Ecat%3C%2FSPAN%3E%20%2Fsys%2Fkernel%2Fdebug%2Fgpio%3C%2FDIV%3E%3CDIV%20class%3D%22%22%3E%26nbsp%3B%3C%2FDIV%3E%3C%2FDIV%3E%3CP%3EOur%20board%20is%20based%20on%20the%20IMX9352%20processor.%20For%20GPIO2_IO00%2C%20I%20used%20the%20GPIO%20number%20512%2C%3CBR%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Screenshot%202025-01-27%20112838.png%22%20style%3D%22width%3A%20774px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Screenshot%202025-01-27%20112838.png%22%20style%3D%22width%3A%20774px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F321439i70A8CB57C629E75F%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22Screenshot%202025-01-27%20112838.png%22%20alt%3D%22Screenshot%202025-01-27%20112838.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3CBR%20%2F%3Eand%20it%20worked%20correctly%20for%20the%20board.%20but%2C%20I%20would%20like%20to%20understand%20%3CSTRONG%3Ehow%20this%20GPIO%20is%20configured%3C%2FSTRONG%3E.%20How%20is%20the%20GPIO%20number%20calculated%20for%20the%20IMX93%20processor%3F%20Is%20there%20a%20specific%20formula%20for%20determining%20this%3F%20If%20so%2C%20could%20you%20please%20provide%20it%3F%3C%2FP%3E%3CBR%20%2F%3E%3CP%3EThanks%20%26amp%3B%20Regards%3C%2FP%3E%3CP%3ERavikumar%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2035385%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20GPIOs%20number%20of%20the%20IMX93%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2035385%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F203368%22%20target%3D%22_blank%22%3E%40Manuel_Salas%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%20for%20sharing%20the%20this%20information%2C%20It's%20very%20useful.%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CP%3EBest%20Regards%2C%3C%2FP%3E%3CP%3ERavikumar%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2035223%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20GPIOs%20number%20of%20the%20IMX93%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2035223%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHello%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F229613%22%20target%3D%22_blank%22%3E%40Embedded-world%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CBR%20%2F%3E%0A%3CP%3EI%20hope%20you%20are%20doing%20very%20well.%3C%2FP%3E%0A%3CBR%20%2F%3E%0A%3CP%3ELinux%20kernel%20base%20the%20GPIO%20number%20based%20on%20the%20index%2C%20in%20this%20case%3A%3C%2FP%3E%0A%3CUL%20class%3D%22lia-list-style-type-disc%22%3E%0A%3CLI%3Egpiochip0%3A%20GPIOs%20512-543%2C%20parent%3A%20platform%2F43810000%20(real%20GPIO%20is%20GPIO2)%3C%2FLI%3E%0A%3CLI%3Egpiochip1%3A%20GPIOs%20544-575%2C%20parent%3A%20platform%2F43820000%20(real%20GPIO%20is%20GPIO3)%3C%2FLI%3E%0A%3CLI%3Egpiochip2%3A%20GPIOs%20576-607%2C%20parent%3A%20platform%2F43830000%20(real%20GPIO%20is%20GPIO4)%3C%2FLI%3E%0A%3CLI%3Egpiochip3%3A%20GPIOs%20608-639%2C%20parent%3A%20platform%2F47400000%20(real%20GPIO%20is%20GPIO1)%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3EBut%20as%20I%20said%2C%20Linux%20kernel%20take%20as%20reference%20the%20index%2C%20so%20Real%20index%3A%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EReal%20GPIO2%20is%20Index%200%3C%2FLI%3E%0A%3CLI%3EReal%20GPIO3%20is%20Index%201%3C%2FLI%3E%0A%3CLI%3EReal%20GPIO4%20is%20Index%202%3C%2FLI%3E%0A%3CLI%3EReal%20GPIO1%20is%20Index%203%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3EYou%20can%20use%20this%20formula%20to%20calculate%20your%20desired%20pin%3A%3C%2FP%3E%0A%3CBR%20%2F%3E%0A%3CP%3EGPIO_NUMBER%20%3D%20GPIO_BASE_INDEX%20%2B%20PIN_INDEX%3C%2FP%3E%0A%3CBR%20%2F%3E%0A%3CP%3EAs%20example%2C%20we%20can%20take%20the%20GPIO2_IO00%3A%3C%2FP%3E%0A%3CP%3EGPIO_NUMBER%20%3D%20(512)%20%2B%20(0)%20%3D%20512.%3C%2FP%3E%0A%3CBR%20%2F%3E%0A%3CP%3EAlso%2C%20you%20can%20take%20a%20look%20to%20the%20%3CA%20href%3D%22https%3A%2F%2Fwww.acmesystems.it%2Fgpiod%22%20target%3D%22_self%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Egpiod%3C%2FA%3E%20tool%20installed%20by%20default%20in%20our%20BSP.%20It%20is%20easy%20to%20use%20(gpiodetect%2C%20gpioset%2C%20gpioget%2C%20etc.)%3A%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Alejandro_Salas_0-1738084836544.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Alejandro_Salas_0-1738084836544.png%22%20style%3D%22width%3A%20341px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F321690i27B724C9AC5C0DCE%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Alejandro_Salas_0-1738084836544.png%22%20alt%3D%22Alejandro_Salas_0-1738084836544.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CBR%20%2F%3E%0A%3CP%3EI%20hope%20this%20can%20helps%20to%20you.%3C%2FP%3E%0A%3CBR%20%2F%3E%0A%3CP%3EBest%20regards%2C%3C%2FP%3E%0A%3CP%3ESalas.%3C%2FP%3E%3C%2FLINGO-BODY%3E