element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
BeagleBoard
  • Products
  • Dev Tools
  • Single-Board Computers
  • BeagleBoard
  • More
  • Cancel
BeagleBoard
Forum Accessing GPIO and PWM on BeagleBone AI
  • Blog
  • Forum
  • Documents
  • Quiz
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join BeagleBoard to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • State Verified Answer
  • Replies 36 replies
  • Answers 21 answers
  • Subscribers 105 subscribers
  • Views 8371 views
  • Users 0 members are here
  • beaglebone ai
Related

Accessing GPIO and PWM on BeagleBone AI

Sean_Miller
Sean_Miller over 6 years ago

I'm running through the BeagleBone examples for the AI, but the ones that attempt to read or write to pins throw errors in both Python and bonescript.

 

Here is the output from analoginout.js:

 

Hit ^C to stop

info: No pinmux for P9_14

fs.js:733

  var r = binding.read(fd, buffer, offset, length, position);

                 ^

Error: ETIMEDOUT: connection timed out, read

    at Error (native)

    at Object.fs.readSync (fs.js:733:19)

    at tryReadSync (fs.js:488:20)

    at Object.fs.readFileSync (fs.js:528:19)

    at Object.readAIN (/usr/local/lib/node_modules/bonescript/src/hw_mainline.js:287:30)

    at Object.f.analogRead (/usr/local/lib/node_modules/bonescript/src/index.js:330:19)

    at Timeout.loop [as _onTimeout] (/var/lib/cloud9/BeagleBone/AI/analogInOut.js:23:19)

    at ontimeout (timers.js:386:11)

    at tryOnTimeout (timers.js:250:5)

    at Timer.listOnTimeout (timers.js:214:5)

 

Is there a config I need to do first?  I see other's in the world with this issue on older BeagleBone's and the responses vary considerably.

 

This is the code:

const b = require('bonescript');


const inputPin  = "A3";
const outputPin = "P9_14";


console.log('Hit ^C to stop');
b.pinMode(outputPin, b.ANALOG_OUTPUT);
setTimeout(loop, 200);  // work-around to wait for PWM permissions


function loop() {
    var value = b.analogRead(inputPin);
    process.stdout.write(inputPin + '-->' + outputPin + ': ' + (value*100).toFixed(1) + '%   \r');
    b.analogWrite(outputPin, value);
    setTimeout(loop, 10);
}

 

Thanks,

Sean

  • Sign in to reply
  • Cancel

Top Replies

  • Sean_Miller
    Sean_Miller over 6 years ago in reply to Sean_Miller +4
    YYYYYEEEEEAAA!!!!!!!! blinkLED.js works now!!! I always tell the boy...if you can blink an LED, you can change the world. The door is open! See ya', Sean
  • Sean_Miller
    Sean_Miller over 6 years ago in reply to clem57 +2 suggested
    I saw these two references tonight in my hunt. My thoughts were "this surely is handled in by the bonescript and Python libraries on the fly, right?" "Otherwise, it would be in the comments in the header…
  • mayermakes
    mayermakes over 6 years ago in reply to clem57 +2 suggested
    The only thing I could find out about this issue is that the device tree files for the BB-AI are missing, there is currently no suitable file provided for the BB-AI all the BBB black files just brick the…
Parents
  • Sean_Miller
    0 Sean_Miller over 6 years ago

    Here's a hack for Python on the BBAI.

     

    Change...

     

    out = "P9_15"

    to

    out = "P8_39"

     

    in the blink demo and you'll get an LED blink.  It's because of the mapping difference between the BBB and BBAI.

     

    See ya',

    Sean

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Reject Answer
    • Cancel
  • Sean_Miller
    0 Sean_Miller over 6 years ago in reply to Sean_Miller

    And another pin hack for the BBAI for Adafruit's Python Library BBB pins:

     

    out = "P8_13" #actually 8_22 on BBAI

     

    Here's how I'm finding it...

    • At the terminal type:
      • node -pe "require('bonescript').bone.getPinObject('p8.22').ai.gpio"
    • It will give you a number.  In this case it returns 23.
    • Do a CTRL f on the number here:  https://github.com/adafruit/adafruit-beaglebone-io-python/blob/master/source/common.c#L73
    • For this one, I found { "EHRPWM2B", "P8_13", 23, 4, -1} - which is P8_13.

     

    So, using BBB's reference to P8_13 will get you use of BBAI 8_22.

     

    Two out pins are much better than none for now.  Now to get an analog in and a PWM out working.  Most likely, as soon as I get it, Adafruit will release their update.  image

     

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Verify Answer
    • Reject Answer
    • Cancel
  • clem57
    0 clem57 over 6 years ago in reply to Sean_Miller

    And this makes perfect sense. The new Sitera for the BB-AI has pins at new places on the board versus the old Sitera.

    Clem

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Reply
  • clem57
    0 clem57 over 6 years ago in reply to Sean_Miller

    And this makes perfect sense. The new Sitera for the BB-AI has pins at new places on the board versus the old Sitera.

    Clem

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Children
No Data
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube