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 8394 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
  • jomoenginer
    0 jomoenginer over 6 years ago in reply to Sean_Miller

    Thanks for posting what I had posted elsewhere.

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

    If you're referring to the BeagleBoard forum, I'm on Jason's discussion as well, but it says my posts are awaiting the moderator to accept, I assume since I'm new to the forum.  You wouldn't have anything to drive PWM, would you?

     

    -Sean

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

    I'm referring to the following:

    out = "P9_15"
    
    to
    out = "P8_39"

     

     

    Perhaps it would be best if you reference where you find things.

     

    As I posted, the Adafruit BBIO.GPIO lib was written for the previous versions of the BBs and since the BB AI uses a AM57x which Jason noted has a different pin mapping, the Adafruit lib will not work as expected.  Mapping gpio76 between the BB Black and the BB AI:

    BB Black - P9_15 - gpio1_16 -  GPIO - 48

     

    BB AI -     P9_15 - gpio3_12 - GPIO - 76

    NOTE: As Jason stated, the AM57x does not have a gpio0, thus to calculate the GPIO value you skip gpio0 and come up with;

      2 x 32 + 12 = 76

     

    I was calculating it as if it were a BB Black where this would have been 3 x 32 + 12 or 108.

     

    The Adafruit library is expecting P9_15 to be mapped to GPIO 48, to on a BB AI this does not work.   However, finding the GPIO 76 equivalent on the BB Black resulted in P8_39 or gpio2_12 (76).

     

    I filed an issue with the Adfruit BBIO.GPIO github repo to address this to see if there were any interest in getting it to properly support the BB AI.

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

    I'm referring to the following:

    out = "P9_15"
    
    to
    out = "P8_39"

     

     

    Perhaps it would be best if you reference where you find things.

     

    As I posted, the Adafruit BBIO.GPIO lib was written for the previous versions of the BBs and since the BB AI uses a AM57x which Jason noted has a different pin mapping, the Adafruit lib will not work as expected.  Mapping gpio76 between the BB Black and the BB AI:

    BB Black - P9_15 - gpio1_16 -  GPIO - 48

     

    BB AI -     P9_15 - gpio3_12 - GPIO - 76

    NOTE: As Jason stated, the AM57x does not have a gpio0, thus to calculate the GPIO value you skip gpio0 and come up with;

      2 x 32 + 12 = 76

     

    I was calculating it as if it were a BB Black where this would have been 3 x 32 + 12 or 108.

     

    The Adafruit library is expecting P9_15 to be mapped to GPIO 48, to on a BB AI this does not work.   However, finding the GPIO 76 equivalent on the BB Black resulted in P8_39 or gpio2_12 (76).

     

    I filed an issue with the Adfruit BBIO.GPIO github repo to address this to see if there were any interest in getting it to properly support the BB AI.

    • 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