Solved BBB, from PX.Y to PIN_MODE and pin_name

Nicola Mingotti

Well-Known Member

Reaction score: 201
Messages: 494

hi,

I would like to know if you have a working solution for this problem.
Otherwise i will implement something.

The problem is, we often (always?) think about pins on BBB by
their position e.g. P9.1, P9.10 etc.. Of course, if you want to wire
them you need to know where they are.

Then, it happens for example that we have loaded one or more
overlays and keeping track of what pin does what becomes complex.

So what i would really like is a littele program that does something like this:
#> pinfunc
----------------------------
P9.1 --
P9.2 --
........
P9.21 MODE-3 ehrpwm0B
P9.22 MODE-3 ehrpwm0A
P9.23 MODE-7 gpio.1.17
.....
---------------------------

If it does not exist i will start to write it ASAP.

bye
n.
 
OP
Nicola Mingotti

Nicola Mingotti

Well-Known Member

Reaction score: 201
Messages: 494

gpioctl does allow you to name pins. Consider looking at that.

Hello Phishfry,

At the best of my understanding
gpioctl is nice, but only for controlling GPIO pins.

The problem is, it is not easy to recognize which pin has been set to GPIO and which for example is a PWM, which a PRU pin ... so on.

By "names", I mean the pin "functional name", that is, the name describing the pin
currect function, as currently selected by the multiplexor.

you can see the "functional names" in this table .

bye
n.
 
OP
Nicola Mingotti

Nicola Mingotti

Well-Known Member

Reaction score: 201
Messages: 494

I think you really found something Phishfry !

Experimenting a bit with ofwdump i found this
Code:
#> ofwdump -a -p 
----------
  Node 0x30f4: pinmux_ehrpwm0_AB_pins
            phandle:
              00 00 00 ce 
            pinctrl-single,pins:
              00 00 01 54 00 00 00 03 00 00 01 50 00 00 00 03 
----------
This is exactly the configuration of my PWM in the DTO ! 
Pin 9.21 has offset 0x154  and Mode 3
Pin 9.22 has offset 0x150  and Mode 3

I will try to follow this road for my little pinfunc application !

thank you
n.
 
OP
Nicola Mingotti

Nicola Mingotti

Well-Known Member

Reaction score: 201
Messages: 494

news, i wrote a little script that parses ofwdump -a -p
and tries to detect pin configurations. Here an excerpt of its output

Code:
P.9.9    PWR_BUT                                       
P.9.10   SYS_RESETn      1          -                  
P.9.11   UART4_RXD       not-found                     
P.9.12   GPIO1_28        not-found                     
P.9.13   UART4_TXD       not-found                     
P.9.14   EHRPWM1A        not-found                     
P.9.15   GPIO1_16        not-found                     
P.9.16   EHRPWM1B        not-found                     
P.9.17   I2C1_SCL        not-found                     
P.9.18   I2C1_SDA        not-found                     
P.9.19   I2C2_SCL        3          I2C2_SCL           
P.9.20   I2C2_SDA        3          I2C2_SDA           
P.9.21   UART2_TXD       3          ehrpwm0B           
P.9.22   UART2_RXD       3          ehrpwm0A           
P.9.23   GPIO1_17        not-found                     
P.9.24   UART1_TXD       not-found                     
P.9.25   GPIO3_21        0          mcasp0_ahclkx      
P.9.26   UART1_RXD       not-found                     
P.9.27   GPIO3_19        not-found                     
P.9.28   SPI1_CS0        6          pr1_pru0_pru_r31_3 
P.9.29   SPI1_D0         0          mcasp0_fsx         
P.9.30   SPI1_D1         6          pr1_pru0_pru_r31_2 
P.9.31   SPI1_SCLK       0          mcasp0_aclkx       
P.9.32   VADC

As you can see GPIO pins are not recognized (the recognized function in on the last column of the right). I have not been able to
decode their configurations from "ofwdump" till now.

bye
n.
 
OP
Nicola Mingotti

Nicola Mingotti

Well-Known Member

Reaction score: 201
Messages: 494

I made a first script to try to solve the problem, it is here.
It is still very rudimentrary and lacking.
 
Top