BBB: GPIO signal won't stay high

28 views
Skip to first unread message

marius.m...@gmail.com

unread,
Jun 7, 2016, 3:54:00 PM6/7/16
to BeagleBoard

So I have a BeagleBone Black board (Debian distro), and I want to be able to set some GPIO pin from a lowvalue to a high value.


For achieving this I'm using the BlackLib [1] library (a C++ library that offers general access to all beaglebone's pins).


That library haves a class called BlackGPIO that offers the functionality that I want.


BlackLib::BlackGPIO NSLP_pin(BlackLib::GPIO_61, BlackLib::output, BlackLib::SecureMode);

auto NSLP_pinMode = NSLP_pin.getValue();

NSLP_pin.setValue(BlackLib::high);


I expect that this lines of code will set the signal from a low value to a high one (the signal is low by default).


The problem is that the signal goes high only for about ~10ms (measured on a scope), and after that it goes low again.


What I do wrong?


How can I set the some GPIO pin at a certain value, and remain like that until I change it?


[1] link.

William Hermans

unread,
Jun 7, 2016, 3:56:51 PM6/7/16
to beagl...@googlegroups.com
Your asking in the wrong place. You should be asking the maintainer of the code you're using, not here. I can tell you that wrapping the GPIO sysfs system would be trivial for even an aatuer C/C++ developer. Once you understood how sysfs applies to the gpio stuff.

--
For more options, visit http://beagleboard.org/discuss
---
You received this message because you are subscribed to the Google Groups "BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email to beagleboard...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/beagleboard/139dd924-dcd7-43e0-8a79-89e1ecc5c5ea%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

William Hermans

unread,
Jun 7, 2016, 3:59:48 PM6/7/16
to beagl...@googlegroups.com
I do not have any code in C/C++ i can show you but i recently wrote a very simple Nodejs ( javascript ) wrapper library for much more than just gpio but here . . . if you can read Javascript, which you should if you're using C++ . . .

"use strict";
var fs = require('fs');
var path = "/sys/class/gpio/gpio";

exports.read = function(pin, file){   
    fs.access(path + pin + "/" + file, fs.F_OK, (err) => {
        if(err){throw err;}
    });

    return fs.readFileSync(path + pin + "/" + file, 'utf8');
};

exports.write = function(pin, file, value){
    fs.access(path + pin + "/" + file, fs.F_OK, (err) => {
        if(err){throw err;}
    });

    fs.writeFileSync(path + pin + "/" + file, value, 'utf8');
};

exports.export_pin = function(pin){
    var file ="/sys/class/gpio/export";

    fs.writeFileSync(file, pin, 'utf8');
};

exports.unexport_pin = function(pin){
    var file ="/sys/class/gpio/unexport";

    fs.writeFileSync(file, pin, 'utf8');
};


Not very difficult is it ?
Reply all
Reply to author
Forward
0 new messages