beagleboard / cloud9-examples

MIT License
52 stars 29 forks source link

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

Open mayermakes opened 4 years ago

mayermakes commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

Do you really get an external led connected to a gpio blinking with the c example or does the Programm just run? Python and c do appear to run for me but they do not actually produce the intended gpio output because of the misding pinmux

jomoengineer notifications@github.com schrieb am So., 20. Okt. 2019, 11:20:

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

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/beagleboard/cloud9-examples/issues/18?email_source=notifications&email_token=AL2DEZXW36JJ474XICNRLLTQPQPFTA5CNFSM4I63CLQ2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEBYF5IQ#issuecomment-544235170, or unsubscribe https://github.com/notifications/unsubscribe-auth/AL2DEZUWEYQ2NYZVVNFYM43QPQPFTANCNFSM4I63CLQQ .

jomoengineer commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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

jadonk commented 4 years ago

Also, this spreadsheet may be helpful: https://docs.google.com/spreadsheets/d/1fE-AsDZvJ-bBwzNBj1_sPDrutvEvsmARqFwvbw_HkrE/edit?usp=sharing

jomoengineer commented 4 years ago

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

The spreadsheet is very helpful.

jomoengineer commented 4 years ago

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 commented 4 years ago

So this might mean that the pinout and the internal connection do not line up, which renders any pinout or compability with capes non working. We need a compability layer in between that is not there, so a BB-AI port of the adafruit-bbio library is needed to make it usable again and compatible with existing hardware, same goes for the other languages. Von meinem Huawei-Telefon gesendet-------- Ursprüngliche Nachricht --------Betreff: Re: [beagleboard/cloud9-examples] GPIO not working on-py .js .c . PINMUX missing (#18)Von: jomoengineer An: beagleboard/cloud9-examples Cc: mayermakes ,Author 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"

—You are receiving this because you authored the thread.Reply to this email directly, view it on GitHub, or unsubscribe.

jomoengineer commented 4 years ago

I believe the issue with the Adafruit BBIO.GPIO code is that it was coded for the previous BBs and not the AI. The BB Black has a gpio0 where, as Jason pointed, the BB AI does not thus the GPIO mapping will be different. I filed an issue at the Adafruit BBIO github to see if this can be addressed.

Jon

On Fri, Oct 25, 2019 at 1:22 AM mayermakes notifications@github.com wrote:

So this might mean that the pinout and the internal connection do not line up, which renders any pinout or compability with capes non working. We need a compability layer in between that is not there, so a BB-AI port of the adafruit-bbio library is needed to make it usable again and compatible with existing hardware, same goes for the other languages. Von meinem Huawei-Telefon gesendet-------- Ursprüngliche Nachricht --------Betreff: Re: [beagleboard/cloud9-examples] GPIO not working on-py .js .c . PINMUX missing (#18)Von: jomoengineer An: beagleboard/cloud9-examples Cc: mayermakes ,Author 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"

—You are receiving this because you authored the thread.Reply to this email directly, view it on GitHub, or unsubscribe.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/beagleboard/cloud9-examples/issues/18?email_source=notifications&email_token=ACTYYMRU47BFNILDKAUWU43QQKUD3A5CNFSM4I63CLQ2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOECHTBMI#issuecomment-546255025, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACTYYMUMKN5SU7UJCGGAPVTQQKUD3ANCNFSM4I63CLQQ .

RishiDharshan commented 4 years ago

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 commented 4 years ago

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