Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GPIO not working on-py .js .c . PINMUX missing #18

Open
mayermakes opened this issue Oct 9, 2019 · 13 comments
Open

GPIO not working on-py .js .c . PINMUX missing #18

mayermakes opened this issue Oct 9, 2019 · 13 comments

Comments

@mayermakes
Copy link

Only PRu examples work. ALL other examples that use GPIO functionality
python, js and C examples fail
Error message leads to missing Pinmux
there is no device tree file for the BB-AI in /lib/firmware and no guide on how to set the BB-Ai up for GPIO interactions wit /boot/uEnv.txt

to recreate:
flash latest debian image , make all updates&dist-upgrade , upgrade kernel to r119
load latest cloud9 examples into Github.

if you have a workaround/solution/dtbo-file please lead me to it, I'm working on an urgent project for the BB-AI product promo.
in the meantime I will workaround by having an external MCU

@jomoengineer
Copy link

I'm seeing pretty much the same except the .c version is working fine. I just changed the "Runner" setting to "C or C++ (Beagle Makefile)" and it works fine. The JavaScript one causes my BB AI to crash.

For the Python version, I am unable to get any version to work either via the cloud9 IDE or from commandline.

This is the output I see from the JavaScript BlinkLED example:


Debugger listening on 127.0.0.1:15454
info: No pinmux for P9_15
error: Unable to write to /sys/class/gpio/gpio48/value
error: Unable to write to /sys/class/gpio/gpio48/value

@mayermakes
Copy link
Author

mayermakes commented Oct 20, 2019 via email

@jomoengineer
Copy link

The .c program by default in the version I have which should be the latest blinks the usr3 LED which works fine:


FILE * trigger = fopen("/sys/class/leds/beaglebone:green:usr3/trigger", "w");

This can be run from either the cloud9 IDE or locally under:


/var/lib/cloud9/BeagleBone/AI$

However, trying to use a P9 or P8 GPIO pin has not been successful.

This is what 'config-pin' shows which indicates the issue with the pinmux or perhaps the config-pin tool:


$ config-pin P9_12 gpio
P9_12 pinmux file not found!
Pin has no cape: P9_12

Although, using '-q' reports an issue but using '-l' shows the default setting which is strange.


$ config-pin -q P9_12
P9_12 pinmux file not found!
Pin has no cape: P9_12

$ config-pin -l P9_12 default gpio gpio_pu gpio_pd gpio_input

However, there does seem to be a pinmux def for the P9_15 pin.


$ cat /sys/kernel/debug/pinctrl/4a003400.pinmux/pinmux-pins |grep "pin 16"
pin 16 (PIN16): (MUX UNCLAIMED) (GPIO UNCLAIMED)

$ cat /sys/kernel/debug/pinctrl/4a003400.pinmux/pins |grep "pin 16" pin 16 (PIN16) 4a003440 00060007 pinctrl-single

Running the Adafruit BBIO Python code from a Python cli, I do not see a pinmux error but nothing happens on the GPIO pin:


$ python
Python 2.7.13 (default, Sep 26 2018, 18:42:22) 
[GCC 6.3.0 20170516] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import Adafruit_BBIO.GPIO as GPIO
>>> GPIO.setup("P9_15", GPIO.OUT)
>>> GPIO.output("P9_15", GPIO.HIGH)

Something seems to be missing or just different with the AI.

@RaisingAwesome
Copy link

RaisingAwesome commented Oct 21, 2019

I see there was some activity on the beagleboard/bb.org-overlays a few days ago that looks like there were some updates for the AI. However, I upgraded everything and I still get the same error concerning pinmux.

info: No pinmux for P9_14
fs.js:642
return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
^
Error: ENOENT: no such file or directory, open '/sys/devices/platform/bone_capemgr/slots

-Sean

@jomoengineer
Copy link

Looking at the BB AI schematic and the Data Sheet for the am527x, the AI pin mapping on P8 and P9 is not the same as with a BB Black. For the BB AI P9_15 is mapped to pin/ball AG4 which is associated with signal 'AG4_GPIO_12' and P9_12 which I was trying to use as well is mapped to 'B14_MCASP_ACLKR' so I suppose this is not a GPIO pin.

Locate the .dts file:


debian@beaglebone:/opt/scripts$ sudo tools/version.sh |grep -v "overlay"
git:/opt/scripts/:[b4e40ed94bc1e15bb291d10af48e0e9893864197]
model:[BeagleBoard.org_BeagleBone_AI]
dogtag:[BeagleBoard.org Debian Image 2019-08-03]
UBOOT: Booted Device-Tree:[am5729-beagleboneai.dts]
kernel:[4.14.108-ti-r121]
nodejs:[v6.17.0]

Looking at the .dts file located at the following, the P9_15 entry is not enabled.


  /opt/source/dtb-4.14-ti/src/arm/am5729-beagleboneai.dts

  DRA7XX_CORE_IOPAD(0x3514, MUX_MODE14) /* AG4: P9.15: vin1a_d8.off */

I tried changing this by adding 'PIN_OUTPUT' and rebuilt the dts but still no luck.


  DRA7XX_CORE_IOPAD(0x3514, PIN_OUTPUT | MUX_MODE14) /* AG4: P9.15: vin1a_d8.on */

Since on the BB AI P9_15 is associated with gpio3_12, then I am guessing the gpio pin number is 108. Trying to enable this from command line still has not been successful.

@jadonk
Copy link
Member

jadonk commented Oct 24, 2019

Numbering starts at 1 for GPIO banks, so gpio3_12 is 2*32 + 12 = 76.

@jadonk
Copy link
Member

jadonk commented Oct 24, 2019

@jomoengineer
Copy link

Ah, yes, 76 did the trick. I now have light on P9.15

The spreadsheet is very helpful.

@jomoengineer
Copy link

Also, in the Python example, since the Adafruit GPIO libs are more associated with the previous BBs, P8_39 maps to gpio76 . Thus, changing the P9_15 entry to P8_39 in the Cloud9 Python example results in a blinky LED on the BB AI P9_15 connection.
Ex:


#out = "P9_15"
out = "P8_39"

@mayermakes
Copy link
Author

mayermakes commented Oct 25, 2019 via email

@jomoengineer
Copy link

jomoengineer commented Oct 25, 2019 via email

@RishiDharshan
Copy link

I am a beginner to the field of open source,
And I would really love to contribute in this project,
Can anyone point me to the right direction

@jadonk
Copy link
Member

jadonk commented Sep 4, 2020

Start with the issue labeled "good first issue" https://github.com/beagleboard/cloud9-examples/issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants